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
17uint16_t makeWord(uint16_t w);
18uint16_t makeWord(byte h, byte l);
19
20#define word(...) makeWord(__VA_ARGS__)
21
22unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
23
24void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0);
25void noTone(uint8_t _pin);
26
27// WMath prototypes
28long random(long);
29long random(long, long);
30void randomSeed(unsigned int);
31long map(long, long, long, long, long);
32
33#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
34const static uint8_t A0 = 54;
35const static uint8_t A1 = 55;
36const static uint8_t A2 = 56;
37const static uint8_t A3 = 57;
38const static uint8_t A4 = 58;
39const static uint8_t A5 = 59;
40const static uint8_t A6 = 60;
41const static uint8_t A7 = 61;
42const static uint8_t A8 = 62;
43const static uint8_t A9 = 63;
44const static uint8_t A10 = 64;
45const static uint8_t A11 = 65;
46const static uint8_t A12 = 66;
47const static uint8_t A13 = 67;
48const static uint8_t A14 = 68;
49const static uint8_t A15 = 69;
50#else
51const static uint8_t A0 = 14;
52const static uint8_t A1 = 15;
53const static uint8_t A2 = 16;
54const static uint8_t A3 = 17;
55const static uint8_t A4 = 18;
56const static uint8_t A5 = 19;
57const static uint8_t A6 = 20;
58const static uint8_t A7 = 21;
59#endif
60
61#endif
62
63#endif