diff --git a/driver/st7565.c b/driver/st7565.c index 03f802d..1707601 100644 --- a/driver/st7565.c +++ b/driver/st7565.c @@ -15,6 +15,7 @@ */ #include +#include // NULL #include "bsp/dp32g030/gpio.h" #include "bsp/dp32g030/spi.h" @@ -27,9 +28,9 @@ uint8_t gStatusLine[128]; uint8_t gFrameBuffer[7][128]; -void ST7565_DrawLine(uint8_t Column, uint8_t Line, uint16_t Size, const uint8_t *pBitmap, bool bIsClearMode) +void ST7565_DrawLine(const unsigned int Column, const unsigned int Line, const unsigned int Size, const uint8_t *pBitmap) { - uint16_t i; + unsigned int i; SPI_ToggleMasterMode(&SPI0->CR, false); @@ -37,7 +38,7 @@ void ST7565_DrawLine(uint8_t Column, uint8_t Line, uint16_t Size, const uint8_t GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_ST7565_A0); - if (!bIsClearMode) + if (pBitmap != NULL) { for (i = 0; i < Size; i++) { diff --git a/driver/st7565.h b/driver/st7565.h index 8954bdd..f7f3f58 100644 --- a/driver/st7565.h +++ b/driver/st7565.h @@ -26,7 +26,7 @@ extern uint8_t gStatusLine[128]; extern uint8_t gFrameBuffer[7][128]; -void ST7565_DrawLine(uint8_t Column, uint8_t Line, uint16_t Size, const uint8_t *pBitmap, bool bIsClearMode); +void ST7565_DrawLine(const unsigned int Column, const unsigned int Line, const unsigned int Size, const uint8_t *pBitmap); void ST7565_BlitFullScreen(void); void ST7565_BlitStatusLine(void); void ST7565_FillScreen(uint8_t Value); diff --git a/firmware b/firmware index 1bd0e1a..a0c3c21 100644 Binary files a/firmware and b/firmware differ diff --git a/firmware.bin b/firmware.bin index a08b79c..27f4e09 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index 35f0c8f..4153046 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/misc.h b/misc.h index fc3b3cc..ace6e35 100644 --- a/misc.h +++ b/misc.h @@ -20,6 +20,10 @@ #include #include +#ifndef ARRAY_SIZE + #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) +#endif + #define IS_MR_CHANNEL(x) ((x) >= MR_CHANNEL_FIRST && (x) <= MR_CHANNEL_LAST) #define IS_FREQ_CHANNEL(x) ((x) >= FREQ_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST) #define IS_VALID_CHANNEL(x) ((x) < LAST_CHANNEL) @@ -29,10 +33,6 @@ #define IS_NOT_NOAA_CHANNEL(x) ((x) >= MR_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST) #endif -#ifndef ARRAY_SIZE - #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) -#endif - enum { MR_CHANNEL_FIRST = 0, MR_CHANNEL_LAST = 199u, @@ -40,7 +40,7 @@ enum { FREQ_CHANNEL_LAST = 206u, #ifdef ENABLE_NOAA NOAA_CHANNEL_FIRST = 207u, - NOAA_CHANNEL_LAST = 216u + NOAA_CHANNEL_LAST = 216u, #endif LAST_CHANNEL }; diff --git a/ui/battery.c b/ui/battery.c index d7541ed..f5c93fe 100644 --- a/ui/battery.c +++ b/ui/battery.c @@ -22,37 +22,21 @@ void UI_DisplayBattery(uint8_t Level) { - const uint8_t *pBitmap; - bool bClearMode = false; - - if (gCurrentFunction != 1) + if (gCurrentFunction != FUNCTION_TRANSMIT) { - const unsigned int x = LCD_WIDTH - sizeof(BITMAP_BatteryLevel5); - + const unsigned int x = LCD_WIDTH - sizeof(BITMAP_BatteryLevel5); + const uint8_t *pBitmap = NULL; switch (Level) { - case 0: - pBitmap = NULL; - bClearMode = true; - break; - case 1: - pBitmap = BITMAP_BatteryLevel1; - break; - case 2: - pBitmap = BITMAP_BatteryLevel2; - break; - case 3: - pBitmap = BITMAP_BatteryLevel3; - break; - case 4: - pBitmap = BITMAP_BatteryLevel4; - break; default: - pBitmap = BITMAP_BatteryLevel5; - break; + case 0: break; + case 1: pBitmap = BITMAP_BatteryLevel1; break; + case 2: pBitmap = BITMAP_BatteryLevel2; break; + case 3: pBitmap = BITMAP_BatteryLevel3; break; + case 4: pBitmap = BITMAP_BatteryLevel4; break; + case 5: pBitmap = BITMAP_BatteryLevel5; break; } - - // col lne, siz, bm, clr/set-pixels - ST7565_DrawLine(x, 0, 18, pBitmap, bClearMode); + // col lne, siz, bm + ST7565_DrawLine(x, 0, 18, pBitmap); } } diff --git a/ui/rssi.c b/ui/rssi.c index 8b392d9..cb7e015 100644 --- a/ui/rssi.c +++ b/ui/rssi.c @@ -102,7 +102,7 @@ void Render(const uint8_t rssi, const uint8_t RssiLevel, const uint8_t VFO) memmove(pLine + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6)); } - ST7565_DrawLine(0, Line, 23, pLine, (pLine == NULL) ? true : false); + ST7565_DrawLine(0, Line, 23, pLine); } void UI_UpdateRSSI(uint16_t RSSI)