m5stack / M5Core2

M5Core2 Arduino Library
MIT License
262 stars 113 forks source link

Update MPU6886.h #117

Closed karl-mills closed 1 year ago

karl-mills commented 1 year ago

Making I2C_Read_NBytes and I2C_Write_NBytes private does not allow these methods to be used in inheritance. Making them protected, still protects them from being accessed by the user, but allows them to be inherited and the functionality of the class to be extended. For example, if a new register read or write needs to be added (e.g. accelerometer calibration offset registers), they can be added and leverage the existing low level read and write functions over I2C. If the methods are private, then the code for I2C_Read_NBytes and I2C_Write_NBytes must be duplicated in the new class that is inheriting from the MPU6886 class.

Please accept this pull request so that when a new class inherits the MPU6886 class it has access to the I2C read and write methods to the MPU6886 device.

Thanks!

Tinyu-Zhao commented 1 year ago

Thank you😄