![](/media/cache/group/u-blox_logo_trans.png.50x50_q85.png)
portable version of the cumulocity demo
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
DeviceIO.cpp@55:ed3a2751a2b5, 2014-10-01 (annotated)
- Committer:
- mazgch
- Date:
- Wed Oct 01 09:36:19 2014 +0000
- Revision:
- 55:ed3a2751a2b5
- Parent:
- 52:8f1370084268
update dependency, remove special pin names in this project as they are part of the target sdk
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Cumulocity | 41:804f6a0bda26 | 1 | #include "DeviceIO.h" |
mazgch | 55:ed3a2751a2b5 | 2 | #include "PinNames.h" |
Cumulocity | 41:804f6a0bda26 | 3 | |
vwochnik | 52:8f1370084268 | 4 | #define DEF "\033[39m" |
vwochnik | 52:8f1370084268 | 5 | #define GRE "\033[32m" |
vwochnik | 52:8f1370084268 | 6 | #define CYA "\033[36m" |
vwochnik | 52:8f1370084268 | 7 | |
Cumulocity | 47:89ae46d5c466 | 8 | DeviceIO::DeviceIO(GPSI2C& gps) : |
Cumulocity | 47:89ae46d5c466 | 9 | _gpsTracker(gps), |
Cumulocity | 46:f6976fd64387 | 10 | _resetButton(D4), // fire button on arduino app shield |
Cumulocity | 47:89ae46d5c466 | 11 | _analog1(A0), |
Cumulocity | 47:89ae46d5c466 | 12 | _analog2(A1), |
mazgch | 55:ed3a2751a2b5 | 13 | _temperatureSensor(D14/*SDA*/, D15/*SCL*/), |
mazgch | 55:ed3a2751a2b5 | 14 | _accelerometer(D14/*SDA*/, D15/*SCL*/), |
Cumulocity | 41:804f6a0bda26 | 15 | _lcd(D11, D13, D12, D7, D10) |
Cumulocity | 41:804f6a0bda26 | 16 | { |
Cumulocity | 41:804f6a0bda26 | 17 | } |
Cumulocity | 41:804f6a0bda26 | 18 | |
Cumulocity | 46:f6976fd64387 | 19 | bool DeviceIO::resetButtonPressed() |
Cumulocity | 46:f6976fd64387 | 20 | { |
Cumulocity | 46:f6976fd64387 | 21 | return _resetButton; |
Cumulocity | 46:f6976fd64387 | 22 | } |
Cumulocity | 46:f6976fd64387 | 23 | |
Cumulocity | 47:89ae46d5c466 | 24 | GPSTracker& DeviceIO::gpsTracker() |
Cumulocity | 47:89ae46d5c466 | 25 | { |
Cumulocity | 47:89ae46d5c466 | 26 | return _gpsTracker; |
Cumulocity | 47:89ae46d5c466 | 27 | } |
Cumulocity | 47:89ae46d5c466 | 28 | |
Cumulocity | 47:89ae46d5c466 | 29 | AnalogIn& DeviceIO::analog1() |
Cumulocity | 47:89ae46d5c466 | 30 | { |
Cumulocity | 47:89ae46d5c466 | 31 | return _analog1; |
Cumulocity | 47:89ae46d5c466 | 32 | } |
Cumulocity | 47:89ae46d5c466 | 33 | |
Cumulocity | 47:89ae46d5c466 | 34 | AnalogIn& DeviceIO::analog2() |
Cumulocity | 47:89ae46d5c466 | 35 | { |
Cumulocity | 47:89ae46d5c466 | 36 | return _analog2; |
Cumulocity | 47:89ae46d5c466 | 37 | } |
Cumulocity | 41:804f6a0bda26 | 38 | LM75B& DeviceIO::temperatureSensor() |
Cumulocity | 41:804f6a0bda26 | 39 | { |
Cumulocity | 41:804f6a0bda26 | 40 | return _temperatureSensor; |
Cumulocity | 41:804f6a0bda26 | 41 | } |
Cumulocity | 41:804f6a0bda26 | 42 | |
Cumulocity | 41:804f6a0bda26 | 43 | MMA7660& DeviceIO::accelerometer() |
Cumulocity | 41:804f6a0bda26 | 44 | { |
Cumulocity | 41:804f6a0bda26 | 45 | return _accelerometer; |
Cumulocity | 41:804f6a0bda26 | 46 | } |
Cumulocity | 41:804f6a0bda26 | 47 | |
Cumulocity | 41:804f6a0bda26 | 48 | void DeviceIO::lcdPrint(const char *line1, const char *line2, const char *line3) |
Cumulocity | 41:804f6a0bda26 | 49 | { |
vwochnik | 52:8f1370084268 | 50 | printf(GRE "io::lcdPrint" DEF "\r\n"); |
Cumulocity | 41:804f6a0bda26 | 51 | _lcd.cls(); |
Cumulocity | 41:804f6a0bda26 | 52 | _lcd.locate(0, 0); |
vwochnik | 52:8f1370084268 | 53 | |
Cumulocity | 41:804f6a0bda26 | 54 | _lcd.printf("%s\n", line1); |
vwochnik | 52:8f1370084268 | 55 | printf(GRE "> " CYA "%s\r\n" DEF, line1); |
vwochnik | 52:8f1370084268 | 56 | |
Cumulocity | 41:804f6a0bda26 | 57 | if (line2 != NULL) { |
Cumulocity | 41:804f6a0bda26 | 58 | _lcd.printf("%s\n", line2); |
vwochnik | 52:8f1370084268 | 59 | printf(GRE "> " CYA "%s\r\n" DEF, line2); |
vwochnik | 52:8f1370084268 | 60 | |
vwochnik | 52:8f1370084268 | 61 | if (line3 != NULL) { |
Cumulocity | 41:804f6a0bda26 | 62 | _lcd.printf("%s\n", line3); |
vwochnik | 52:8f1370084268 | 63 | printf(GRE "> " CYA "%s\r\n" DEF, line3); |
vwochnik | 52:8f1370084268 | 64 | } |
Cumulocity | 41:804f6a0bda26 | 65 | } |
Cumulocity | 41:804f6a0bda26 | 66 | } |