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