Browse Source

Include GPIO blink source file for boilerplate and correct project.

tags/PRE_1
parent
commit
1a467fcad1
2 changed files with 89 additions and 0 deletions
  1. +1
    -0
      firmware/platformio.ini
  2. +88
    -0
      firmware/src/main.c

+ 1
- 0
firmware/platformio.ini View File

@@ -12,3 +12,4 @@
platform = ststm32
board = genericSTM32F405RG
framework = stm32cube
build_flags = -DF4

+ 88
- 0
firmware/src/main.c View File

@@ -0,0 +1,88 @@
#if F0
#include "stm32f0xx_hal.h"
#elif F1
#include "stm32f1xx_hal.h"
#elif F2
#include "stm32f2xx_hal.h"
#elif F3
#include "stm32f3xx_hal.h"
#elif F4
#include "stm32f4xx_hal.h"
#elif F7
#include "stm32f7xx_hal.h"
#elif L0
#include "stm32l0xx_hal.h"
#elif L1
#include "stm32l1xx_hal.h"
#elif L4
#include "stm32l4xx_hal.h"
#else
#error "Unsupported STM32 Family"
#endif

#define LED_PIN GPIO_PIN_5
#define LED_GPIO_PORT GPIOA
#define LED_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()

int main(void)
{
HAL_Init();
LED_GPIO_CLK_ENABLE();
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Pin = LED_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(LED_GPIO_PORT, &GPIO_InitStruct);

while (1)
{
HAL_GPIO_TogglePin(LED_GPIO_PORT, LED_PIN);
HAL_Delay(1000);
}
}

void SysTick_Handler(void)
{
HAL_IncTick();
}

void NMI_Handler(void)
{
}

void HardFault_Handler(void)
{
while (1) {}
}

void MemManage_Handler(void)
{
while (1) {}
}

void BusFault_Handler(void)
{
while (1) {}
}

void UsageFault_Handler(void)
{
while (1) {}
}

void SVC_Handler(void)
{
}

void DebugMon_Handler(void)
{
}

void PendSV_Handler(void)
{
}

Loading…
Cancel
Save