Embedded C Firmware Library : Arduino / Atmega328p  1
Register Level Embedded C Hardware Abstraction Library for AVR ATmega48A/PA/88A/PA/168A/PA/328/P or Arduino UNO/NANO/MINI
avr_macros.h
Go to the documentation of this file.
1 
33 #ifndef AVR_MACROS_H_
34 #define AVR_MACROS_H_
35 
36 #pragma message ( "avr_macros.h included" )
37 
38 #ifndef F_CPU
39 #define F_CPU 16000000UL
40 #endif
41 
42 #define F_50Hz 50UL
43 #define F_100Hz 100UL
44 #define F_200Hz 200UL
45 #define F_500Hz 500UL
46 #define F_1kHz 1000UL
47 #define F_5kHz 5000UL
48 #define F_10kHz 10000UL
49 #define F_20kHz 20000UL
50 #define F_40kHz 40000UL
51 #define F_50kHz 50000UL
52 #define F_100kHz 100000UL
53 #define F_200kHz 200000UL
54 #define F_500kHz 500000UL
55 #define F_1000kHz 1000000UL
56 #define F_1Mhz 1000000UL
58 #define F_62500Hz 62500UL
59 #define F_7812Hz 7812UL
60 #define F_976Hz 976UL
61 #define F_244Hz 244UL
62 #define F_61Hz 61UL
64 #define ENABLE 0x01
65 #define DISABLE 0x00
66 
67 #define BUSY 2
68 #define ERROR 1
69 #define OK 0
70 
71 #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~(1<<bit))
72 #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= (1<<bit))
73 
74 #define SETBIT(ADDRESS,BIT) (ADDRESS |= (1<<BIT))
75 #define CLEARBIT(ADDRESS,BIT) (ADDRESS &= ~(1<<BIT))
76 #define FLIPBIT(ADDRESS,BIT) (ADDRESS ^= (1<<BIT))
77 #define CHECKBIT(ADDRESS,BIT) (ADDRESS & (1<<BIT))
78 
79 #endif /* AVR_MACROS_H_ */