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.
clock.cpp@1:bb3ab1744634, 2019-04-15 (annotated)
- Committer:
- JamB
- Date:
- Mon Apr 15 14:48:44 2019 +0000
- Revision:
- 1:bb3ab1744634
- Parent:
- 0:293ea2789df6
updae
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| JamB | 0:293ea2789df6 | 1 | #include "mbed.h" |
| JamB | 0:293ea2789df6 | 2 | #include "clock.h" |
| JamB | 0:293ea2789df6 | 3 | bool istick; |
| JamB | 1:bb3ab1744634 | 4 | bool istickdisp; |
| JamB | 0:293ea2789df6 | 5 | Ticker ticker; //class, instance of class |
| JamB | 1:bb3ab1744634 | 6 | Ticker tickerDisp; |
| JamB | 0:293ea2789df6 | 7 | void tick() |
| JamB | 0:293ea2789df6 | 8 | { |
| JamB | 0:293ea2789df6 | 9 | istick=true; |
| JamB | 0:293ea2789df6 | 10 | } |
| JamB | 0:293ea2789df6 | 11 | |
| JamB | 0:293ea2789df6 | 12 | void set_tick_(float set_tick) //constructor |
| JamB | 0:293ea2789df6 | 13 | { //used to setup the clock |
| JamB | 0:293ea2789df6 | 14 | ticker.attach(&tick, set_tick); |
| JamB | 0:293ea2789df6 | 15 | } |
| JamB | 0:293ea2789df6 | 16 | |
| JamB | 0:293ea2789df6 | 17 | bool tock() |
| JamB | 0:293ea2789df6 | 18 | { //used to run the code |
| JamB | 0:293ea2789df6 | 19 | if (istick) |
| JamB | 0:293ea2789df6 | 20 | { |
| JamB | 0:293ea2789df6 | 21 | istick =false; |
| JamB | 0:293ea2789df6 | 22 | return true; |
| JamB | 0:293ea2789df6 | 23 | } |
| JamB | 0:293ea2789df6 | 24 | return false; |
| JamB | 0:293ea2789df6 | 25 | } |
| JamB | 1:bb3ab1744634 | 26 | |
| JamB | 1:bb3ab1744634 | 27 | |
| JamB | 1:bb3ab1744634 | 28 | void tickdisp() |
| JamB | 1:bb3ab1744634 | 29 | { |
| JamB | 1:bb3ab1744634 | 30 | istickdisp=true; |
| JamB | 1:bb3ab1744634 | 31 | } |
| JamB | 1:bb3ab1744634 | 32 | |
| JamB | 1:bb3ab1744634 | 33 | void set_tick_disp(float set_tickdisp) //constructor |
| JamB | 1:bb3ab1744634 | 34 | { //used to setup the clock |
| JamB | 1:bb3ab1744634 | 35 | tickerDisp.attach(&tickdisp, set_tickdisp); |
| JamB | 1:bb3ab1744634 | 36 | } |
| JamB | 0:293ea2789df6 | 37 | |
| JamB | 1:bb3ab1744634 | 38 | bool tockdisp() |
| JamB | 1:bb3ab1744634 | 39 | { //used to run the code |
| JamB | 1:bb3ab1744634 | 40 | if (istickdisp) |
| JamB | 1:bb3ab1744634 | 41 | { |
| JamB | 1:bb3ab1744634 | 42 | istickdisp =false; |
| JamB | 1:bb3ab1744634 | 43 | return true; |
| JamB | 1:bb3ab1744634 | 44 | } |
| JamB | 1:bb3ab1744634 | 45 | return false; |
| JamB | 1:bb3ab1744634 | 46 | } |