Browse Source

zigbee: Setup LEDs

test
Andreas Berthoud 5 years ago
parent
commit
a5e597e61b
  1. 12
      nucleo-wb55-zigbee/Core/Inc/main.h
  2. 9
      nucleo-wb55-zigbee/Core/Src/main.c
  3. 8
      nucleo-wb55-zigbee/nucleo-wb55-zigbee.ioc

12
nucleo-wb55-zigbee/Core/Inc/main.h

@ -60,10 +60,10 @@ void Error_Handler(void);
/* Private defines -----------------------------------------------------------*/ /* Private defines -----------------------------------------------------------*/
#define B1_Pin GPIO_PIN_4 #define B1_Pin GPIO_PIN_4
#define B1_GPIO_Port GPIOC #define B1_GPIO_Port GPIOC
#define LD2_Pin GPIO_PIN_0 #define LED_GREEN_Pin GPIO_PIN_0
#define LD2_GPIO_Port GPIOB #define LED_GREEN_GPIO_Port GPIOB
#define LD3_Pin GPIO_PIN_1 #define LED_RED_Pin GPIO_PIN_1
#define LD3_GPIO_Port GPIOB #define LED_RED_GPIO_Port GPIOB
#define JTMS_Pin GPIO_PIN_13 #define JTMS_Pin GPIO_PIN_13
#define JTMS_GPIO_Port GPIOA #define JTMS_GPIO_Port GPIOA
#define JTCK_Pin GPIO_PIN_14 #define JTCK_Pin GPIO_PIN_14
@ -74,8 +74,8 @@ void Error_Handler(void);
#define B3_GPIO_Port GPIOD #define B3_GPIO_Port GPIOD
#define JTDO_Pin GPIO_PIN_3 #define JTDO_Pin GPIO_PIN_3
#define JTDO_GPIO_Port GPIOB #define JTDO_GPIO_Port GPIOB
#define LD1_Pin GPIO_PIN_5 #define LED_BLUE_Pin GPIO_PIN_5
#define LD1_GPIO_Port GPIOB #define LED_BLUE_GPIO_Port GPIOB
#define STLINK_RX_Pin GPIO_PIN_6 #define STLINK_RX_Pin GPIO_PIN_6
#define STLINK_RX_GPIO_Port GPIOB #define STLINK_RX_GPIO_Port GPIOB
#define STLINK_TX_Pin GPIO_PIN_7 #define STLINK_TX_Pin GPIO_PIN_7

9
nucleo-wb55-zigbee/Core/Src/main.c

