Lets you control your mbed from an easy to use GUI. Entire project is on git hub: https://github.com/navin-bhaskar/Controller For usage info follow this link http://navinbhaskar.blogspot.in/2013/02/arduino-controller-3.html
MbedPerAccess.h@1:9d3340bcd863, 2013-02-26 (annotated)
- Committer:
- Navin
- Date:
- Tue Feb 26 03:51:46 2013 +0000
- Revision:
- 1:9d3340bcd863
- Parent:
- 0:fe5850ccdb6f
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Navin | 1:9d3340bcd863 | 1 | /* |
Navin | 1:9d3340bcd863 | 2 | * This program is free software; you can redistribute it and/or modify |
Navin | 1:9d3340bcd863 | 3 | * it under the terms of the GNU General Public License as published by |
Navin | 1:9d3340bcd863 | 4 | * the Free Software Foundation; either version 2 of the License, or |
Navin | 1:9d3340bcd863 | 5 | * (at your option) any later version. |
Navin | 1:9d3340bcd863 | 6 | * |
Navin | 1:9d3340bcd863 | 7 | * This program is distributed in the hope that it will be useful, |
Navin | 1:9d3340bcd863 | 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
Navin | 1:9d3340bcd863 | 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Navin | 1:9d3340bcd863 | 10 | * GNU General Public License for more details. |
Navin | 1:9d3340bcd863 | 11 | * |
Navin | 1:9d3340bcd863 | 12 | * You should have received a copy of the GNU General Public License |
Navin | 1:9d3340bcd863 | 13 | * along with this program; if not, write to the Free Software |
Navin | 1:9d3340bcd863 | 14 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
Navin | 1:9d3340bcd863 | 15 | * MA 02110-1301, USA. |
Navin | 1:9d3340bcd863 | 16 | * |
Navin | 1:9d3340bcd863 | 17 | */ |
Navin | 1:9d3340bcd863 | 18 | |
Navin | 1:9d3340bcd863 | 19 | /** |
Navin | 1:9d3340bcd863 | 20 | * \brief Implements the mbed perephiral access interface |
Navin | 1:9d3340bcd863 | 21 | * \author Navin Bhaskar |
Navin | 1:9d3340bcd863 | 22 | */ |
Navin | 1:9d3340bcd863 | 23 | |
Navin | 0:fe5850ccdb6f | 24 | #ifndef _ARD_PER_ACCESS_H |
Navin | 0:fe5850ccdb6f | 25 | #define _ARD_PER_ACCESS_H |
Navin | 0:fe5850ccdb6f | 26 | |
Navin | 0:fe5850ccdb6f | 27 | #include "PerAccess.h" |
Navin | 0:fe5850ccdb6f | 28 | #include "error.h" |
Navin | 0:fe5850ccdb6f | 29 | |
Navin | 0:fe5850ccdb6f | 30 | #ifndef MBED |
Navin | 0:fe5850ccdb6f | 31 | #define MBED /**< Build for mbed */ |
Navin | 0:fe5850ccdb6f | 32 | #endif |
Navin | 0:fe5850ccdb6f | 33 | |
Navin | 0:fe5850ccdb6f | 34 | class MbedPerAccess : public PerAccess |
Navin | 0:fe5850ccdb6f | 35 | { |
Navin | 0:fe5850ccdb6f | 36 | public: |
Navin | 0:fe5850ccdb6f | 37 | virtual uint digitalOut(uint pinNo, uint val); |
Navin | 0:fe5850ccdb6f | 38 | virtual uint digitalIn(uint pinNo, uint * val); |
Navin | 0:fe5850ccdb6f | 39 | virtual uint analogOut(uint pinNo, uint val); |
Navin | 0:fe5850ccdb6f | 40 | virtual uint analogIn(uint pinNo, uint * outVal); |
Navin | 0:fe5850ccdb6f | 41 | private: |
Navin | 0:fe5850ccdb6f | 42 | #ifdef ARDUINO |
Navin | 0:fe5850ccdb6f | 43 | static const uint _maxDigiPins = 14; /**< Maximun number of digital pins */ |
Navin | 0:fe5850ccdb6f | 44 | static const uint _maxAnInPins = 6; /**< Maximum number of ADC channels */ |
Navin | 0:fe5850ccdb6f | 45 | static const uint _maxAnOutVal = 255; /**< Maximum value that can be output by the PWM uint */ |
Navin | 0:fe5850ccdb6f | 46 | #elif defined (MBED) |
Navin | 0:fe5850ccdb6f | 47 | static const uint _maxDigiOutPins = 25; /**< Maximun number of digital out pins */ |
Navin | 0:fe5850ccdb6f | 48 | static const uint _maxDigiInPins = 25-4; /**< Maximum number of digital in pins */ |
Navin | 0:fe5850ccdb6f | 49 | static const uint _maxAnInPins = 6; /**< Maximum number of ADC channels */ |
Navin | 0:fe5850ccdb6f | 50 | static const uint _maxAnOutVal = 1024; /**< Maximum value that can be output by the ADC uint */ |
Navin | 0:fe5850ccdb6f | 51 | #endif |
Navin | 0:fe5850ccdb6f | 52 | |
Navin | 0:fe5850ccdb6f | 53 | |
Navin | 0:fe5850ccdb6f | 54 | }; |
Navin | 0:fe5850ccdb6f | 55 | |
Navin | 0:fe5850ccdb6f | 56 | #endif |
Navin | 0:fe5850ccdb6f | 57 |