Skip to content

Commit

Permalink
Initial initialization of cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
pvvx committed Mar 27, 2023
1 parent d1d2c32 commit 4871182
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 9 deletions.
Binary file modified ATC_v43.bin
Binary file not shown.
Binary file modified BTH_v43.bin
Binary file not shown.
Binary file modified CGDK2_v43.bin
Binary file not shown.
Binary file modified CGG1M_v43.bin
Binary file not shown.
Binary file modified CGG1_v43.bin
Binary file not shown.
Binary file modified MHO_C401N_v43.bin
Binary file not shown.
Binary file modified MHO_C401_v43.bin
Binary file not shown.
10 changes: 4 additions & 6 deletions src/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,21 +573,18 @@ void user_init_normal(void) {//this will get executed one time after power up
if (flash_read_cfg(&trg, EEP_ID_TRG, FEEP_SAVE_SIZE_TRG)
!= FEEP_SAVE_SIZE_TRG)
memcpy(&trg, &def_trg, FEEP_SAVE_SIZE_TRG);
#if USE_WK_RDS_COUNTER
rds.type = trg.rds.type;
#endif
#endif
// if version < 4.2 -> clear cfg.flg2.longrange
if (old_ver <= 0x41) {
cfg.flg2.longrange = 0;
flash_write_cfg(&cfg, EEP_ID_CFG, sizeof(cfg));
}
} else {
memcpy(&cfg, &def_cfg, sizeof(cfg));
memcpy(&cmf, &def_cmf, sizeof(cmf));
#if BLE_SECURITY_ENABLE
pincode = 0;
#endif
memcpy(&cfg, &def_cfg, sizeof(cfg));
memcpy(&cmf, &def_cmf, sizeof(cmf));
#if USE_TRIGGER_OUT
memcpy(&trg, &def_trg, FEEP_SAVE_SIZE_TRG);
#endif
Expand All @@ -597,10 +594,12 @@ void user_init_normal(void) {//this will get executed one time after power up
#endif
}
#if USE_WK_RDS_COUNTER
rds.type = trg.rds.type;
rds_init();
#endif
init_i2c();
reg_i2c_speed = (uint8_t)(CLOCK_SYS_CLOCK_HZ/(4*100000)); // 100 kHz
test_config();
#if (POWERUP_SCREEN) || (USE_RTC) || (BLE_EXT_ADV)
if(analog_read(DEEP_ANA_REG0) != 0x55) {
#if (BLE_EXT_ADV)
Expand All @@ -618,7 +617,6 @@ void user_init_normal(void) {//this will get executed one time after power up
#endif // SHOW_REBOOT_SCREEN || (USE_RTC)
#endif // POWERUP_SCREEN || (USE_RTC) || (BLE_EXT_ADV)
}
test_config();
memcpy(&ext, &def_ext, sizeof(ext));
init_ble();
bls_app_registerEventCallback(BLT_EV_FLAG_SUSPEND_EXIT, &suspend_exit_cb);
Expand Down
6 changes: 3 additions & 3 deletions src/i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

/* Universal I2C/SMBUS read-write transaction struct */
typedef struct _i2c_utr_t {
unsigned char mode; // bit0..6: number wr_byte for new START (bit7: =1 - generate STOP/START)
unsigned char rdlen; // bit0..6: number rd_byte (bit7: =0 - old read byte generate NACK, =1 - ACK)
unsigned char wrdata[1]; // i2c_addr_wr, wr_byte1, wr_byte2, wr_byte3, ... wr_byte126
unsigned char mode; // bit0..6: The byte number of the record for the new START (bit7: =1 - generate STOP/START)
unsigned char rdlen; // bit0..6: Number of bytes read (bit7: =0 - the last byte read generates NACK, =1 - ACK)
unsigned char wrdata[1]; // Array, the first byte is the address, then the bytes to write to the bus: i2c_addr_wr, wr_byte1, wr_byte2, wr_byte3, ... wr_byte126
} i2c_utr_t;

void init_i2c();
Expand Down

0 comments on commit 4871182

Please sign in to comment.