Official Sheffield ARMBand micro:bit program
microbit/microbit-dal/inc/drivers/TimedInterruptIn.h@0:b9164b348919, 2016-10-17 (annotated)
- Committer:
- MrBedfordVan
- Date:
- Mon Oct 17 12:41:20 2016 +0000
- Revision:
- 0:b9164b348919
Official Sheffield ARMBand Micro:bit program
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MrBedfordVan | 0:b9164b348919 | 1 | /* |
MrBedfordVan | 0:b9164b348919 | 2 | The MIT License (MIT) |
MrBedfordVan | 0:b9164b348919 | 3 | |
MrBedfordVan | 0:b9164b348919 | 4 | Copyright (c) 2016 Lancaster University, UK. |
MrBedfordVan | 0:b9164b348919 | 5 | |
MrBedfordVan | 0:b9164b348919 | 6 | Permission is hereby granted, free of charge, to any person obtaining a |
MrBedfordVan | 0:b9164b348919 | 7 | copy of this software and associated documentation files (the "Software"), |
MrBedfordVan | 0:b9164b348919 | 8 | to deal in the Software without restriction, including without limitation |
MrBedfordVan | 0:b9164b348919 | 9 | the rights to use, copy, modify, merge, publish, distribute, sublicense, |
MrBedfordVan | 0:b9164b348919 | 10 | and/or sell copies of the Software, and to permit persons to whom the |
MrBedfordVan | 0:b9164b348919 | 11 | Software is furnished to do so, subject to the following conditions: |
MrBedfordVan | 0:b9164b348919 | 12 | |
MrBedfordVan | 0:b9164b348919 | 13 | The above copyright notice and this permission notice shall be included in |
MrBedfordVan | 0:b9164b348919 | 14 | all copies or substantial portions of the Software. |
MrBedfordVan | 0:b9164b348919 | 15 | |
MrBedfordVan | 0:b9164b348919 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
MrBedfordVan | 0:b9164b348919 | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
MrBedfordVan | 0:b9164b348919 | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
MrBedfordVan | 0:b9164b348919 | 19 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
MrBedfordVan | 0:b9164b348919 | 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
MrBedfordVan | 0:b9164b348919 | 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
MrBedfordVan | 0:b9164b348919 | 22 | DEALINGS IN THE SOFTWARE. |
MrBedfordVan | 0:b9164b348919 | 23 | */ |
MrBedfordVan | 0:b9164b348919 | 24 | |
MrBedfordVan | 0:b9164b348919 | 25 | #ifndef TIMED_INTERRUPT_H |
MrBedfordVan | 0:b9164b348919 | 26 | #define TIMED_INTERRUPT_H |
MrBedfordVan | 0:b9164b348919 | 27 | |
MrBedfordVan | 0:b9164b348919 | 28 | #include "mbed.h" |
MrBedfordVan | 0:b9164b348919 | 29 | #include "MicroBitConfig.h" |
MrBedfordVan | 0:b9164b348919 | 30 | |
MrBedfordVan | 0:b9164b348919 | 31 | class TimedInterruptIn : public InterruptIn |
MrBedfordVan | 0:b9164b348919 | 32 | { |
MrBedfordVan | 0:b9164b348919 | 33 | uint64_t timestamp; |
MrBedfordVan | 0:b9164b348919 | 34 | |
MrBedfordVan | 0:b9164b348919 | 35 | public: |
MrBedfordVan | 0:b9164b348919 | 36 | |
MrBedfordVan | 0:b9164b348919 | 37 | /** |
MrBedfordVan | 0:b9164b348919 | 38 | * Constructor. |
MrBedfordVan | 0:b9164b348919 | 39 | * |
MrBedfordVan | 0:b9164b348919 | 40 | * Create an instance of TimedInterruptIn that has an additional timestamp field. |
MrBedfordVan | 0:b9164b348919 | 41 | */ |
MrBedfordVan | 0:b9164b348919 | 42 | TimedInterruptIn(PinName name); |
MrBedfordVan | 0:b9164b348919 | 43 | |
MrBedfordVan | 0:b9164b348919 | 44 | /** |
MrBedfordVan | 0:b9164b348919 | 45 | * Stores the given timestamp for this instance of TimedInterruptIn. |
MrBedfordVan | 0:b9164b348919 | 46 | * |
MrBedfordVan | 0:b9164b348919 | 47 | * @param timestamp the timestamp to retain. |
MrBedfordVan | 0:b9164b348919 | 48 | */ |
MrBedfordVan | 0:b9164b348919 | 49 | void setTimestamp(uint64_t timestamp); |
MrBedfordVan | 0:b9164b348919 | 50 | |
MrBedfordVan | 0:b9164b348919 | 51 | /** |
MrBedfordVan | 0:b9164b348919 | 52 | * Retrieves the retained timestamp for this instance of TimedInterruptIn. |
MrBedfordVan | 0:b9164b348919 | 53 | * |
MrBedfordVan | 0:b9164b348919 | 54 | * @return the timestamp held by this instance. |
MrBedfordVan | 0:b9164b348919 | 55 | */ |
MrBedfordVan | 0:b9164b348919 | 56 | uint64_t getTimestamp(); |
MrBedfordVan | 0:b9164b348919 | 57 | }; |
MrBedfordVan | 0:b9164b348919 | 58 | |
MrBedfordVan | 0:b9164b348919 | 59 | #endif |