Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: WakeUp PinDetect
Dependents: Inductive_Sensor Inductive_Sensor_Jasper Inductive_Sensor_3
Bob.h@6:0e7c0ad0508b, 2016-08-24 (annotated)
- Committer:
- bobgiesberts
- Date:
- Wed Aug 24 10:30:41 2016 +0000
- Revision:
- 6:0e7c0ad0508b
- Parent:
- 5:c2468a69aacb
- Child:
- 7:0b23995256e7
Incorporated the button. NOT TESTED YET
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| bobgiesberts | 0:17943815800f | 1 | #ifndef _Bob_H_ |
| bobgiesberts | 0:17943815800f | 2 | #define _Bob_H_ |
| bobgiesberts | 0:17943815800f | 3 | |
| bobgiesberts | 0:17943815800f | 4 | /** |
| bobgiesberts | 0:17943815800f | 5 | * @file Bob.h |
| bobgiesberts | 0:17943815800f | 6 | * @brief collection of some functions to communicate |
| bobgiesberts | 0:17943815800f | 7 | * with the processor board. LEDs, SD, etc. |
| bobgiesberts | 0:17943815800f | 8 | * |
| bobgiesberts | 0:17943815800f | 9 | * @author Bob Giesberts |
| bobgiesberts | 0:17943815800f | 10 | * |
| bobgiesberts | 0:17943815800f | 11 | * @date 2015-12-18 |
| bobgiesberts | 0:17943815800f | 12 | */ |
| bobgiesberts | 0:17943815800f | 13 | |
| bobgiesberts | 0:17943815800f | 14 | #include "mbed.h" |
| bobgiesberts | 6:0e7c0ad0508b | 15 | #include "PinDetect.h" |
| bobgiesberts | 0:17943815800f | 16 | |
| bobgiesberts | 0:17943815800f | 17 | class Bob { |
| bobgiesberts | 0:17943815800f | 18 | public: |
| bobgiesberts | 0:17943815800f | 19 | |
| bobgiesberts | 6:0e7c0ad0508b | 20 | /** Construct a new instance of the class Bob |
| bobgiesberts | 6:0e7c0ad0508b | 21 | * @param process_led Pin connected to the green led, used for processing |
| bobgiesberts | 6:0e7c0ad0508b | 22 | * @param error_led Pin connected to the red led, used for errors |
| bobgiesberts | 6:0e7c0ad0508b | 23 | * @param button Pin connected to the I/O button |
| bobgiesberts | 6:0e7c0ad0508b | 24 | * @param sd_present Pin connected to the SDCardDetect port |
| bobgiesberts | 6:0e7c0ad0508b | 25 | * @param battery Pin connected to the battery |
| bobgiesberts | 6:0e7c0ad0508b | 26 | */ |
| bobgiesberts | 6:0e7c0ad0508b | 27 | Bob(PinName process_led, PinName error_led, PinName button, PinName sd_present, PinName battery); |
| bobgiesberts | 6:0e7c0ad0508b | 28 | ~Bob(); |
| bobgiesberts | 6:0e7c0ad0508b | 29 | |
| bobgiesberts | 0:17943815800f | 30 | bool checkSD(void); |
| bobgiesberts | 4:9c3c8eb56a2b | 31 | |
| bobgiesberts | 6:0e7c0ad0508b | 32 | void wakeup(void); |
| bobgiesberts | 4:9c3c8eb56a2b | 33 | void beforesleep(void); |
| bobgiesberts | 4:9c3c8eb56a2b | 34 | void sleep(uint32_t ms); |
| bobgiesberts | 6:0e7c0ad0508b | 35 | |
| bobgiesberts | 4:9c3c8eb56a2b | 36 | |
| bobgiesberts | 2:681ecede6dcb | 37 | float battery(void); |
| bobgiesberts | 5:c2468a69aacb | 38 | |
| bobgiesberts | 0:17943815800f | 39 | void flash(int n); |
| bobgiesberts | 5:c2468a69aacb | 40 | void ledon(void); |
| bobgiesberts | 5:c2468a69aacb | 41 | void ledoff(void); |
| bobgiesberts | 0:17943815800f | 42 | |
| bobgiesberts | 0:17943815800f | 43 | private: |
| bobgiesberts | 6:0e7c0ad0508b | 44 | DigitalOut _led_process; |
| bobgiesberts | 6:0e7c0ad0508b | 45 | DigitalOut _led_error; |
| bobgiesberts | 6:0e7c0ad0508b | 46 | // DigitalOut _sd_enable; |
| bobgiesberts | 2:681ecede6dcb | 47 | DigitalIn *_sd_card_detect; |
| bobgiesberts | 6:0e7c0ad0508b | 48 | PinDetect _button; |
| bobgiesberts | 5:c2468a69aacb | 49 | |
| bobgiesberts | 2:681ecede6dcb | 50 | AnalogIn *_batt; |
| bobgiesberts | 5:c2468a69aacb | 51 | |
| bobgiesberts | 0:17943815800f | 52 | }; |
| bobgiesberts | 0:17943815800f | 53 | |
| bobgiesberts | 0:17943815800f | 54 | #endif |