From 8c67198b081cb11f29878d0ee44a065b1d669518 Mon Sep 17 00:00:00 2001 From: key Date: Sun, 31 Oct 2021 23:38:50 +0100 Subject: [PATCH] If pinInit(); function is called after the pins bit configurations the MCU can't start anymore after a reset or power off as he will try to configure the resiters but without having a Clk source --- bsl/csl/interfaces/usart.h | 16 ++++++++++++++++ bsl/csl/stm32f042/Src/pin.c | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 bsl/csl/interfaces/usart.h diff --git a/bsl/csl/interfaces/usart.h b/bsl/csl/interfaces/usart.h new file mode 100644 index 0000000..a10a08e --- /dev/null +++ b/bsl/csl/interfaces/usart.h @@ -0,0 +1,16 @@ +#ifndef _USART_H_ +#define _USART_H_ + +#ifdef __cplusplus +extern "C" { +#endif + + +void usartTxInit(); +void usartRxInit(); + +#ifdef __cplusplus +} +#endif + +#endif // _USART_H_ diff --git a/bsl/csl/stm32f042/Src/pin.c b/bsl/csl/stm32f042/Src/pin.c index 022b970..189a389 100644 --- a/bsl/csl/stm32f042/Src/pin.c +++ b/bsl/csl/stm32f042/Src/pin.c @@ -80,11 +80,11 @@ void pinSetSpeed(pinNo_t pinNo, speed speed) void pinConfig(pinNo_t pinNo, mode mode, state state, pullUpDown resistance, speed speed) { + pinInit(pinNo); pinSetMode(pinNo, mode); pinSetOutputState(pinNo, state); pinSetPullUpDonw(pinNo, resistance); pinSetSpeed(pinNo,speed); - pinInit(pinNo); } uint8_t pinRead(pinNo_t pinNo)