33 #include "ArduinoMock.h" 48 #define INPUT_PULLUP 0x2 50 #define PI 3.1415926535897932384626433832795 51 #define HALF_PI 1.5707963267948966192313216916398 52 #define TWO_PI 6.283185307179586476925286766559 53 #define DEG_TO_RAD 0.017453292519943295769236907684886 54 #define RAD_TO_DEG 57.295779513082320876798154814105 55 #define EULER 2.718281828459045235360287471352 67 #if defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) 71 #define INTERNAL INTERNAL1V1 72 #elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) 76 #define INTERNAL INTERNAL1V1 77 #define INTERNAL2V56 9 78 #define INTERNAL2V56_EXTCAP 13 80 #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644__) || defined(__AVR_ATmega644A__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) 82 #define INTERNAL2V56 3 95 #define min(a,b) ((a)<(b)?(a):(b)) 96 #define max(a,b) ((a)>(b)?(a):(b)) 97 #define abs(x) ((x)>0?(x):-(x)) 98 #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) 99 #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) 100 #define radians(deg) ((deg)*DEG_TO_RAD) 101 #define degrees(rad) ((rad)*RAD_TO_DEG) 102 #define sq(x) ((x)*(x)) 104 #define interrupts() sei() 105 #define noInterrupts() cli() 107 #define clockCyclesPerMicrosecond() ( F_CPU / 1000000L ) 108 #define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() ) 109 #define microsecondsToClockCycles(a) ( (a) * clockCyclesPerMicrosecond() ) 111 #define lowByte(w) ((uint8_t) ((w) & 0xff)) 112 #define highByte(w) ((uint8_t) ((w) >> 8)) 114 #define bitRead(value, bit) (((value) >> (bit)) & 0x01) 115 #define bitSet(value, bit) ((value) |= (1UL << (bit))) 116 #define bitClear(value, bit) ((value) &= ~(1UL << (bit))) 117 #define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) 121 #define _NOP() do { __asm__ volatile ("nop"); } while (0) 124 typedef unsigned int word;
126 #define bit(b) (1UL << (b)) 128 typedef bool boolean;
129 typedef uint8_t byte;
132 void initVariant(
void);
136 void pinMode(uint8_t, uint8_t);
137 void digitalWrite(uint8_t, uint8_t);
138 int digitalRead(uint8_t);
139 int analogRead(uint8_t);
140 void analogReference(uint8_t mode);
141 void analogWrite(uint8_t,
int);
143 unsigned long millis(
void);
144 unsigned long micros(
void);
145 void delay(
unsigned long);
146 void delayMicroseconds(
unsigned int us);
147 unsigned long pulseIn(uint8_t pin, uint8_t state,
unsigned long timeout);
148 unsigned long pulseInLong(uint8_t pin, uint8_t state,
unsigned long timeout);
150 void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
151 uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
153 void attachInterrupt(uint8_t,
void (*)(
void),
int mode);
154 void detachInterrupt(uint8_t);
162 #define analogInPinToBit(P) (P) 166 extern const uint16_t port_to_mode_PGM[];
167 extern const uint16_t port_to_input_PGM[];
168 extern const uint16_t port_to_output_PGM[];
170 extern const uint8_t digital_pin_to_port_PGM[];
172 extern const uint8_t digital_pin_to_bit_mask_PGM[];
173 extern const uint8_t digital_pin_to_timer_PGM[];
180 #define digitalPinToPort(P) ( pgm_read_byte( digital_pin_to_port_PGM + (P) ) ) 181 #define digitalPinToBitMask(P) ( pgm_read_byte( digital_pin_to_bit_mask_PGM + (P) ) ) 182 #define digitalPinToTimer(P) ( pgm_read_byte( digital_pin_to_timer_PGM + (P) ) ) 183 #define analogInPinToBit(P) (P) 184 #define portOutputRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_output_PGM + (P))) ) 185 #define portInputRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_input_PGM + (P))) ) 186 #define portModeRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_mode_PGM + (P))) ) 188 #define digitalPinToInterrupt(p) ((p) == 2 ? 0 : ((p) == 3 ? 1 : ((p) >= 18 && (p) <= 21 ? 23 - (p) : NOT_AN_INTERRUPT))) 193 #define NOT_AN_INTERRUPT -1 209 #define NOT_ON_TIMER 0 235 #include "WCharacter.h" 239 #if defined(HAVE_HWSERIAL0) && defined(HAVE_CDCSERIAL) 240 #error "Targets with both UART0 and CDC serial not supported" 243 uint16_t makeWord(uint16_t w);
244 uint16_t makeWord(byte h, byte l);
246 #define word(...) makeWord(__VA_ARGS__) 248 unsigned long pulseIn(uint8_t pin, uint8_t state,
unsigned long timeout = 1000000L);
249 unsigned long pulseInLong(uint8_t pin, uint8_t state,
unsigned long timeout = 1000000L);
251 void tone(uint8_t _pin,
unsigned int frequency,
unsigned long duration = 0);
252 void noTone(uint8_t _pin);
256 long random(
long,
long);
257 void randomSeed(
unsigned long);
258 long map(
long,
long,
long,
long,
long);
struct emac_rx_descriptor __attribute__((packed, aligned(8))) emac_rx_descriptor_t
Definition: ArduinoMock.h:17