Refactor hardware initialization
This commit is contained in:
parent
7769c97286
commit
45fec64559
@ -9,6 +9,8 @@
|
||||
#include "uart.hpp"
|
||||
#include "utils.hpp"
|
||||
|
||||
using serial_t = uart::Vcp<>;
|
||||
|
||||
std::array<uint16_t, 3> sampleLightSensors()
|
||||
{
|
||||
std::array<uint16_t, 3> adcValues;
|
||||
@ -28,12 +30,17 @@ std::array<uint16_t, 3> sampleLightSensors()
|
||||
return adcValues;
|
||||
}
|
||||
|
||||
int main()
|
||||
static inline void initializeHardware()
|
||||
{
|
||||
uart::Vcp<> serial;
|
||||
serial_t serial;
|
||||
|
||||
init();
|
||||
serial.init();
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
initializeHardware();
|
||||
|
||||
HAL_GPIO_WritePin(RED_LED_GPIO_Port, RED_LED_Pin, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GREEN_LED_GPIO_Port, GREEN_LED_Pin, GPIO_PIN_RESET);
|
||||
@ -45,6 +52,7 @@ int main()
|
||||
HAL_GPIO_WritePin(GREEN_LED_GPIO_Port, GREEN_LED_Pin, GPIO_PIN_SET);
|
||||
HAL_GPIO_WritePin(BLUE_LED_GPIO_Port, BLUE_LED_Pin, GPIO_PIN_SET);
|
||||
|
||||
serial_t serial;
|
||||
uint8_t data = 0;
|
||||
|
||||
while(true) {
|
||||
|
Loading…
Reference in New Issue
Block a user