CJ125: prepare backup (#543)
This commit is contained in:
parent
ba44ffcc6a
commit
4765c0a861
|
@ -12,6 +12,10 @@ uint32_t backupRamLoad(backup_ram_e idx) {
|
|||
return RTCD1.rtc->BKP0R & 0xffff;
|
||||
case BACKUP_IGNITION_SWITCH_COUNTER:
|
||||
return (RTCD1.rtc->BKP0R >> 16) & 0xff;
|
||||
case BACKUP_CJ125_CALIBRATION_LAMBDA:
|
||||
return RTCD1.rtc->BKP1R & 0xffff;
|
||||
case BACKUP_CJ125_CALIBRATION_HEATER:
|
||||
return (RTCD1.rtc->BKP1R >> 16) & 0xffff;
|
||||
default:
|
||||
//scheduleMsg(logger, "Invalid backup ram idx %d", idx);
|
||||
return 0;
|
||||
|
@ -26,6 +30,12 @@ void backupRamSave(backup_ram_e idx, uint32_t value) {
|
|||
case BACKUP_IGNITION_SWITCH_COUNTER:
|
||||
RTCD1.rtc->BKP0R = (RTCD1.rtc->BKP0R & ~0x00ff0000) | ((value & 0xff) << 16);
|
||||
break;
|
||||
case BACKUP_CJ125_CALIBRATION_LAMBDA:
|
||||
RTCD1.rtc->BKP1R = (RTCD1.rtc->BKP1R & ~0x0000ffff) | (value & 0xffff);
|
||||
break;
|
||||
case BACKUP_CJ125_CALIBRATION_HEATER:
|
||||
RTCD1.rtc->BKP1R = (RTCD1.rtc->BKP1R & ~0xffff0000) | ((value & 0xffff) << 16);
|
||||
break;
|
||||
default:
|
||||
//scheduleMsg(logger, "Invalid backup ram idx %d, value 0x08x", idx, value);
|
||||
break;
|
||||
|
|
|
@ -25,6 +25,14 @@ typedef enum {
|
|||
* See startPrimeInjectionPulse() in controllers/trigger/main_trigger_callback.cpp
|
||||
*/
|
||||
BACKUP_IGNITION_SWITCH_COUNTER,
|
||||
/**
|
||||
* CJ125 Calibration data (16bit)
|
||||
*/
|
||||
BACKUP_CJ125_CALIBRATION_LAMBDA,
|
||||
/**
|
||||
* CJ125 Calibration data (16bit)
|
||||
*/
|
||||
BACKUP_CJ125_CALIBRATION_HEATER,
|
||||
} backup_ram_e;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue