write a single bit in an 8-bit device register. * @param devAddr I2C slave device address * @param regAddr Register regAddr to write to * @param bitNum Bit position to write (0-7) * @param value New bit value to write * @return Status of operation (true = success) */
| 470 | * @return Status of operation (true = success) |
| 471 | */ |
| 472 | bool I2Cdev::writeBit(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint8_t data, void *wireObj) { |
| 473 | uint8_t b; |
| 474 | readByte(devAddr, regAddr, &b, I2Cdev::readTimeout, wireObj); |
| 475 | b = (data != 0) ? (b | (1 << bitNum)) : (b & ~(1 << bitNum)); |
| 476 | return writeByte(devAddr, regAddr, b, wireObj); |
| 477 | } |
| 478 | |
| 479 | /** write a single bit in a 16-bit device register. |
| 480 | * @param devAddr I2C slave device address |
nothing calls this directly
no outgoing calls
no test coverage detected