start with USART (now DEBUG-compile is unavialable)

This commit is contained in:
Edward Emelianov
2026-03-11 23:40:39 +03:00
parent 3802f7d2cb
commit b44fd9e91f
11 changed files with 332 additions and 5 deletions

View File

@@ -22,6 +22,7 @@
#include "adc.h"
#include "flash.h"
#include "gpio.h"
#include "usart.h"
static uint16_t monitor_mask[2] = {0}; // pins to monitor == 1 (ONLY GPIO and ADC)
static uint16_t oldstates[2][16] = {0}; // previous state (16 bits - as some pins could be analog)
@@ -155,6 +156,7 @@ TRUE_INLINE int8_t get_adc_channel(uint8_t port, uint8_t pin){
int gpio_reinit(){
bzero(monitor_mask, sizeof(monitor_mask));
bzero(oldstates, sizeof(oldstates));
usartconf_t UC = {0}; // fill next
for(int port = 0; port < 2; port++){
GPIO_TypeDef *gpio = (port == 0) ? GPIOA : GPIOB;
for(int pin = 0; pin < 16; pin++){
@@ -200,6 +202,9 @@ int gpio_reinit(){
}
}
// TODO: configure USART, SPI etc
if(UC.No && usart_config(&UC)){
if(!usart_start()) return FALSE;
}
// also chech cfg->monitor!
return TRUE;
}