implement uart connection for logger
This commit is contained in:
@ -1,10 +1,39 @@
|
||||
#include <main.h>
|
||||
#include <led.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stm32f103xe.h>
|
||||
|
||||
void ledRed(bool on) {
|
||||
HAL_GPIO_WritePin(LED_Red_GPIO_Port, LED_Red_Pin, on ? GPIO_PIN_SET : GPIO_PIN_RESET);
|
||||
}
|
||||
|
||||
void ledGreen(bool on) {
|
||||
HAL_GPIO_WritePin(LED_Green_GPIO_Port, LED_Green_Pin, on ? GPIO_PIN_SET : GPIO_PIN_RESET);
|
||||
void led(ledColor_t color, ledAction_t action) {
|
||||
GPIO_TypeDef *port = NULL;
|
||||
uint16_t pin = 0;
|
||||
|
||||
switch (color) {
|
||||
case RED:
|
||||
port = LED_Red_GPIO_Port;
|
||||
pin = LED_Red_Pin;
|
||||
break;
|
||||
|
||||
case GREEN:
|
||||
port = LED_Green_GPIO_Port;
|
||||
pin = LED_Green_Pin;
|
||||
break;
|
||||
}
|
||||
|
||||
if (port != NULL) {
|
||||
switch (action) {
|
||||
case ON:
|
||||
HAL_GPIO_WritePin(port, pin, GPIO_PIN_SET);
|
||||
break;
|
||||
|
||||
case OFF:
|
||||
HAL_GPIO_WritePin(port, pin, GPIO_PIN_RESET);
|
||||
break;
|
||||
|
||||
case TOGGLE:
|
||||
HAL_GPIO_TogglePin(port, pin);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user