@ -93,6 +93,8 @@ int main(void)
/* USER CODE BEGIN WHILE */ /* USER CODE BEGIN WHILE */
while (1) while (1)
{ {
HAL_GPIO_TogglePin(LED_GREEN_GPIO_Port, LED_GREEN_Pin);
HAL_Delay(500);
/* USER CODE END WHILE */ /* USER CODE END WHILE */
/* USER CODE BEGIN 3 */ /* USER CODE BEGIN 3 */
@ -173,7 +175,7 @@ static void MX_GPIO_Init(void)
__HAL_RCC_GPIOD_CLK_ENABLE(); __HAL_RCC_GPIOD_CLK_ENABLE();
/*Configure GPIO pin Output Level */ /*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOB, LD2_Pin|LD3_Pin|LD1_Pin, GPIO_PIN_RESET); HAL_GPIO_WritePin(GPIOB, LED_GREEN_Pin|LED_RED_Pin|LED_BLUE_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin : B1_Pin */ /*Configure GPIO pin : B1_Pin */
GPIO_InitStruct.Pin = B1_Pin; GPIO_InitStruct.Pin = B1_Pin;
@ -181,8 +183,8 @@ static void MX_GPIO_Init(void)
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(B1_GPIO_Port, &GPIO_InitStruct); HAL_GPIO_Init(B1_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : LD2_Pin LD3_Pin LD1_Pin */ /*Configure GPIO pins : LED_GREEN_Pin LED_RED_Pin LED_BLUE_Pin */
GPIO_InitStruct.Pin = LD2_Pin|LD3_Pin|LD1_Pin; GPIO_InitStruct.Pin = LED_GREEN_Pin|LED_RED_Pin|LED_BLUE_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
@ -225,6 +227,7 @@ void Error_Handler(void)
/* USER CODE BEGIN Error_Handler_Debug */ /* USER CODE BEGIN Error_Handler_Debug */
/* User can add his own implementation to report the HAL error return state */ /* User can add his own implementation to report the HAL error return state */
__disable_irq(); __disable_irq();
HAL_GPIO_WritePin(LED_RED_GPIO_Port, LED_RED_Pin, GPIO_PIN_SET);
while (1) while (1)
{ {
} }

8
nucleo-wb55-zigbee/nucleo-wb55-zigbee.ioc

@ -11,8 +11,8 @@ ProjectManager.KeepUserCode=true
Mcu.UserName=STM32WB55RGVx Mcu.UserName=STM32WB55RGVx
Mcu.PinsNb=19 Mcu.PinsNb=19
ProjectManager.NoMain=false ProjectManager.NoMain=false
RCC.SMPSCLockSelectionVirtualVirtual=RCC_SMPSCLKSOURCE_HSI
RCC.RFWKPFreq_Value=976.5625 RCC.RFWKPFreq_Value=976.5625
RCC.SMPSCLockSelectionVirtualVirtual=RCC_SMPSCLKSOURCE_HSI
PC13.Locked=true PC13.Locked=true
RCC.HCLK3Freq_Value=32000000 RCC.HCLK3Freq_Value=32000000
PC13.Signal=SYS_WKUP2 PC13.Signal=SYS_WKUP2
@ -23,7 +23,7 @@ PC4.Signal=GPIO_Input
PD0.GPIO_Label=B2 [Push Button] PD0.GPIO_Label=B2 [Push Button]
PD1.Signal=GPIO_Input PD1.Signal=GPIO_Input
ProjectManager.DefaultFWLocation=true ProjectManager.DefaultFWLocation=true
PB0.GPIO_Label=LD2 [Green Led] PB0.GPIO_Label=LED_GREEN
PB6.GPIO_Label=STLINK_RX PB6.GPIO_Label=STLINK_RX
OSC_IN.Locked=true OSC_IN.Locked=true
PD0.Locked=true PD0.Locked=true
@ -106,7 +106,7 @@ PCC.Ble.DataLength=6
PC4.GPIO_Label=B1 [Push Button] PC4.GPIO_Label=B1 [Push Button]
RCC.I2C1Freq_Value=32000000 RCC.I2C1Freq_Value=32000000
RCC.RNGFreq_Value=32000 RCC.RNGFreq_Value=32000
PB1.GPIO_Label=LD3 [Red Led] PB1.GPIO_Label=LED_RED
RCC.PLLSAI1QoutputFreq_Value=128000000 RCC.PLLSAI1QoutputFreq_Value=128000000
RCC.ADCFreq_Value=128000000 RCC.ADCFreq_Value=128000000
File.Version=6 File.Version=6
@ -164,7 +164,7 @@ RCC.HSI_VALUE=16000000
Mcu.Pin18=VP_SYS_VS_Systick Mcu.Pin18=VP_SYS_VS_Systick
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
Mcu.Pin11=PA14 Mcu.Pin11=PA14
PB5.GPIO_Label=LD1 [Blue Led] PB5.GPIO_Label=LED_BLUE
Mcu.Pin12=PD0 Mcu.Pin12=PD0
PD0.GPIOParameters=GPIO_Label PD0.GPIOParameters=GPIO_Label
RCC.PLLPoutputFreq_Value=128000000 RCC.PLLPoutputFreq_Value=128000000

Loading…
Cancel
Save