Is this the I2C discovery program from MCU FRIEND ?
it calls a method called ReadReg() passing the parameter 0x00 storing result in val.
then, it ANDs val with the 1's compliment of 0x40, clearing bit 6
calls a method called WriteReg pasking two parameters.
Corrected after Jerry Messina posted. i had it totally wrong initially as I overlooked the apersand. Thank you Jerry!
Last edit: Anobium 2023-09-19
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Does anyone know what this code does?
static const uint8_t REG_CNTRL1 = 0x00;
// Set enable bit
WriteReg(REG_CNTRL1, 0x40 );
Is this the I2C discovery program from MCU FRIEND ?
it calls a method called ReadReg() passing the parameter 0x00 storing result in val.
then, it ANDs val with the 1's compliment of 0x40, clearing bit 6
calls a method called WriteReg pasking two parameters.
Corrected after Jerry Messina posted. i had it totally wrong initially as I overlooked the apersand. Thank you Jerry!
Last edit: Anobium 2023-09-19
val &= ~0x40;
That statement ANDs val with the 1's compliment of 0x40, clearing bit 6
Same as
Thanks!