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
+38
-3
No files matched your search
+9
-2
@@ -95,8 +95,7 @@ if(ENABLE_AIRCOPY OR ENABLE_UART OR ENABLE_USB)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
enable_feature(ENABLE_UART
|
enable_feature(ENABLE_UART
|
||||||
driver/uart.c
|
driver/uart.c
|
||||||
app/uart.c
|
|
||||||
# driver/aes.c
|
# driver/aes.c
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -177,6 +176,14 @@ enable_feature(ENABLE_EXTRA_UART_CMD)
|
|||||||
|
|
||||||
# ---- F4HWN MODS ----
|
# ---- 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)
|
||||||
enable_feature(ENABLE_FEAT_F4HWN_GAME
|
enable_feature(ENABLE_FEAT_F4HWN_GAME
|
||||||
app/breakout.c
|
app/breakout.c
|
||||||
|
|||||||
@@ -1654,7 +1654,9 @@ void APP_TimeSlice10ms(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_LOGO_SAV
|
#ifdef ENABLE_FEAT_F4HWN_LOGO_SAV
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||||
bool screenSaverRendered = false;
|
bool screenSaverRendered = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (gScreenSaverDisplayed) {
|
if (gScreenSaverDisplayed) {
|
||||||
if (gUpdateDisplayCurrent) {
|
if (gUpdateDisplayCurrent) {
|
||||||
@@ -1668,13 +1670,17 @@ void APP_TimeSlice10ms(void)
|
|||||||
if (++gScreenSaverTick >= 8u) {
|
if (++gScreenSaverTick >= 8u) {
|
||||||
gScreenSaverTick = 0;
|
gScreenSaverTick = 0;
|
||||||
ScreenSaverRenderMatrix(false);
|
ScreenSaverRenderMatrix(false);
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||||
screenSaverRendered = true;
|
screenSaverRendered = true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
} else if (gSetting_set_sav == SET_SAV_LOGO_PLUS) {
|
} else if (gSetting_set_sav == SET_SAV_LOGO_PLUS) {
|
||||||
if (++gScreenSaverTick >= 16u) {
|
if (++gScreenSaverTick >= 16u) {
|
||||||
gScreenSaverTick = 0;
|
gScreenSaverTick = 0;
|
||||||
ScreenSaverRenderLogoPlus(false);
|
ScreenSaverRenderLogoPlus(false);
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||||
screenSaverRendered = true;
|
screenSaverRendered = true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -260,6 +260,7 @@ static void SendReply(uint32_t Port, void *pReply, uint16_t Size)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(ENABLE_UART)
|
||||||
Header_t Header;
|
Header_t Header;
|
||||||
Footer_t Footer;
|
Footer_t Footer;
|
||||||
|
|
||||||
@@ -290,6 +291,7 @@ static void SendReply(uint32_t Port, void *pReply, uint16_t Size)
|
|||||||
Footer.ID = 0xBADC;
|
Footer.ID = 0xBADC;
|
||||||
|
|
||||||
UART_Send(&Footer, sizeof(Footer));
|
UART_Send(&Footer, sizeof(Footer));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SendVersion(uint32_t Port)
|
static void SendVersion(uint32_t Port)
|
||||||
|
|||||||
+21
-1
@@ -18,7 +18,12 @@
|
|||||||
#include "driver/st7565.h"
|
#include "driver/st7565.h"
|
||||||
#include "k5viewer.h"
|
#include "k5viewer.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#ifdef ENABLE_UART
|
||||||
|
#include "driver/uart.h"
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_USB
|
||||||
#include "driver/vcp.h"
|
#include "driver/vcp.h"
|
||||||
|
#endif
|
||||||
#include "driver/keyboard.h"
|
#include "driver/keyboard.h"
|
||||||
#include "driver/bk4819.h"
|
#include "driver/bk4819.h"
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER
|
#ifdef ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER
|
||||||
@@ -67,26 +72,41 @@ void K5VIEWER_ParseInput(void)
|
|||||||
if (K5VIEWER_IsLocked())
|
if (K5VIEWER_IsLocked())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef ENABLE_UART
|
||||||
if (UART_IsCableConnected()) {
|
if (UART_IsCableConnected()) {
|
||||||
keepAlive = 15;
|
keepAlive = 15;
|
||||||
hasConnectionPing = true;
|
hasConnectionPing = true;
|
||||||
gUSB_K5ViewerEnabled = false;
|
gUSB_K5ViewerEnabled = false;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (VCP_K5ViewerPing()) {
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_USB
|
||||||
|
if (VCP_K5ViewerPing()) {
|
||||||
keepAlive = 15;
|
keepAlive = 15;
|
||||||
hasConnectionPing = true;
|
hasConnectionPing = true;
|
||||||
gUSB_K5ViewerEnabled = true;
|
gUSB_K5ViewerEnabled = true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void K5VIEWER_Send(const uint8_t *buf, uint16_t len)
|
static void K5VIEWER_Send(const uint8_t *buf, uint16_t len)
|
||||||
{
|
{
|
||||||
|
#if defined(ENABLE_UART) && defined(ENABLE_USB)
|
||||||
if (gUSB_K5ViewerEnabled) {
|
if (gUSB_K5ViewerEnabled) {
|
||||||
cdc_acm_data_send_with_dtr(buf, len);
|
cdc_acm_data_send_with_dtr(buf, len);
|
||||||
} else {
|
} else {
|
||||||
UART_Send(buf, len);
|
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 {
|
enum {
|
||||||
|
|||||||
Reference in new issue
Block a user