parent
41f925f9f3
commit
ad57fd1628
|
@ -304,18 +304,14 @@ void setIssue898() {
|
||||||
|
|
||||||
#if HW_FRANKENSO && EFI_PROD_CODE
|
#if HW_FRANKENSO && EFI_PROD_CODE
|
||||||
|
|
||||||
static const I2CConfig i2cfg = {
|
|
||||||
OPMODE_I2C,
|
|
||||||
400000,
|
|
||||||
FAST_DUTY_CYCLE_2,
|
|
||||||
};
|
|
||||||
|
|
||||||
#define EE_PAGE_SIZE 32
|
#define EE_PAGE_SIZE 32
|
||||||
|
|
||||||
// todo: page_size + 2
|
// todo: page_size + 2
|
||||||
// todo: CC_SECTION(".nocache")
|
// todo: CC_SECTION(".nocache")
|
||||||
static uint8_t write_buf[EE_PAGE_SIZE + 10];
|
static uint8_t write_buf[EE_PAGE_SIZE + 10];
|
||||||
|
|
||||||
|
|
||||||
|
#define EE_SIZE 4096
|
||||||
#define EE_U2CD I2CD3
|
#define EE_U2CD I2CD3
|
||||||
#define EEPROM_WRITE_TIME_MS 10 /* time to write one page in ms. Consult datasheet! */
|
#define EEPROM_WRITE_TIME_MS 10 /* time to write one page in ms. Consult datasheet! */
|
||||||
|
|
||||||
|
@ -324,14 +320,14 @@ static uint8_t write_buf[EE_PAGE_SIZE + 10];
|
||||||
* CAT24C32
|
* CAT24C32
|
||||||
*/
|
*/
|
||||||
static const I2CEepromFileConfig i2cee = {
|
static const I2CEepromFileConfig i2cee = {
|
||||||
0,
|
.barrier_low = 0,
|
||||||
0,
|
.barrier_hi = EE_SIZE - 1,
|
||||||
EE_PAGE_SIZE,
|
.size = EE_SIZE,
|
||||||
4096,
|
.pagesize = EE_PAGE_SIZE,
|
||||||
TIME_MS2I(EEPROM_WRITE_TIME_MS),
|
.write_time = TIME_MS2I(EEPROM_WRITE_TIME_MS),
|
||||||
&EE_U2CD,
|
.i2cp = &EE_U2CD,
|
||||||
0x50,
|
.addr = 0x50,
|
||||||
write_buf
|
.write_buf = write_buf
|
||||||
};
|
};
|
||||||
|
|
||||||
extern EepromDevice eepdev_24xx;
|
extern EepromDevice eepdev_24xx;
|
||||||
|
@ -341,7 +337,7 @@ static I2CEepromFileStream ifile;
|
||||||
* set engine_type 61
|
* set engine_type 61
|
||||||
*/
|
*/
|
||||||
void setEepromTestConfiguration() {
|
void setEepromTestConfiguration() {
|
||||||
i2cStart(&EE_U2CD, &i2cfg);
|
engineConfiguration->useEeprom = true;
|
||||||
engineConfiguration->ignitionPins[2] = GPIO_UNASSIGNED;
|
engineConfiguration->ignitionPins[2] = GPIO_UNASSIGNED;
|
||||||
// dirty hack
|
// dirty hack
|
||||||
brain_pin_markUnused(GPIOC_9);
|
brain_pin_markUnused(GPIOC_9);
|
||||||
|
@ -351,7 +347,9 @@ void setEepromTestConfiguration() {
|
||||||
|
|
||||||
addConsoleActionI("ee_read",
|
addConsoleActionI("ee_read",
|
||||||
[](int value) {
|
[](int value) {
|
||||||
EepromFileOpen((EepromFileStream *)&ifile, (EepromFileConfig *)&i2cee, &eepdev_24xx);
|
if (ifile.vmt != eepdev_24xx.efsvmt) {
|
||||||
|
EepromFileOpen((EepromFileStream *)&ifile, (EepromFileConfig *)&i2cee, &eepdev_24xx);
|
||||||
|
}
|
||||||
|
|
||||||
ifile.vmt->setposition(&ifile, 0);
|
ifile.vmt->setposition(&ifile, 0);
|
||||||
// chFileStreamSeek(&ifile, 0);
|
// chFileStreamSeek(&ifile, 0);
|
||||||
|
|
|
@ -479,6 +479,13 @@ __attribute__((weak)) void boardInitHardware() { }
|
||||||
|
|
||||||
__attribute__((weak)) void setPinConfigurationOverrides() { }
|
__attribute__((weak)) void setPinConfigurationOverrides() { }
|
||||||
|
|
||||||
|
const I2CConfig i2cfg = {
|
||||||
|
OPMODE_I2C,
|
||||||
|
400000,
|
||||||
|
FAST_DUTY_CYCLE_2,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
void initHardware() {
|
void initHardware() {
|
||||||
#if EFI_HD44780_LCD
|
#if EFI_HD44780_LCD
|
||||||
lcd_HD44780_init();
|
lcd_HD44780_init();
|
||||||
|
@ -493,6 +500,10 @@ void initHardware() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (engineConfiguration->useEeprom) {
|
||||||
|
i2cStart(&I2CD3, &i2cfg);
|
||||||
|
}
|
||||||
|
|
||||||
boardInitHardware();
|
boardInitHardware();
|
||||||
|
|
||||||
#if HAL_USE_ADC
|
#if HAL_USE_ADC
|
||||||
|
|
Loading…
Reference in New Issue