way better start sequence, faster too

This commit is contained in:
2026-01-12 21:53:13 +01:00
parent 5c215db989
commit bbecc23b6b
10 changed files with 35646 additions and 134 deletions

View File

@@ -7,12 +7,6 @@
#include "change_detector.h"
#include "rtc.hpp"
extern const unsigned char tuner_init_tab[] PROGMEM;
extern const unsigned char tuner_init_tab9216[] PROGMEM;
extern const unsigned char tuner_init_tab4000[] PROGMEM;
extern const unsigned char tuner_init_tab12000[] PROGMEM;
extern const unsigned char tuner_init_tab55000[] PROGMEM;
enum RDS_GROUPS {
RDS_GROUP_0A, RDS_GROUP_0B, RDS_GROUP_1A, RDS_GROUP_1B, RDS_GROUP_2A, RDS_GROUP_2B, RDS_GROUP_3A, RDS_GROUP_3B,
RDS_GROUP_4A, RDS_GROUP_4B, RDS_GROUP_5A, RDS_GROUP_5B, RDS_GROUP_6A, RDS_GROUP_6B, RDS_GROUP_7A, RDS_GROUP_7B,

View File

@@ -8,11 +8,12 @@ typedef enum {
TEF_FM = 32,
TEF_AM = 33,
TEF_AUDIO = 48,
TEF_APPL = 64
TEF_APPL = 64,
TEF_INIT = 20
} TEF_MODULE;
typedef enum {
Cmd_Tune_To = 1,
Cmd_Tune_To = 1,
Cmd_Set_Bandwidth = 10,
Cmd_Set_RFAGC = 11,
Cmd_Set_Antenna = 12,
@@ -29,10 +30,13 @@ typedef enum {
Cmd_Set_Highcut_Noise = 53,
Cmd_Set_Highcut_Mph = 54,
Cmd_Set_Highcut_Max = 55,
Cmd_Set_LowCut_Max = 57,
Cmd_Set_Stereo_Time = 60,
Cmd_Set_Stereo_Level = 62,
Cmd_Set_Stereo_Noise = 63,
Cmd_Set_Stereo_Mph = 64,
Cmd_Set_Stereo_Min = 66,
Cmd_Set_StHiBlend_Time = 70,
Cmd_Set_StHiBlend_Level = 72,
Cmd_Set_StHiBlend_Noise = 73,
Cmd_Set_StHiBlend_Mph = 74,
@@ -54,13 +58,18 @@ typedef enum {
typedef enum {
Cmd_Set_Volume = 10,
Cmd_Set_Mute = 11,
Cmd_Set_Output_Source = 13,
Cmd_Set_Input = 12,
Cmd_Set_Ana_Out = 21,
Cmd_Set_Dig_IO = 22,
Cmd_Set_WaveGen = 24
} TEF_AUDIO_COMMAND;
typedef enum {
Cmd_Set_OperationMode = 1,
Cmd_Set_GPIO = 3,
Cmd_Set_ReferenceClock = 4,
Cmd_Set_Activate = 5,
Cmd_Get_Operation_Status = 128,
Cmd_Get_Identification = 130
} TEF_APPL_COMMAND;

View File

@@ -1,9 +1,12 @@
#pragma once
void Tuner_I2C_Init();
#ifndef DEEPELEC_DP_66X
#define FORBIDDEN_TUNER(x) ((x) != 102 && (x) != 205)
#else
#define FORBIDDEN_TUNER(x) ((x) != 102)
#endif
void Tuner_Patch(byte TEF);
void Tuner_Init(const unsigned char *table);
bool Tuner_WriteBuffer(unsigned char *buf, uint16_t len);
bool Tuner_ReadBuffer(unsigned char *buf, uint16_t len);
bool Tuner_Table_Write(const unsigned char *tab);
void Tuner_Reset();

View File

@@ -13,13 +13,15 @@
#define BWBUTTON 25
#define MODEBUTTON 26
#define CONTRASTPIN 2
#define STANDBYLED 19
#define SMETERPIN 27
#define TOUCHIRQ 33
#define EXT_IRQ 14
#ifndef DEEPELEC_DP_66X
#define STANDBYLED 19
#define SMETERPIN 27
#endif
#define XL9555_ADDRESS 0x20 // GPIO driver used in the DP666 for the 0-9 + DX(Backspace) + Enter buttons
// Assumes that A0 = A1 = A2 = 0 of the chip, this can range from 0x20 to 0x27
#define TEF668X_ADDRESS 0x64 // I2C address of the TEF itself! Not sure if this even changes
@@ -37,11 +39,10 @@
typeof (Y) y_ = (Y);\
(x_ < y_) ? x_ : y_; }
#define TIMER_OFFSET_TIMER (TIMER_500_TICK)
#define TIMER_BW_TIMER (TIMER_500_TICK)
#define TIMER_SNR_TIMER 50
#define TIMER_BAT_TIMER (TIMER_500_TICK)
#define TIMER_500_TICK 500
#define TIMER_OFFSET_TIMER 250
#define TIMER_BW_TIMER 300
#define TIMER_SNR_TIMER 30
#define TIMER_BAT_TIMER 750
#define BAT_LEVEL_STAGE 8
#define BATTERY_LOW_VALUE 3.2
@@ -376,7 +377,7 @@ enum LONGBANDBUTTONPRESS {
enum menupage {INDEX, MAINSETTINGS, AUDIOSETTINGS, DISPLAYSETTINGS, RDSSETTINGS, FMSETTINGS, AMSETTINGS, CONNECTIVITY, DXMODE, AUTOMEM};
enum AUTOMEMPIMODES {
MEMPI_OFF = 0, MEMPI_RANGE, MEMPI_FULL
MEMPI_OFF = 0, MEMPI_RANGE
};
enum SCAN_CANCEL {
@@ -384,7 +385,7 @@ enum SCAN_CANCEL {
};
enum RADIO_BAND {
BAND_OIRT = 0, BAND_FM, BAND_GAP, BAND_LW, BAND_MW, BAND_SW, BAND_NONEXISTENT
BAND_OIRT = 0, BAND_FM, BAND_GAP, BAND_LW, BAND_MW, BAND_SW
};
enum RADIO_FM_BAND_SELECTION {