base of 1wire, need to make async
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "units/digital_in/unit_din.h"
|
||||
#include "units/neopixel/unit_neopixel.h"
|
||||
#include "units/i2c/unit_i2c.h"
|
||||
#include "units/1wire/unit_1wire.h"
|
||||
#include "units/test/unit_test.h"
|
||||
#include "units/usart/unit_usart.h"
|
||||
#include "units/spi/unit_spi.h"
|
||||
@@ -82,6 +83,7 @@ void plat_init_resources(void)
|
||||
ureg_add_type(&UNIT_I2C);
|
||||
ureg_add_type(&UNIT_SPI);
|
||||
ureg_add_type(&UNIT_USART);
|
||||
ureg_add_type(&UNIT_1WIRE);
|
||||
|
||||
// Free all present resources
|
||||
{
|
||||
|
||||
+15
-2
@@ -5,6 +5,8 @@
|
||||
#include "platform.h"
|
||||
#include "timebase.h"
|
||||
|
||||
// ---------------------------- HAL TIMEBASE -----------------------------
|
||||
|
||||
#define TIMEBASE_TIMER TIM14
|
||||
|
||||
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
|
||||
@@ -67,9 +69,8 @@ void HAL_ResumeTick(void)
|
||||
LL_TIM_EnableIT_UPDATE(TIMEBASE_TIMER);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
|
||||
// Timestamping functions ...
|
||||
// -------------------------- DELAY FUNCTIONS AND TS -----------------------------
|
||||
|
||||
/*
|
||||
* I wanted to freeze time. I wanted to savor that moment, to live in that moment
|
||||
@@ -96,3 +97,15 @@ uint64_t PTIM_GetMicrotime(void)
|
||||
|
||||
return (uint64_t)uwMillis*1000 + uwMicros;
|
||||
}
|
||||
|
||||
/** microsecond delay */
|
||||
void PTIM_MicroDelay(uint16_t usec)
|
||||
{
|
||||
usec++; // rounding up
|
||||
assert_param(usec < 1000);
|
||||
|
||||
uint16_t end = (uint16_t) (TIMEBASE_TIMER->CNT + usec);
|
||||
if (end > 999) end -= 1000;
|
||||
|
||||
while (TIMEBASE_TIMER->CNT != end);
|
||||
}
|
||||
|
||||
@@ -21,4 +21,11 @@
|
||||
*/
|
||||
uint64_t PTIM_GetMicrotime(void);
|
||||
|
||||
/**
|
||||
* Microseconds busy delay
|
||||
*
|
||||
* @param usec - max 998
|
||||
*/
|
||||
void PTIM_MicroDelay(uint16_t usec);
|
||||
|
||||
#endif //GEX_F072_TIMEBASE_H
|
||||
|
||||
Reference in New Issue
Block a user