added debugging

Fork of BLE_nRF8001 by RedBearLab

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Arduino.cpp Source File

Arduino.cpp

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 /*
00019 * This file is used to map the pins of Arduino to mbed 
00020 */
00021 
00022 #include "mbed.h"
00023 #include "Arduino.h"
00024 
00025 void pinMode(DigitalInOut *pin, int mode) 
00026 {
00027     if (mode == INPUT)
00028     {
00029         pin->input();
00030     }
00031     else if (mode == INPUT_PULLUP)
00032     {
00033         pin->input();
00034         pin->mode(PullUp);
00035     }
00036     else if (mode == OUTPUT)
00037     {
00038         pin->output();
00039     }    
00040 }
00041 
00042 void digitalWrite(DigitalInOut *pin, int value) 
00043 {
00044     pin->write(value);
00045 }
00046 
00047 int digitalRead(DigitalInOut *pin)
00048 {
00049     return pin->read();
00050 }