new ticker
NewTicker.h@1:c8bc7e989caf, 2014-10-31 (annotated)
- Committer:
- lisper
- Date:
- Fri Oct 31 08:12:40 2014 +0000
- Revision:
- 1:c8bc7e989caf
- Parent:
- 0:c143e6906ab5
fix little
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lisper | 0:c143e6906ab5 | 1 | /******************************************************************************* |
lisper | 0:c143e6906ab5 | 2 | * This file is part of the NewTicker library. * |
lisper | 0:c143e6906ab5 | 3 | * * |
lisper | 0:c143e6906ab5 | 4 | * NewTicker is free software: you can redistribute it and/or * |
lisper | 0:c143e6906ab5 | 5 | * modify it under the terms of the GNU General Public License as * |
lisper | 0:c143e6906ab5 | 6 | * published by the Free Software Foundation, either version 3 of * |
lisper | 0:c143e6906ab5 | 7 | * the License, or any later version. * |
lisper | 0:c143e6906ab5 | 8 | * * |
lisper | 0:c143e6906ab5 | 9 | * NewTicker is distributed in the hope that it will be useful, * |
lisper | 0:c143e6906ab5 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
lisper | 0:c143e6906ab5 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
lisper | 0:c143e6906ab5 | 12 | * GNU Lesser General Public License for more details. * |
lisper | 0:c143e6906ab5 | 13 | * * |
lisper | 0:c143e6906ab5 | 14 | * NewTicker is distributed in the hope that it will be useful, * |
lisper | 0:c143e6906ab5 | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
lisper | 0:c143e6906ab5 | 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
lisper | 0:c143e6906ab5 | 17 | * GNU Lesser General Public License for more details. * |
lisper | 0:c143e6906ab5 | 18 | * * |
lisper | 0:c143e6906ab5 | 19 | * You should have received a copy of the GNU Lesser General Public * |
lisper | 0:c143e6906ab5 | 20 | * License along with NewTicker. If not, see * |
lisper | 0:c143e6906ab5 | 21 | * <http://www.gnu.org/licenses/>. * |
lisper | 0:c143e6906ab5 | 22 | ******************************************************************************/ |
lisper | 0:c143e6906ab5 | 23 | |
lisper | 0:c143e6906ab5 | 24 | /* |
lisper | 0:c143e6906ab5 | 25 | * Copyright: DFRobot |
lisper | 0:c143e6906ab5 | 26 | * name: NewTicker |
lisper | 0:c143e6906ab5 | 27 | * version: 1.0 |
lisper | 0:c143e6906ab5 | 28 | * Author: lisper (lisper.li@dfrobot.com) |
lisper | 0:c143e6906ab5 | 29 | * Date: 2014-10-30 |
lisper | 0:c143e6906ab5 | 30 | * Description: new ticker library for mbed |
lisper | 0:c143e6906ab5 | 31 | */ |
lisper | 0:c143e6906ab5 | 32 | |
lisper | 0:c143e6906ab5 | 33 | #include "mbed.h" |
lisper | 0:c143e6906ab5 | 34 | #include "millis.h" |
lisper | 0:c143e6906ab5 | 35 | |
lisper | 0:c143e6906ab5 | 36 | class NewTicker |
lisper | 0:c143e6906ab5 | 37 | { |
lisper | 0:c143e6906ab5 | 38 | public: |
lisper | 0:c143e6906ab5 | 39 | NewTicker (); |
lisper | 0:c143e6906ab5 | 40 | void attach (void (*theTickerHandler) (), uint32_t theDelayTime); |
lisper | 0:c143e6906ab5 | 41 | void detach (); |
lisper | 0:c143e6906ab5 | 42 | void update (); |
lisper | 0:c143e6906ab5 | 43 | private: |
lisper | 0:c143e6906ab5 | 44 | uint32_t nowTime; |
lisper | 0:c143e6906ab5 | 45 | uint32_t delayTime; |
lisper | 0:c143e6906ab5 | 46 | void (*tickerHandler) (void); |
lisper | 0:c143e6906ab5 | 47 | }; |
lisper | 0:c143e6906ab5 | 48 |