added debugging
Fork of BLE_nRF8001 by
BLE_nRF8001/Arduino.cpp@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 | /* |
RedBearLab | 0:075ea2812998 | 19 | * This file is used to map the pins of Arduino to mbed |
RedBearLab | 0:075ea2812998 | 20 | */ |
RedBearLab | 0:075ea2812998 | 21 | |
RedBearLab | 0:075ea2812998 | 22 | #include "mbed.h" |
RedBearLab | 0:075ea2812998 | 23 | #include "Arduino.h" |
RedBearLab | 0:075ea2812998 | 24 | |
RedBearLab | 0:075ea2812998 | 25 | void pinMode(DigitalInOut *pin, int mode) |
RedBearLab | 0:075ea2812998 | 26 | { |
RedBearLab | 0:075ea2812998 | 27 | if (mode == INPUT) |
RedBearLab | 0:075ea2812998 | 28 | { |
RedBearLab | 0:075ea2812998 | 29 | pin->input(); |
RedBearLab | 0:075ea2812998 | 30 | } |
RedBearLab | 0:075ea2812998 | 31 | else if (mode == INPUT_PULLUP) |
RedBearLab | 0:075ea2812998 | 32 | { |
RedBearLab | 0:075ea2812998 | 33 | pin->input(); |
RedBearLab | 0:075ea2812998 | 34 | pin->mode(PullUp); |
RedBearLab | 0:075ea2812998 | 35 | } |
RedBearLab | 0:075ea2812998 | 36 | else if (mode == OUTPUT) |
RedBearLab | 0:075ea2812998 | 37 | { |
RedBearLab | 0:075ea2812998 | 38 | pin->output(); |
RedBearLab | 0:075ea2812998 | 39 | } |
RedBearLab | 0:075ea2812998 | 40 | } |
RedBearLab | 0:075ea2812998 | 41 | |
RedBearLab | 0:075ea2812998 | 42 | void digitalWrite(DigitalInOut *pin, int value) |
RedBearLab | 0:075ea2812998 | 43 | { |
RedBearLab | 0:075ea2812998 | 44 | pin->write(value); |
RedBearLab | 0:075ea2812998 | 45 | } |
RedBearLab | 0:075ea2812998 | 46 | |
RedBearLab | 0:075ea2812998 | 47 | int digitalRead(DigitalInOut *pin) |
RedBearLab | 0:075ea2812998 | 48 | { |
RedBearLab | 0:075ea2812998 | 49 | return pin->read(); |
RedBearLab | 0:075ea2812998 | 50 | } |