mirror of
https://github.com/DualTachyon/uv-k5-firmware.git
synced 2025-02-23 18:00:27 +08:00
Added SETTINGS_SaveFM.
This commit is contained in:
parent
55c512fe20
commit
db6d255984
1
app.c
1
app.c
@ -1381,6 +1381,7 @@ static void APP_ProcessKey(KEY_Code_t CurrentKey, bool bKeyPressed, bool bKeyHel
|
||||
gFlagSaveSettings = false;
|
||||
}
|
||||
if (gFlagSaveFM) {
|
||||
SETTINGS_SaveFM();
|
||||
gFlagSaveFM = false;
|
||||
}
|
||||
if (g_200003A7 != 0) {
|
||||
|
@ -14,11 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "bsp/dp32g030/dma.h"
|
||||
#include "bsp/dp32g030/syscon.h"
|
||||
#include "bsp/dp32g030/uart.h"
|
||||
#include "driver/uart.h"
|
||||
|
||||
static bool UART_IsLogEnabled;
|
||||
uint8_t UART_DMA_Buffer[256];
|
||||
|
||||
void UART_Init(void)
|
||||
@ -94,6 +96,13 @@ void UART_Send(const void *pBuffer, uint32_t Size)
|
||||
}
|
||||
}
|
||||
|
||||
void UART_LogSend(const void *pBuffer, uint32_t Size)
|
||||
{
|
||||
if (UART_IsLogEnabled) {
|
||||
UART_Send(pBuffer, Size);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Not part of the original FW, but used for easier testing
|
||||
void UART_Print(const char *pString)
|
||||
{
|
||||
|
@ -24,6 +24,7 @@ extern uint8_t UART_DMA_Buffer[256];
|
||||
|
||||
void UART_Init(void);
|
||||
void UART_Send(const void *pBuffer, uint32_t Size);
|
||||
void UART_LogSend(const void *pBuffer, uint32_t Size);
|
||||
void UART_Print(const char *pString);
|
||||
|
||||
#endif
|
||||
|
25
settings.c
25
settings.c
@ -14,7 +14,32 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "driver/eeprom.h"
|
||||
#include "driver/uart.h"
|
||||
#include "fm.h"
|
||||
#include "settings.h"
|
||||
|
||||
EEPROM_Config_t gEeprom;
|
||||
|
||||
void SETTINGS_SaveFM(void)
|
||||
{
|
||||
uint8_t i;
|
||||
struct {
|
||||
uint16_t Frequency;
|
||||
uint8_t Channel;
|
||||
bool IsChannelSelected;
|
||||
uint8_t Padding[4];
|
||||
} State;
|
||||
|
||||
UART_LogSend("sFm\r\n", 5);
|
||||
memset(&State, 0xFF, sizeof(State));
|
||||
State.Channel = gEeprom.FM_CurrentChannel;
|
||||
State.Frequency = gEeprom.FM_CurrentFrequency;
|
||||
State.IsChannelSelected = gEeprom.FM_IsChannelSelected;
|
||||
EEPROM_WriteBuffer(0x0E88, &State);
|
||||
for (i = 0; i < 5; i++) {
|
||||
EEPROM_WriteBuffer(0x0E40 + (i * 8), &gFM_Channels[i * 4]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,5 +168,7 @@ typedef struct {
|
||||
|
||||
extern EEPROM_Config_t gEeprom;
|
||||
|
||||
void SETTINGS_SaveFM(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user