1 #ifndef WProgram_h 2 #define WProgram_h 3 4 #include <stdlib.h> 5 #include <string.h> 6 #include <math.h> 7 8 #include <avr/interrupt.h> 9 10 #include "wiring.h" 11 12 #ifdef __cplusplus 13 #include "WCharacter.h" 14 #include "WString.h" 15 #include "HardwareSerial.h" 16 17 uint16_t makeWord(uint16_t w); 18 uint16_t makeWord(byte h, byte l); 19 20 #define word(...) makeWord(__VA_ARGS__) 21 22 unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L); 23 24 void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0); 25 void noTone(uint8_t _pin); 26 27 // WMath prototypes 28 long random(long); 29 long random(long, long); 30 void randomSeed(unsigned int); 31 long map(long, long, long, long, long); 32 33 #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) 34 const static uint8_t A0 = 54; 35 const static uint8_t A1 = 55; 36 const static uint8_t A2 = 56; 37 const static uint8_t A3 = 57; 38 const static uint8_t A4 = 58; 39 const static uint8_t A5 = 59; 40 const static uint8_t A6 = 60; 41 const static uint8_t A7 = 61; 42 const static uint8_t A8 = 62; 43 const static uint8_t A9 = 63; 44 const static uint8_t A10 = 64; 45 const static uint8_t A11 = 65; 46 const static uint8_t A12 = 66; 47 const static uint8_t A13 = 67; 48 const static uint8_t A14 = 68; 49 const static uint8_t A15 = 69; 50 #else 51 const static uint8_t A0 = 14; 52 const static uint8_t A1 = 15; 53 const static uint8_t A2 = 16; 54 const static uint8_t A3 = 17; 55 const static uint8_t A4 = 18; 56 const static uint8_t A5 = 19; 57 const static uint8_t A6 = 20; 58 const static uint8_t A7 = 21; 59 #endif 60 61 #endif 62 63 #endif