summaryrefslogtreecommitdiff
path: root/bsp/radio-controller-1
diff options
context:
space:
mode:
Diffstat (limited to 'bsp/radio-controller-1')
-rw-r--r--bsp/radio-controller-1/Inc/main.h5
-rw-r--r--bsp/radio-controller-1/Src/main.c8
-rw-r--r--bsp/radio-controller-1/Src/stm32f1xx_hal_msp.c6
-rw-r--r--bsp/radio-controller-1/Src/stm32f1xx_it.c2
-rw-r--r--bsp/radio-controller-1/radio-controller-1.gpdsc4
-rw-r--r--bsp/radio-controller-1/radio-controller-1.ioc6
6 files changed, 16 insertions, 15 deletions
diff --git a/bsp/radio-controller-1/Inc/main.h b/bsp/radio-controller-1/Inc/main.h
index 6795087..be96275 100644
--- a/bsp/radio-controller-1/Inc/main.h
+++ b/bsp/radio-controller-1/Inc/main.h
@@ -49,7 +49,10 @@
/* USER CODE END Includes */
/* Private define ------------------------------------------------------------*/
-#define RX_TIMER_PRESCALER (72000000 / 72000)
+#define RX_TIMER_PRESCALER (7200 - 1)
+
+#define RADIO_RX_Pin GPIO_PIN_8
+#define RADIO_RX_GPIO_Port GPIOA
/* USER CODE BEGIN Private defines */
#ifdef __cplusplus
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 <mcu/init.h>
/* 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 */
diff --git a/bsp/radio-controller-1/radio-controller-1.gpdsc b/bsp/radio-controller-1/radio-controller-1.gpdsc
index 7835cd1..dd069ed 100644
--- a/bsp/radio-controller-1/radio-controller-1.gpdsc
+++ b/bsp/radio-controller-1/radio-controller-1.gpdsc
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- ******************************************************************************
* File Name : radio-controller-1.gpdsc
- * Date : 27/05/2017 10:57:24
+ * Date : 27/05/2017 23:23:20
* Description : Generator PDSC File generated by STM32CubeMX (DO NOT EDIT!)
****************************************************************************** -->
@@ -11,7 +11,7 @@
<description>STM32CubeMX generated pack description</description>
<releases>
<release version="1.0.0">
- - Generated: 27/05/2017 10:57:24
+ - Generated: 27/05/2017 23:23:20
</release>
</releases>
<requirements>
diff --git a/bsp/radio-controller-1/radio-controller-1.ioc b/bsp/radio-controller-1/radio-controller-1.ioc
index 1948f13..c7f9ca7 100644
--- a/bsp/radio-controller-1/radio-controller-1.ioc
+++ b/bsp/radio-controller-1/radio-controller-1.ioc
@@ -38,7 +38,7 @@ Mcu.Pin7=PA11
Mcu.Pin8=PA12
Mcu.Pin9=PA13
Mcu.PinsNb=13
-Mcu.UserConstants=RX_TIMER_PRESCALER,(72000000 / 72000)
+Mcu.UserConstants=RX_TIMER_PRESCALER,(7200 - 1)
Mcu.UserName=STM32F103C6Tx
MxCube.Version=4.20.1
MxDb.Version=DB.4.0.200
@@ -69,6 +69,8 @@ PA2.Mode=Asynchronous
PA2.Signal=USART2_TX
PA3.Mode=Asynchronous
PA3.Signal=USART2_RX
+PA8.GPIOParameters=GPIO_Label
+PA8.GPIO_Label=RADIO_RX
PA8.Signal=S_TIM1_CH1
PC14-OSC32_IN.Mode=LSE-External-Oscillator
PC14-OSC32_IN.Signal=RCC_OSC32_IN
@@ -137,7 +139,7 @@ SH.S_TIM1_CH1.0=TIM1_CH1,Input_Capture1_from_TI1
SH.S_TIM1_CH1.ConfNb=1
TIM1.Channel-Input_Capture1_from_TI1=TIM_CHANNEL_1
TIM1.IPParameters=Channel-Input_Capture1_from_TI1,Prescaler,Period
-TIM1.Period=65535
+TIM1.Period=0xffff
TIM1.Prescaler=RX_TIMER_PRESCALER
USART2.IPParameters=VirtualMode
USART2.VirtualMode=VM_ASYNC