added debugging
Fork of BLE_nRF8001 by
BLE_nRF8001/Arduino.h@2:7805a5595aab, 2014-11-10 (annotated)
- Committer:
- jn80842
- Date:
- Mon Nov 10 01:24:23 2014 +0000
- Revision:
- 2:7805a5595aab
- Parent:
- 0:075ea2812998
just added debugging
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RedBearLab | 0:075ea2812998 | 1 | /* |
RedBearLab | 0:075ea2812998 | 2 | Copyright (c) 2012-2014 RedBearLab |
RedBearLab | 0:075ea2812998 | 3 | |
RedBearLab | 0:075ea2812998 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
RedBearLab | 0:075ea2812998 | 5 | and associated documentation files (the "Software"), to deal in the Software without restriction, |
RedBearLab | 0:075ea2812998 | 6 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, |
RedBearLab | 0:075ea2812998 | 7 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, |
RedBearLab | 0:075ea2812998 | 8 | subject to the following conditions: |
RedBearLab | 0:075ea2812998 | 9 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
RedBearLab | 0:075ea2812998 | 10 | |
RedBearLab | 0:075ea2812998 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, |
RedBearLab | 0:075ea2812998 | 12 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
RedBearLab | 0:075ea2812998 | 13 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE |
RedBearLab | 0:075ea2812998 | 14 | FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
RedBearLab | 0:075ea2812998 | 15 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
RedBearLab | 0:075ea2812998 | 16 | */ |
RedBearLab | 0:075ea2812998 | 17 | |
RedBearLab | 0:075ea2812998 | 18 | #ifndef _ARDUINO_H |
RedBearLab | 0:075ea2812998 | 19 | #define _ARDUINO_H |
RedBearLab | 0:075ea2812998 | 20 | |
RedBearLab | 0:075ea2812998 | 21 | #include "mbed.h" |
RedBearLab | 0:075ea2812998 | 22 | |
RedBearLab | 0:075ea2812998 | 23 | #define HIGH 0x1 |
RedBearLab | 0:075ea2812998 | 24 | #define LOW 0x0 |
RedBearLab | 0:075ea2812998 | 25 | |
RedBearLab | 0:075ea2812998 | 26 | #define INPUT 0x0 |
RedBearLab | 0:075ea2812998 | 27 | #define OUTPUT 0x1 |
RedBearLab | 0:075ea2812998 | 28 | #define INPUT_PULLUP 0x2 |
RedBearLab | 0:075ea2812998 | 29 | |
RedBearLab | 0:075ea2812998 | 30 | #define min(a,b) ((a)<(b)?(a):(b)) |
RedBearLab | 0:075ea2812998 | 31 | #define max(a,b) ((a)>(b)?(a):(b)) |
RedBearLab | 0:075ea2812998 | 32 | #define abs(x) ((x)>0?(x):-(x)) |
RedBearLab | 0:075ea2812998 | 33 | #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) |
RedBearLab | 0:075ea2812998 | 34 | #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) |
RedBearLab | 0:075ea2812998 | 35 | #define radians(deg) ((deg)*DEG_TO_RAD) |
RedBearLab | 0:075ea2812998 | 36 | #define degrees(rad) ((rad)*RAD_TO_DEG) |
RedBearLab | 0:075ea2812998 | 37 | #define sq(x) ((x)*(x)) |
RedBearLab | 0:075ea2812998 | 38 | |
RedBearLab | 0:075ea2812998 | 39 | #define lowByte(w) ((uint8_t) ((w) & 0xff)) |
RedBearLab | 0:075ea2812998 | 40 | #define highByte(w) ((uint8_t) ((w) >> 8)) |
RedBearLab | 0:075ea2812998 | 41 | |
RedBearLab | 0:075ea2812998 | 42 | #define bitRead(value, bit) (((value) >> (bit)) & 0x01) |
RedBearLab | 0:075ea2812998 | 43 | #define bitSet(value, bit) ((value) |= (1UL << (bit))) |
RedBearLab | 0:075ea2812998 | 44 | #define bitClear(value, bit) ((value) &= ~(1UL << (bit))) |
RedBearLab | 0:075ea2812998 | 45 | #define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) |
RedBearLab | 0:075ea2812998 | 46 | |
RedBearLab | 0:075ea2812998 | 47 | #define delay(x) wait_ms(x) |
RedBearLab | 0:075ea2812998 | 48 | |
RedBearLab | 0:075ea2812998 | 49 | extern Serial serial; |
RedBearLab | 0:075ea2812998 | 50 | extern SPI spi; |
RedBearLab | 0:075ea2812998 | 51 | |
RedBearLab | 0:075ea2812998 | 52 | void pinMode(DigitalInOut *pin, int mode); |
RedBearLab | 0:075ea2812998 | 53 | void digitalWrite(DigitalInOut *pin, int value); |
RedBearLab | 0:075ea2812998 | 54 | int digitalRead(DigitalInOut *pin); |
RedBearLab | 0:075ea2812998 | 55 | |
RedBearLab | 0:075ea2812998 | 56 | #endif |