Fix compilation errors when UART is disabled

This commit is contained in:
Juan Antonio
2023-12-14 20:04:06 +01:00
committed by egzumer
parent 80fa310646
commit 9dc79ce868
7 changed files with 64 additions and 51 deletions

28
main.c
View File

@@ -31,7 +31,9 @@
#include "driver/gpio.h"
#include "driver/system.h"
#include "driver/systick.h"
#include "driver/uart.h"
#ifdef ENABLE_UART
#include "driver/uart.h"
#endif
#include "helper/battery.h"
#include "helper/boot.h"
#include "misc.h"
@@ -42,16 +44,17 @@
#include "ui/menu.h"
#include "version.h"
void _putchar(char c)
void _putchar(__attribute__((unused)) char c)
{
#ifdef ENABLE_UART
UART_Send((uint8_t *)&c, 1);
#endif
}
void Main(void)
{
unsigned int i;
BOOT_Mode_t BootMode;
// Enable clock gating of blocks we need
SYSCON_DEV_CLK_GATE = 0
| SYSCON_DEV_CLK_GATE_GPIOA_BITS_ENABLE
@@ -66,11 +69,13 @@ void Main(void)
SYSTICK_Init();
BOARD_Init();
UART_Init();
boot_counter_10ms = 250; // 2.5 sec
#ifdef ENABLE_UART
UART_Init();
UART_Send(UART_Version, strlen(UART_Version));
#endif
// Not implementing authentic device checks
@@ -92,7 +97,7 @@ void Main(void)
RADIO_SetupRegisters(true);
for (i = 0; i < ARRAY_SIZE(gBatteryVoltages); i++)
for (unsigned int i = 0; i < ARRAY_SIZE(gBatteryVoltages); i++)
BOARD_ADC_GetBatteryInfo(&gBatteryVoltages[i], &gBatteryCurrent);
BATTERY_GetReadings(false);
@@ -101,8 +106,8 @@ void Main(void)
AM_fix_init();
#endif
BootMode = BOOT_GetMode();
const BOOT_Mode_t BootMode = BOOT_GetMode();
if (BootMode == BOOT_MODE_F_LOCK)
{
gF_LOCK = true; // flag to say include the hidden menu items
@@ -124,8 +129,9 @@ void Main(void)
{ // keys are pressed
UI_DisplayReleaseKeys();
BACKLIGHT_TurnOn();
i = 0;
while (i < 50) // 500ms
// 500ms
for (int i = 0; i < 50;)
{
i = (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && KEYBOARD_Poll() == KEY_INVALID) ? i + 1 : 0;
SYSTEM_DelayMs(10);