diff --git a/audio.c b/audio.c index 745db38..db70a04 100644 --- a/audio.c +++ b/audio.c @@ -128,7 +128,7 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep) SYSTEM_DelayMs(Duration); BK4819_EnterTxMute(); SYSTEM_DelayMs(20); - GPIO_ClearBit(&GPIOC->DATA,4); + GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); g_200003B6 = 80; diff --git a/board.c b/board.c index 4569185..eef0503 100644 --- a/board.c +++ b/board.c @@ -79,7 +79,7 @@ void BOARD_GPIO_Init(void) | GPIO_DIR_5_MASK ); - GPIO_SetBit(&GPIOB->DATA, 15); + GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BK1080); } void BOARD_PORTCON_Init(void) diff --git a/driver/gpio.h b/driver/gpio.h index 094c2e6..a05aa98 100644 --- a/driver/gpio.h +++ b/driver/gpio.h @@ -39,8 +39,8 @@ enum GPIOA_PINS { enum GPIOB_PINS { GPIOB_PIN_BACKLIGHT = 6, - GPIOB_PIN_ST7565_0 = 9, - GPIOB_PIN_ST7565_1 = 11, // Shared with SWD! + GPIOB_PIN_ST7565_A0 = 9, + GPIOB_PIN_ST7565_RES = 11, // Shared with SWD! GPIOB_PIN_SWD_IO = 11, // Shared with ST7565! GPIOB_PIN_SWD_CLK = 14, @@ -52,7 +52,7 @@ enum GPIOC_PINS { GPIOC_PIN_BK4819_SCN = 0, GPIOC_PIN_BK4819_SCL = 1, GPIOC_PIN_BK4819_SDA = 2, - + GPIOC_PIN_FLASHLIGHT = 3, GPIOC_PIN_AUDIO_PATH = 4, diff --git a/driver/st7565.c b/driver/st7565.c index e45968f..b5c767c 100644 --- a/driver/st7565.c +++ b/driver/st7565.c @@ -31,7 +31,7 @@ void ST7565_DrawLine(uint8_t Column, uint8_t Line, uint16_t Size, const uint8_t SPI_ToggleMasterMode(&SPI0->CR, false); ST7565_SelectColumnAndLine(Column + 4U, Line); - GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_ST7565_0); + GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_ST7565_A0); if (bIsClearMode == false) { for (i = 0; i < Size; i++) { @@ -61,7 +61,7 @@ void ST7565_BlitFullScreen(void) for (Line = 0; Line < 7; Line++) { ST7565_SelectColumnAndLine(4U, Line + 1U); - GPIO_SetBit(&GPIOB->DATA, 9U); + GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_ST7565_A0); for (Column = 0; Column < 128; Column++) { while ((SPI0->FIFOST & SPI_FIFOST_TFF_MASK) != SPI_FIFOST_TFF_BITS_NOT_FULL) { } @@ -81,7 +81,7 @@ void ST7565_BlitStatusLine(void) SPI_ToggleMasterMode(&SPI0->CR, false); ST7565_WriteByte(0x40); ST7565_SelectColumnAndLine(4, 0); - GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_ST7565_0); + GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_ST7565_A0); for (i = 0; i < 0x80; i++) { while ((SPI0->FIFOST & SPI_FIFOST_TFF_MASK) != SPI_FIFOST_TFF_BITS_NOT_FULL) { @@ -99,7 +99,7 @@ void ST7565_FillScreen(uint8_t Value) SPI_ToggleMasterMode(&SPI0->CR, false); for (i = 0; i < 8; i++) { ST7565_SelectColumnAndLine(0, i); - GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_ST7565_0); + GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_ST7565_A0); for (j = 0; j < 132; j++) { while ((SPI0->FIFOST & SPI_FIFOST_TFF_MASK) != SPI_FIFOST_TFF_BITS_NOT_FULL) { } @@ -143,17 +143,17 @@ void ST7565_Init(void) void ST7565_Configure_GPIO_B11(void) { - GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_ST7565_1); + GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_ST7565_RES); SYSTEM_DelayMs(1); - GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_ST7565_1); + GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_ST7565_RES); SYSTEM_DelayMs(20); - GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_ST7565_1); + GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_ST7565_RES); SYSTEM_DelayMs(120); } void ST7565_SelectColumnAndLine(uint8_t Column, uint8_t Line) { - GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_ST7565_0); + GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_ST7565_A0); while ((SPI0->FIFOST & SPI_FIFOST_TFF_MASK) != SPI_FIFOST_TFF_BITS_NOT_FULL) { } SPI0->WDR = Line + 0xB0; @@ -168,7 +168,7 @@ void ST7565_SelectColumnAndLine(uint8_t Column, uint8_t Line) void ST7565_WriteByte(uint8_t Value) { - GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_ST7565_0); + GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_ST7565_A0); while ((SPI0->FIFOST & SPI_FIFOST_TFF_MASK) != SPI_FIFOST_TFF_BITS_NOT_FULL) { } SPI0->WDR = Value; diff --git a/main.c b/main.c index 289c951..3b59fdf 100644 --- a/main.c +++ b/main.c @@ -56,11 +56,6 @@ static void FLASHLIGHT_Init(void) PORTCON_PORTC_IE = PORTCON_PORTC_IE_C5_BITS_ENABLE; PORTCON_PORTC_PU = PORTCON_PORTC_PU_C5_BITS_ENABLE; GPIOC->DIR |= GPIO_DIR_3_BITS_OUTPUT; - - GPIO_SetBit(&GPIOC->DATA, 10); - GPIO_SetBit(&GPIOC->DATA, 11); - GPIO_SetBit(&GPIOC->DATA, 12); - GPIO_SetBit(&GPIOC->DATA, 13); } static void FLASHLIGHT_TurnOff(void) @@ -145,7 +140,7 @@ void Main(void) HELPER_CheckBootKey(KeyType); - GPIO_ClearBit(&GPIOA->DATA, 12); + GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_VOICE_0); g_2000036F = 1; AUDIO_SetVoiceID(0, VOICE_ID_WELCOME); Channel = gEeprom.VfoChannel[gEeprom.TX_CHANNEL] + 1;