MCPcopy Create free account
hub / github.com/SlimeVR/SlimeVR-Tracker-ESP / writeBit

Method writeBit

lib/i2cdev/I2Cdev.cpp:472–477  ·  view source on GitHub ↗

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) */

Source from the content-addressed store, hash-verified

470 * @return Status of operation (true = success)
471 */
472bool 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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected