Arduino/include/bits.h

17 lines
430 B
C
Raw Normal View History

2023-10-27 15:52:40 +00:00
//
// 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