portable version of the cumulocity demo
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
DeviceIO.cpp@46:f6976fd64387, 2014-07-24 (annotated)
- Committer:
- Cumulocity
- Date:
- Thu Jul 24 16:02:47 2014 +0000
- Revision:
- 46:f6976fd64387
- Parent:
- 41:804f6a0bda26
- Child:
- 47:89ae46d5c466
implement device credential reset; show username/password on display
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 | 41:804f6a0bda26 | 3 | DeviceIO::DeviceIO() : |
Cumulocity | 46:f6976fd64387 | 4 | _resetButton(D4), // fire button on arduino app shield |
Cumulocity | 41:804f6a0bda26 | 5 | _temperatureSensor(SDA,SCL), |
Cumulocity | 41:804f6a0bda26 | 6 | _accelerometer(SDA,SCL), |
Cumulocity | 41:804f6a0bda26 | 7 | _lcd(D11, D13, D12, D7, D10) |
Cumulocity | 41:804f6a0bda26 | 8 | { |
Cumulocity | 41:804f6a0bda26 | 9 | } |
Cumulocity | 41:804f6a0bda26 | 10 | |
Cumulocity | 46:f6976fd64387 | 11 | bool DeviceIO::resetButtonPressed() |
Cumulocity | 46:f6976fd64387 | 12 | { |
Cumulocity | 46:f6976fd64387 | 13 | return _resetButton; |
Cumulocity | 46:f6976fd64387 | 14 | } |
Cumulocity | 46:f6976fd64387 | 15 | |
Cumulocity | 41:804f6a0bda26 | 16 | LM75B& DeviceIO::temperatureSensor() |
Cumulocity | 41:804f6a0bda26 | 17 | { |
Cumulocity | 41:804f6a0bda26 | 18 | return _temperatureSensor; |
Cumulocity | 41:804f6a0bda26 | 19 | } |
Cumulocity | 41:804f6a0bda26 | 20 | |
Cumulocity | 41:804f6a0bda26 | 21 | MMA7660& DeviceIO::accelerometer() |
Cumulocity | 41:804f6a0bda26 | 22 | { |
Cumulocity | 41:804f6a0bda26 | 23 | return _accelerometer; |
Cumulocity | 41:804f6a0bda26 | 24 | } |
Cumulocity | 41:804f6a0bda26 | 25 | |
Cumulocity | 41:804f6a0bda26 | 26 | void DeviceIO::lcdPrint(const char *line1, const char *line2, const char *line3) |
Cumulocity | 41:804f6a0bda26 | 27 | { |
Cumulocity | 41:804f6a0bda26 | 28 | _lcd.cls(); |
Cumulocity | 41:804f6a0bda26 | 29 | _lcd.locate(0, 0); |
Cumulocity | 41:804f6a0bda26 | 30 | _lcd.printf("%s\n", line1); |
Cumulocity | 41:804f6a0bda26 | 31 | if (line2 != NULL) { |
Cumulocity | 41:804f6a0bda26 | 32 | _lcd.printf("%s\n", line2); |
Cumulocity | 41:804f6a0bda26 | 33 | if (line3 != NULL) |
Cumulocity | 41:804f6a0bda26 | 34 | _lcd.printf("%s\n", line3); |
Cumulocity | 41:804f6a0bda26 | 35 | } |
Cumulocity | 41:804f6a0bda26 | 36 | } |