diff --git a/Core/Src/main.c b/Core/Src/main.c index 73869cf..c29e11d 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -129,8 +129,25 @@ int main(void) MX_TIM2_Init(); MX_LPTIM4_Init(); /* USER CODE BEGIN 2 */ - ULOG_INIT(); + ULOG_INIT(); ULOG_SUBSCRIBE(ULOG_SendLPUART,ULOG_DEBUG_LEVEL); + GPIO_PinState K15 = HAL_GPIO_ReadPin(K15_Detect_GPIO_Port, K15_Detect_Pin); + while (K15 == GPIO_PIN_RESET) + { + K15 = HAL_GPIO_ReadPin(K15_Detect_GPIO_Port, K15_Detect_Pin); + ULOG_DEBUG("Wait for K15 Signal Wait Wait Wait"); + HAL_Delay(100); + } + + + GPIO_PinState HL = HAL_GPIO_ReadPin(Headlight_Detect_GPIO_Port, Headlight_Detect_Pin); + while (HL == GPIO_PIN_RESET) + { + HL = HAL_GPIO_ReadPin(Headlight_Detect_GPIO_Port, Headlight_Detect_Pin); + ULOG_DEBUG("Wait for K15 Signal Wait Wait Wait"); + HAL_Delay(100); + } + ULOG_DEBUG("Setup Logger"); HAL_GPIO_WritePin(Periph_Power_GPIO_Port,Periph_Power_Pin,GPIO_PIN_RESET); HAL_GPIO_WritePin(CLS_POWER_GPIO_Port, CLS_POWER_Pin, GPIO_PIN_SET); @@ -138,8 +155,14 @@ int main(void) gCLS_DEVICE_ADDRESS = 0x11; ULOG_DEBUG("Setting Global CLS address to 0b10001"); ULOG_DEBUG("Init Kernel and start schedule"); + + + + /* USER CODE END 2 */ + + /* Init scheduler */ osKernelInitialize(); /* Call init function for freertos objects (in freertos.c) */ MX_FREERTOS_Init(); diff --git a/lib/uart_driver/AsyncComm.c b/lib/uart_driver/AsyncComm.c index 957a8d9..ab49ab6 100644 --- a/lib/uart_driver/AsyncComm.c +++ b/lib/uart_driver/AsyncComm.c @@ -12,6 +12,8 @@ #include "AsyncComm.h" +#include "string.h" + #include "stm32h7xx_ll_dma.h" #include "stm32h7xx_ll_usart.h" @@ -210,7 +212,7 @@ void usart_send_data(const uart_desc_t* uart, const void* data, size_t len) { * \param[in] str: String to send */ void usart_send_string(const uart_desc_t* uart, const char* str) { - lwrb_write(&uart->data->tx_rb, str, strnlen(str, 255)); /* Write data to TX buffer for loopback */ + lwrb_write(&uart->data->tx_rb, str, strlen(str)); /* Write data to TX buffer for loopback */ usart_start_tx_dma_transfer(uart); /* Then try to start transfer */ } diff --git a/pinout.png b/pinout.png new file mode 100644 index 0000000..60ad0ff Binary files /dev/null and b/pinout.png differ