These macros read and write a bit from/to in the variable.
The bitRead()/bitSet()/bitClear()/bitWrite() are defined in hardware/arduino/avr/cores/arduino/Arduino.h as below.
The bitRead() shifts right the value by bit-bits, then get bitwise AND with 0x01. So it gets the bit-th bit of the value.
The bitSet() shifts left 0x01 by bit-bits, then get bitwise OR with value. So it sets the bit-th bit of the value to 1.
The bitClear() shift left 0x01 by bit-bits and inverts all the bits, then get bitwise AND with value. So it sets the bit-th bit of the value to 0.
The bitWrite() calls bitSet() if the bitvalue is not 0, or calls bitClear() if the bitvalue is 0.
June 19, 2020