Arduino/include/bits.h

17 lines
430 B
C

//
// Created by servostar on 27.10.23.
//
#ifndef ARDUINO_BITS_H
#define ARDUINO_BITS_H
#define SET_BIT(field, idx) ((field) |= (1 << (idx)))
#define CLR_BIT(field, idx) ((field) &= ~(1 << (idx)))
#define TOG_BIT(field, idx) ((field) ^= (1 << (idx)))
#define GET_BIT(field, idx) (((field) >> idx) & 0x1)
#define SET_OUTPUT(port, pin) SET_BIT(port, pin)
#define SET_INPUT(port, pin) CLR_BIT(port, pin)
#endif //ARDUINO_BITS_H