a series of wire helper functions that make dealing with device register IO simpler
More...
Go to the source code of this file.
|
void | write4BitToReg8 (WireType wireImpl, uint8_t i2cAddress, uint8_t reg, bool lowBits, uint8_t val) |
|
void | toggleBitInRegister16 (WireType wireType, uint8_t addr, uint8_t regAddr, uint8_t theBit, bool value) |
|
void | toggleBitInRegister8 (WireType wireType, uint8_t addr, uint8_t regAddr, uint8_t theBit, bool value) |
|
bool | wireWriteReg8 (WireType wireType, uint8_t addr, uint8_t reg, uint8_t command) |
|
bool | wireWriteReg16 (WireType wireType, uint8_t addr, uint8_t reg, uint16_t command) |
|
uint8_t | wireReadReg8 (WireType wireType, uint8_t addr, uint8_t reg) |
|
uint16_t | wireReadReg16 (WireType wireType, uint8_t addr, uint8_t reg) |
|
a series of wire helper functions that make dealing with device register IO simpler
◆ write4BitToReg8()
void write4BitToReg8 |
( |
WireType |
wireImpl, |
|
|
uint8_t |
i2cAddress, |
|
|
uint8_t |
reg, |
|
|
bool |
lowBits, |
|
|
uint8_t |
val |
|
) |
| |
Writes a 4 bit value into an 8 bit register preserving the other 4 bits.
- Parameters
-
wireImpl | the wire implementation to use. |
i2cAddress | the i2c address |
reg | the register to write to |
lowBits | if the low or high bits are to be modified |
val | the new value between 0..15 |
◆ toggleBitInRegister16()
void toggleBitInRegister16 |
( |
WireType |
wireType, |
|
|
uint8_t |
addr, |
|
|
uint8_t |
regAddr, |
|
|
uint8_t |
theBit, |
|
|
bool |
value |
|
) |
| |
Toggles a bit in a 16 bit register to the new value
- Parameters
-
wireType | the wire implementation to use |
addr | the i2c address |
regAddr | the register to write to |
theBit | the bit to change |
value | the new value |
◆ toggleBitInRegister8()
void toggleBitInRegister8 |
( |
WireType |
wireType, |
|
|
uint8_t |
addr, |
|
|
uint8_t |
regAddr, |
|
|
uint8_t |
theBit, |
|
|
bool |
value |
|
) |
| |
Toggles a bit in an 8 bit register to the new value
- Parameters
-
wireType | the wire implementation to use |
addr | the i2c address |
regAddr | the register to write to |
theBit | the bit to change |
value | the new value |
◆ wireWriteReg8()
bool wireWriteReg8 |
( |
WireType |
wireType, |
|
|
uint8_t |
addr, |
|
|
uint8_t |
reg, |
|
|
uint8_t |
command |
|
) |
| |
Writes an 8 bit value to a register
- Parameters
-
wireType | the wire implementation |
addr | the i2c address |
reg | the register to change |
command | the value for the register |
- Returns
- true if success
◆ wireWriteReg16()
bool wireWriteReg16 |
( |
WireType |
wireType, |
|
|
uint8_t |
addr, |
|
|
uint8_t |
reg, |
|
|
uint16_t |
command |
|
) |
| |
Writes a 16 bit value to a register
- Parameters
-
wireType | the wire implementation |
addr | the i2c address |
reg | the register to change |
command | the value for the register |
- Returns
- true if success
◆ wireReadReg8()
uint8_t wireReadReg8 |
( |
WireType |
wireType, |
|
|
uint8_t |
addr, |
|
|
uint8_t |
reg |
|
) |
| |
Reads an 8 bit value from a given register
- Parameters
-
wireType | the wire implementation |
addr | the i2c address |
reg | the register to read |
- Returns
- the register value
◆ wireReadReg16()
uint16_t wireReadReg16 |
( |
WireType |
wireType, |
|
|
uint8_t |
addr, |
|
|
uint8_t |
reg |
|
) |
| |
Reads a 16 bit value from a given register
- Parameters
-
wireType | the wire implementation |
addr | the i2c address |
reg | the register to read |
- Returns
- the register value