portable version of the cumulocity demo
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
DeviceIO.cpp@47:89ae46d5c466, 2014-07-24 (annotated)
- Committer:
- Cumulocity
- Date:
- Thu Jul 24 23:32:53 2014 +0000
- Revision:
- 47:89ae46d5c466
- Parent:
- 46:f6976fd64387
- Child:
- 52:8f1370084268
major update
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Cumulocity | 41:804f6a0bda26 | 1 | #include "DeviceIO.h" |
Cumulocity | 41:804f6a0bda26 | 2 | |
Cumulocity | 47:89ae46d5c466 | 3 | DeviceIO::DeviceIO(GPSI2C& gps) : |
Cumulocity | 47:89ae46d5c466 | 4 | _gpsTracker(gps), |
Cumulocity | 46:f6976fd64387 | 5 | _resetButton(D4), // fire button on arduino app shield |
Cumulocity | 47:89ae46d5c466 | 6 | _analog1(A0), |
Cumulocity | 47:89ae46d5c466 | 7 | _analog2(A1), |
Cumulocity | 41:804f6a0bda26 | 8 | _temperatureSensor(SDA,SCL), |
Cumulocity | 41:804f6a0bda26 | 9 | _accelerometer(SDA,SCL), |
Cumulocity | 41:804f6a0bda26 | 10 | _lcd(D11, D13, D12, D7, D10) |
Cumulocity | 41:804f6a0bda26 | 11 | { |
Cumulocity | 41:804f6a0bda26 | 12 | } |
Cumulocity | 41:804f6a0bda26 | 13 | |
Cumulocity | 46:f6976fd64387 | 14 | bool DeviceIO::resetButtonPressed() |
Cumulocity | 46:f6976fd64387 | 15 | { |
Cumulocity | 46:f6976fd64387 | 16 | return _resetButton; |
Cumulocity | 46:f6976fd64387 | 17 | } |
Cumulocity | 46:f6976fd64387 | 18 | |
Cumulocity | 47:89ae46d5c466 | 19 | GPSTracker& DeviceIO::gpsTracker() |
Cumulocity | 47:89ae46d5c466 | 20 | { |
Cumulocity | 47:89ae46d5c466 | 21 | return _gpsTracker; |
Cumulocity | 47:89ae46d5c466 | 22 | } |
Cumulocity | 47:89ae46d5c466 | 23 | |
Cumulocity | 47:89ae46d5c466 | 24 | AnalogIn& DeviceIO::analog1() |
Cumulocity | 47:89ae46d5c466 | 25 | { |
Cumulocity | 47:89ae46d5c466 | 26 | return _analog1; |
Cumulocity | 47:89ae46d5c466 | 27 | } |
Cumulocity | 47:89ae46d5c466 | 28 | |
Cumulocity | 47:89ae46d5c466 | 29 | AnalogIn& DeviceIO::analog2() |
Cumulocity | 47:89ae46d5c466 | 30 | { |
Cumulocity | 47:89ae46d5c466 | 31 | return _analog2; |
Cumulocity | 47:89ae46d5c466 | 32 | } |
Cumulocity | 41:804f6a0bda26 | 33 | LM75B& DeviceIO::temperatureSensor() |
Cumulocity | 41:804f6a0bda26 | 34 | { |
Cumulocity | 41:804f6a0bda26 | 35 | return _temperatureSensor; |
Cumulocity | 41:804f6a0bda26 | 36 | } |
Cumulocity | 41:804f6a0bda26 | 37 | |
Cumulocity | 41:804f6a0bda26 | 38 | MMA7660& DeviceIO::accelerometer() |
Cumulocity | 41:804f6a0bda26 | 39 | { |
Cumulocity | 41:804f6a0bda26 | 40 | return _accelerometer; |
Cumulocity | 41:804f6a0bda26 | 41 | } |
Cumulocity | 41:804f6a0bda26 | 42 | |
Cumulocity | 41:804f6a0bda26 | 43 | void DeviceIO::lcdPrint(const char *line1, const char *line2, const char *line3) |
Cumulocity | 41:804f6a0bda26 | 44 | { |
Cumulocity | 41:804f6a0bda26 | 45 | _lcd.cls(); |
Cumulocity | 41:804f6a0bda26 | 46 | _lcd.locate(0, 0); |
Cumulocity | 41:804f6a0bda26 | 47 | _lcd.printf("%s\n", line1); |
Cumulocity | 41:804f6a0bda26 | 48 | if (line2 != NULL) { |
Cumulocity | 41:804f6a0bda26 | 49 | _lcd.printf("%s\n", line2); |
Cumulocity | 41:804f6a0bda26 | 50 | if (line3 != NULL) |
Cumulocity | 41:804f6a0bda26 | 51 | _lcd.printf("%s\n", line3); |
Cumulocity | 41:804f6a0bda26 | 52 | } |
Cumulocity | 41:804f6a0bda26 | 53 | } |