From edaad76b66e47d945d7aa352d13de5ab8251317a Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 28 May 2017 09:05:53 +0200 Subject: o Naming pins. o Correct prescaler for 1us resolution. o Trying out a lock structure for locking between an ISR and a main loop. --- bsp/radio-controller-1/Src/main.c | 8 +++----- bsp/radio-controller-1/Src/stm32f1xx_hal_msp.c | 6 +++--- bsp/radio-controller-1/Src/stm32f1xx_it.c | 2 -- 3 files changed, 6 insertions(+), 10 deletions(-) (limited to 'bsp/radio-controller-1/Src') diff --git a/bsp/radio-controller-1/Src/main.c b/bsp/radio-controller-1/Src/main.c index f57b555..4b49e82 100644 --- a/bsp/radio-controller-1/Src/main.c +++ b/bsp/radio-controller-1/Src/main.c @@ -47,6 +47,7 @@ /* USER CODE BEGIN Includes */ #include "radio-controller.h" +#include /* USER CODE END Includes */ /* Private variables ---------------------------------------------------------*/ @@ -182,7 +183,7 @@ static void MX_TIM1_Init(void) htim1.Instance = TIM1; htim1.Init.Prescaler = RX_TIMER_PRESCALER; htim1.Init.CounterMode = TIM_COUNTERMODE_UP; - htim1.Init.Period = 65535; + htim1.Init.Period = 0xffff; htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; htim1.Init.RepetitionCounter = 0; if (HAL_TIM_IC_Init(&htim1) != HAL_OK) @@ -271,10 +272,7 @@ static void MX_GPIO_Init(void) void Error_Handler(void) { /* USER CODE BEGIN Error_Handler */ - /* User can add his own implementation to report the HAL error return state */ - while(1) - { - } + halt(); /* USER CODE END Error_Handler */ } diff --git a/bsp/radio-controller-1/Src/stm32f1xx_hal_msp.c b/bsp/radio-controller-1/Src/stm32f1xx_hal_msp.c index b90d153..0b02774 100644 --- a/bsp/radio-controller-1/Src/stm32f1xx_hal_msp.c +++ b/bsp/radio-controller-1/Src/stm32f1xx_hal_msp.c @@ -103,10 +103,10 @@ void HAL_TIM_IC_MspInit(TIM_HandleTypeDef* htim_ic) /**TIM1 GPIO Configuration PA8 ------> TIM1_CH1 */ - GPIO_InitStruct.Pin = GPIO_PIN_8; + GPIO_InitStruct.Pin = RADIO_RX_Pin; GPIO_InitStruct.Mode = GPIO_MODE_INPUT; GPIO_InitStruct.Pull = GPIO_NOPULL; - HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + HAL_GPIO_Init(RADIO_RX_GPIO_Port, &GPIO_InitStruct); /* Peripheral DMA init*/ @@ -151,7 +151,7 @@ void HAL_TIM_IC_MspDeInit(TIM_HandleTypeDef* htim_ic) /**TIM1 GPIO Configuration PA8 ------> TIM1_CH1 */ - HAL_GPIO_DeInit(GPIOA, GPIO_PIN_8); + HAL_GPIO_DeInit(RADIO_RX_GPIO_Port, RADIO_RX_Pin); /* Peripheral DMA DeInit*/ HAL_DMA_DeInit(htim_ic->hdma[TIM_DMA_ID_CC1]); diff --git a/bsp/radio-controller-1/Src/stm32f1xx_it.c b/bsp/radio-controller-1/Src/stm32f1xx_it.c index ac5d604..8064fb8 100644 --- a/bsp/radio-controller-1/Src/stm32f1xx_it.c +++ b/bsp/radio-controller-1/Src/stm32f1xx_it.c @@ -234,7 +234,6 @@ void USB_LP_CAN1_RX0_IRQHandler(void) void TIM1_TRG_COM_IRQHandler(void) { /* USER CODE BEGIN TIM1_TRG_COM_IRQn 0 */ - it_tim1(); /* USER CODE END TIM1_TRG_COM_IRQn 0 */ HAL_TIM_IRQHandler(&htim1); /* USER CODE BEGIN TIM1_TRG_COM_IRQn 1 */ @@ -248,7 +247,6 @@ void TIM1_TRG_COM_IRQHandler(void) void TIM1_CC_IRQHandler(void) { /* USER CODE BEGIN TIM1_CC_IRQn 0 */ - it_tim1(); /* USER CODE END TIM1_CC_IRQn 0 */ HAL_TIM_IRQHandler(&htim1); /* USER CODE BEGIN TIM1_CC_IRQn 1 */ -- cgit v1.2.3