Merge pull request #46 from adafruit/add-more-api
add setWidth(), setAddress(), setAddressWidth()
This commit is contained in:
commit
8b13b58c2e
|
|
@ -310,3 +310,25 @@ bool Adafruit_BusIO_RegisterBits::write(uint32_t data) {
|
||||||
* @returns The data width used when initializing the register
|
* @returns The data width used when initializing the register
|
||||||
*/
|
*/
|
||||||
uint8_t Adafruit_BusIO_Register::width(void) { return _width; }
|
uint8_t Adafruit_BusIO_Register::width(void) { return _width; }
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Set the default width of data
|
||||||
|
* @param width the default width of data read from register
|
||||||
|
*/
|
||||||
|
void Adafruit_BusIO_Register::setWidth(uint8_t width) { _width = width; }
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Set register address
|
||||||
|
* @param address the address from register
|
||||||
|
*/
|
||||||
|
void Adafruit_BusIO_Register::setAddress(uint16_t address) {
|
||||||
|
_address = address;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Set the width of register address
|
||||||
|
* @param address_width the width for register address
|
||||||
|
*/
|
||||||
|
void Adafruit_BusIO_Register::setAddressWidth(uint16_t address_width) {
|
||||||
|
_addrwidth = address_width;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ public:
|
||||||
Adafruit_BusIO_Register(Adafruit_I2CDevice *i2cdevice, uint16_t reg_addr,
|
Adafruit_BusIO_Register(Adafruit_I2CDevice *i2cdevice, uint16_t reg_addr,
|
||||||
uint8_t width = 1, uint8_t byteorder = LSBFIRST,
|
uint8_t width = 1, uint8_t byteorder = LSBFIRST,
|
||||||
uint8_t address_width = 1);
|
uint8_t address_width = 1);
|
||||||
|
|
||||||
Adafruit_BusIO_Register(Adafruit_SPIDevice *spidevice, uint16_t reg_addr,
|
Adafruit_BusIO_Register(Adafruit_SPIDevice *spidevice, uint16_t reg_addr,
|
||||||
Adafruit_BusIO_SPIRegType type, uint8_t width = 1,
|
Adafruit_BusIO_SPIRegType type, uint8_t width = 1,
|
||||||
uint8_t byteorder = LSBFIRST,
|
uint8_t byteorder = LSBFIRST,
|
||||||
|
|
@ -54,6 +55,10 @@ public:
|
||||||
|
|
||||||
uint8_t width(void);
|
uint8_t width(void);
|
||||||
|
|
||||||
|
void setWidth(uint8_t width);
|
||||||
|
void setAddress(uint16_t address);
|
||||||
|
void setAddressWidth(uint16_t address_width);
|
||||||
|
|
||||||
void print(Stream *s = &Serial);
|
void print(Stream *s = &Serial);
|
||||||
void println(Stream *s = &Serial);
|
void println(Stream *s = &Serial);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue