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.
PowerControl.cpp@1:1bae9ab7241e, 2017-05-10 (annotated)
- Committer:
- kwasymodo
- Date:
- Wed May 10 18:45:38 2017 +0000
- Revision:
- 1:1bae9ab7241e
- Parent:
- 0:f7568c04c1c3
- Child:
- 2:1e3291e8294d
Changed so both buttons "work" (red is not connected)
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| kwasymodo | 0:f7568c04c1c3 | 1 | #include "PowerControl.h" |
| kwasymodo | 0:f7568c04c1c3 | 2 | |
| kwasymodo | 1:1bae9ab7241e | 3 | extern RawSerial pc; |
| kwasymodo | 1:1bae9ab7241e | 4 | |
| kwasymodo | 0:f7568c04c1c3 | 5 | PowerControl::PowerControl(PinName greenButton, PinName redButton): |
| kwasymodo | 0:f7568c04c1c3 | 6 | _greenButton(greenButton), _redButton(redButton) |
| kwasymodo | 0:f7568c04c1c3 | 7 | { |
| kwasymodo | 1:1bae9ab7241e | 8 | _greenButton.mode(PullUp); |
| kwasymodo | 0:f7568c04c1c3 | 9 | _greenButton.fall(this, &PowerControl::goSleep); |
| kwasymodo | 1:1bae9ab7241e | 10 | _redButton.mode(PullUp); |
| kwasymodo | 1:1bae9ab7241e | 11 | _redButton.fall(this, &PowerControl::goSleep); |
| kwasymodo | 0:f7568c04c1c3 | 12 | } |
| kwasymodo | 0:f7568c04c1c3 | 13 | |
| kwasymodo | 0:f7568c04c1c3 | 14 | void PowerControl::goSleep(void) |
| kwasymodo | 0:f7568c04c1c3 | 15 | { |
| kwasymodo | 1:1bae9ab7241e | 16 | pc.printf("going to sleep\r\n"); |
| kwasymodo | 0:f7568c04c1c3 | 17 | |
| kwasymodo | 1:1bae9ab7241e | 18 | sleep(); |
| kwasymodo | 0:f7568c04c1c3 | 19 | } |