mirror of
https://github.com/armel/uv-k1-k5v3-firmware-custom.git
synced 2026-10-02 03:15:37 +00:00
Fix optional UART and USB builds
This commit is contained in:
1 parent
7d8b95407f
commit
024bfbaaf3
4 files changed
+37
-2
No files matched your search
+8
-1
@@ -96,7 +96,6 @@ endif()
|
||||
|
||||
enable_feature(ENABLE_UART
|
||||
driver/uart.c
|
||||
app/uart.c
|
||||
# driver/aes.c
|
||||
)
|
||||
|
||||
@@ -177,6 +176,14 @@ enable_feature(ENABLE_EXTRA_UART_CMD)
|
||||
|
||||
# ---- F4HWN MODS ----
|
||||
|
||||
if(NOT ENABLE_UART AND NOT ENABLE_USB)
|
||||
if(ENABLE_FEAT_F4HWN_K5VIEWER OR ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER)
|
||||
message(STATUS "Disabling K5Viewer because both ENABLE_UART and ENABLE_USB are OFF.")
|
||||
endif()
|
||||
set(ENABLE_FEAT_F4HWN_K5VIEWER OFF)
|
||||
set(ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER OFF)
|
||||
endif()
|
||||
|
||||
enable_feature(ENABLE_FEAT_F4HWN)
|
||||
enable_feature(ENABLE_FEAT_F4HWN_GAME
|
||||
app/breakout.c
|
||||
|
||||
@@ -1654,7 +1654,9 @@ void APP_TimeSlice10ms(void)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_LOGO_SAV
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
bool screenSaverRendered = false;
|
||||
#endif
|
||||
|
||||
if (gScreenSaverDisplayed) {
|
||||
if (gUpdateDisplayCurrent) {
|
||||
@@ -1668,13 +1670,17 @@ void APP_TimeSlice10ms(void)
|
||||
if (++gScreenSaverTick >= 8u) {
|
||||
gScreenSaverTick = 0;
|
||||
ScreenSaverRenderMatrix(false);
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
screenSaverRendered = true;
|
||||
#endif
|
||||
}
|
||||
} else if (gSetting_set_sav == SET_SAV_LOGO_PLUS) {
|
||||
if (++gScreenSaverTick >= 16u) {
|
||||
gScreenSaverTick = 0;
|
||||
ScreenSaverRenderLogoPlus(false);
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
screenSaverRendered = true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,6 +260,7 @@ static void SendReply(uint32_t Port, void *pReply, uint16_t Size)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_UART)
|
||||
Header_t Header;
|
||||
Footer_t Footer;
|
||||
|
||||
@@ -290,6 +291,7 @@ static void SendReply(uint32_t Port, void *pReply, uint16_t Size)
|
||||
Footer.ID = 0xBADC;
|
||||
|
||||
UART_Send(&Footer, sizeof(Footer));
|
||||
#endif
|
||||
}
|
||||
|
||||
static void SendVersion(uint32_t Port)
|
||||
|
||||
+21
-1
@@ -18,7 +18,12 @@
|
||||
#include "driver/st7565.h"
|
||||
#include "k5viewer.h"
|
||||
#include "misc.h"
|
||||
#ifdef ENABLE_UART
|
||||
#include "driver/uart.h"
|
||||
#endif
|
||||
#ifdef ENABLE_USB
|
||||
#include "driver/vcp.h"
|
||||
#endif
|
||||
#include "driver/keyboard.h"
|
||||
#include "driver/bk4819.h"
|
||||
#ifdef ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER
|
||||
@@ -67,26 +72,41 @@ void K5VIEWER_ParseInput(void)
|
||||
if (K5VIEWER_IsLocked())
|
||||
return;
|
||||
|
||||
#ifdef ENABLE_UART
|
||||
if (UART_IsCableConnected()) {
|
||||
keepAlive = 15;
|
||||
hasConnectionPing = true;
|
||||
gUSB_K5ViewerEnabled = false;
|
||||
return;
|
||||
}
|
||||
else if (VCP_K5ViewerPing()) {
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_USB
|
||||
if (VCP_K5ViewerPing()) {
|
||||
keepAlive = 15;
|
||||
hasConnectionPing = true;
|
||||
gUSB_K5ViewerEnabled = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
static void K5VIEWER_Send(const uint8_t *buf, uint16_t len)
|
||||
{
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_USB)
|
||||
if (gUSB_K5ViewerEnabled) {
|
||||
cdc_acm_data_send_with_dtr(buf, len);
|
||||
} else {
|
||||
UART_Send(buf, len);
|
||||
}
|
||||
#elif defined(ENABLE_USB)
|
||||
cdc_acm_data_send_with_dtr(buf, len);
|
||||
#elif defined(ENABLE_UART)
|
||||
UART_Send(buf, len);
|
||||
#else
|
||||
(void)buf;
|
||||
(void)len;
|
||||
#endif
|
||||
}
|
||||
|
||||
enum {
|
||||
|
||||
Reference in new issue
Block a user