ref: d2e41cad74415336b519351d63d749776d0295bf
parent: ccb2ee2532d9d0684a64fb8d5ebb76b90f0c5775
author: gkostka <kostka.grzegorz@gmail.com>
date: Wed Oct 29 20:05:17 EDT 2014
Add hw_get_us function
--- a/demos/stm32f429_disco/hw_init.c
+++ b/demos/stm32f429_disco/hw_init.c
@@ -175,6 +175,12 @@
return HAL_GetTick();
}
+uint64_t hw_get_us(void)
+{
+ return (uint64_t)HAL_GetTick() * 1000 +
+ ((SysTick->LOAD - SysTick->VAL) * 1000) / SysTick->LOAD;
+}
+
void hw_wait_ms(uint32_t ms)
{
volatile uint32_t t = HAL_GetTick();
--- a/demos/stm32f429_disco/hw_init.h
+++ b/demos/stm32f429_disco/hw_init.h
@@ -43,6 +43,7 @@
void hw_led_green(bool on);
uint32_t hw_get_ms(void);
+uint64_t hw_get_us(void);
void hw_wait_ms(uint32_t ms);
#endif /* HW_INIT_H_ */