added debugging

Fork of BLE_nRF8001 by RedBearLab

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Arduino.h Source File

Arduino.h

00001 /*
00002 Copyright (c) 2012-2014 RedBearLab
00003 
00004 Permission is hereby granted, free of charge, to any person obtaining a copy of this software 
00005 and associated documentation files (the "Software"), to deal in the Software without restriction, 
00006 including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 
00007 and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 
00008 subject to the following conditions:
00009 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
00010 
00011 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
00012 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
00013 PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 
00014 FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
00015 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00016 */
00017 
00018 #ifndef _ARDUINO_H
00019 #define _ARDUINO_H
00020 
00021 #include "mbed.h"
00022 
00023 #define HIGH 0x1
00024 #define LOW  0x0
00025 
00026 #define INPUT 0x0
00027 #define OUTPUT 0x1
00028 #define INPUT_PULLUP 0x2
00029 
00030 #define min(a,b) ((a)<(b)?(a):(b))
00031 #define max(a,b) ((a)>(b)?(a):(b))
00032 #define abs(x) ((x)>0?(x):-(x))
00033 #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
00034 #define round(x)     ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
00035 #define radians(deg) ((deg)*DEG_TO_RAD)
00036 #define degrees(rad) ((rad)*RAD_TO_DEG)
00037 #define sq(x) ((x)*(x))
00038 
00039 #define lowByte(w) ((uint8_t) ((w) & 0xff))
00040 #define highByte(w) ((uint8_t) ((w) >> 8))
00041 
00042 #define bitRead(value, bit) (((value) >> (bit)) & 0x01)
00043 #define bitSet(value, bit) ((value) |= (1UL << (bit)))
00044 #define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
00045 #define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
00046 
00047 #define delay(x)    wait_ms(x)
00048 
00049 extern Serial serial;
00050 extern SPI spi;
00051 
00052 void pinMode(DigitalInOut *pin, int mode);
00053 void digitalWrite(DigitalInOut *pin, int value);
00054 int digitalRead(DigitalInOut *pin);
00055 
00056 #endif