Demo PAH8011+ HeartRate on nRF52
Dependencies: mbed pixart_heart_rate_demo pixart_heart_rate_lib_keil_m4
Fork of PixArt_PAH8011_HeartRate_nRF52 by
system_clock.cpp@0:a6408c845aba, 2017-10-27 (annotated)
- Committer:
- pixus_mbed
- Date:
- Fri Oct 27 08:53:49 2017 +0000
- Revision:
- 0:a6408c845aba
Init version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pixus_mbed | 0:a6408c845aba | 1 | #include "system_clock.h" |
pixus_mbed | 0:a6408c845aba | 2 | |
pixus_mbed | 0:a6408c845aba | 3 | #include <mbed.h> |
pixus_mbed | 0:a6408c845aba | 4 | |
pixus_mbed | 0:a6408c845aba | 5 | |
pixus_mbed | 0:a6408c845aba | 6 | static Ticker g_ticker; |
pixus_mbed | 0:a6408c845aba | 7 | static volatile uint64_t g_sys_tick = 0; |
pixus_mbed | 0:a6408c845aba | 8 | |
pixus_mbed | 0:a6408c845aba | 9 | |
pixus_mbed | 0:a6408c845aba | 10 | static void system_tick_handle(void) |
pixus_mbed | 0:a6408c845aba | 11 | { |
pixus_mbed | 0:a6408c845aba | 12 | g_sys_tick++; |
pixus_mbed | 0:a6408c845aba | 13 | } |
pixus_mbed | 0:a6408c845aba | 14 | |
pixus_mbed | 0:a6408c845aba | 15 | void system_clock_init() |
pixus_mbed | 0:a6408c845aba | 16 | { |
pixus_mbed | 0:a6408c845aba | 17 | g_sys_tick = 0; |
pixus_mbed | 0:a6408c845aba | 18 | |
pixus_mbed | 0:a6408c845aba | 19 | g_ticker.attach(system_tick_handle, 0.001f); |
pixus_mbed | 0:a6408c845aba | 20 | } |
pixus_mbed | 0:a6408c845aba | 21 | |
pixus_mbed | 0:a6408c845aba | 22 | uint64_t system_clock_get_tick() |
pixus_mbed | 0:a6408c845aba | 23 | { |
pixus_mbed | 0:a6408c845aba | 24 | return g_sys_tick; |
pixus_mbed | 0:a6408c845aba | 25 | } |
pixus_mbed | 0:a6408c845aba | 26 | |
pixus_mbed | 0:a6408c845aba | 27 | uint64_t system_clock_time_to_milliseconds(uint64_t time) |
pixus_mbed | 0:a6408c845aba | 28 | { |
pixus_mbed | 0:a6408c845aba | 29 | return time; |
pixus_mbed | 0:a6408c845aba | 30 | } |
pixus_mbed | 0:a6408c845aba | 31 |