From 44fb09b309ba8c23e839b18a7d4e0ec65027f03f Mon Sep 17 00:00:00 2001 From: key Date: Wed, 10 Nov 2021 21:44:27 +0100 Subject: [PATCH] started with timer.h --- bsl/csl/interfaces/timer.h | 18 ++++++++++++++++++ bsl/csl/stm32f042/Device/hardwareDescription.h | 11 +++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 bsl/csl/interfaces/timer.h diff --git a/bsl/csl/interfaces/timer.h b/bsl/csl/interfaces/timer.h new file mode 100644 index 0000000..362e021 --- /dev/null +++ b/bsl/csl/interfaces/timer.h @@ -0,0 +1,18 @@ + + +void timerActivateBus(timerNo_t timer); +void timerEnableTimer(timerNo_t timer); +void timerSetClkSource(timerNo_t timer, clkSources_t clk); +void timerSetMode(timerNo_t timer, timerMode_t mode); +void timerSetCountDirection(timerNo_t timer, timerCountDirection_t direction); +void timerSetPrescaler(timerNo_t timer, uint32_t prescaler); +void timerSetPostscaler(timerNo_t timer, uint32_t postscaler); +void timerSetAutoReload(timerNo_t timer, uint32_t reload); +void timerClearCounter(timerNo_t timer); + + +/* Second stage configuration */ +void setTimerHz(timerNo_t timer, uint16_t hz); +void setTimerMs(timerNo_t timer, uint16_t ms); +void setTimerNs(timerNo_t timer, uint16_t ns); +void setTimerPs(timerNo_t timer, uint16_t ps); diff --git a/bsl/csl/stm32f042/Device/hardwareDescription.h b/bsl/csl/stm32f042/Device/hardwareDescription.h index 8229111..7a8b9eb 100644 --- a/bsl/csl/stm32f042/Device/hardwareDescription.h +++ b/bsl/csl/stm32f042/Device/hardwareDescription.h @@ -1,6 +1,15 @@ /*! Enum of the awailable pins for this package */ #include "stm32f042x6.h" +#define PACKAGE_LQFP32 1 + +#define MAX_USART_CHANNEL_COUNT 2 +#define MAX_I2C_CHANNEL_COUNT 1 +#define MAX_SPI_CHANNEL_COUNT 2 +#define MAX_I2S_CHANNEL_COUNT 2 +#define MAX_CAN_CHANNEL_COUNT 1 + + #define MAX_N_PORTS_COUNT 3 #define MAX_PORT_PINS_COUNT 16 #define MAX_N_PIN_ALT_FUNC 8 @@ -112,8 +121,6 @@ void setAlt(pin_no_t id, uint8_t af) //assert(pinAltList[((id & 0xF0) >> 4)][id & 0x0F]) != 0); // setup alt function here... - - } */