kopia lustrzana https://github.com/pimoroni/pimoroni-pico
Pimoroni I2C: Add reg_write_uint16.
rodzic
f1ea35fbbf
commit
6e71a62c65
|
@ -40,6 +40,15 @@ namespace pimoroni {
|
||||||
i2c_write_blocking(i2c, address, buffer, 2, false);
|
i2c_write_blocking(i2c, address, buffer, 2, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void I2C::reg_write_uint16(uint8_t address, uint8_t reg, uint16_t value) {
|
||||||
|
uint8_t buffer[3] = {
|
||||||
|
reg,
|
||||||
|
(uint8_t)((value & 0xff00) >> 8),
|
||||||
|
(uint8_t)(value & 0x00ff)
|
||||||
|
};
|
||||||
|
i2c_write_blocking(i2c, address, buffer, 3, false);
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t I2C::reg_read_uint8(uint8_t address, uint8_t reg) {
|
uint8_t I2C::reg_read_uint8(uint8_t address, uint8_t reg) {
|
||||||
uint8_t value;
|
uint8_t value;
|
||||||
i2c_write_blocking(i2c, address, ®, 1, false);
|
i2c_write_blocking(i2c, address, ®, 1, false);
|
||||||
|
|
|
@ -63,6 +63,7 @@ namespace pimoroni {
|
||||||
i2c_inst_t* pin_to_inst(uint pin);
|
i2c_inst_t* pin_to_inst(uint pin);
|
||||||
|
|
||||||
void reg_write_uint8(uint8_t address, uint8_t reg, uint8_t value);
|
void reg_write_uint8(uint8_t address, uint8_t reg, uint8_t value);
|
||||||
|
void reg_write_uint16(uint8_t address, uint8_t reg, uint16_t value);
|
||||||
uint8_t reg_read_uint8(uint8_t address, uint8_t reg);
|
uint8_t reg_read_uint8(uint8_t address, uint8_t reg);
|
||||||
uint16_t reg_read_uint16(uint8_t address, uint8_t reg);
|
uint16_t reg_read_uint16(uint8_t address, uint8_t reg);
|
||||||
int16_t reg_read_int16(uint8_t address, uint8_t reg);
|
int16_t reg_read_int16(uint8_t address, uint8_t reg);
|
||||||
|
|
Ładowanie…
Reference in New Issue