Remove io_atmega2560.h and some more macros

This commit is contained in:
Alex Voinea 2020-09-11 17:43:38 +03:00
parent eb007c35d2
commit c3abd4ffe6
No known key found for this signature in database
GPG key ID: F5034E7CFCF2F973
12 changed files with 79 additions and 452 deletions
Firmware

View file

@ -1,6 +1,7 @@
#ifndef MACROS_H
#define MACROS_H
#include <avr/interrupt.h> //for cli() and sei()
#define FORCE_INLINE __attribute__((always_inline)) inline
#define _UNUSED __attribute__((unused))
@ -14,5 +15,21 @@
#define STRINGIFY_(M) #M
#define STRINGIFY(M) STRINGIFY_(M)
// Macros for bit masks
#undef _BV
#define _BV(n) (1<<(n))
#define TEST(n,b) (!!((n)&_BV(b)))
#define SET_BIT_TO(N,B,TF) do{ if (TF) SBI(N,B); else CBI(N,B); }while(0)
#ifndef SBI
#define SBI(A,B) (A |= (1 << (B)))
#endif
#ifndef CBI
#define CBI(A,B) (A &= ~(1 << (B)))
#endif
#define TBI(N,B) (N ^= _BV(B))
#endif //MACROS_H