rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions
pca_board_id.h File Reference

Functions

static uint32_t getBoardRevision ()
 
int hackHellenBoardId (int)
 

Function Documentation

◆ getBoardRevision()

static uint32_t getBoardRevision ( )
static

Definition at line 9 of file pca_board_id.h.

9 {
10 static bool isFirstInvocation = true;
11 static uint32_t variant;
12
14 BitbangI2c m_i2c;
15 const uint8_t set_out[3] = {0x06, 0xff, 0xff};
16 const uint8_t read_inputs_cmd[1] = {0x00};
17 uint8_t rx[2] = {0xff, 0xff};
18
19 //same pins as for baro LPS25
20 m_i2c.init(Gpio::B10, Gpio::B11);
21
22 // configuration registers:
23 // after reset all IO pins should be configured as output, so ttis step can be skipped
24 m_i2c.write(PCA9555_I2C_ADDR, set_out, sizeof(set_out));
25
26 // read registers 0 and 1: Input port registers
27 m_i2c.writeRead(PCA9555_I2C_ADDR, read_inputs_cmd, sizeof(read_inputs_cmd), rx, sizeof(rx));
28
29 variant = (rx[1] << 8) | (rx[0] << 0);
30
31 efiPrintf("Board variant 0x%04x\n", (unsigned int)variant);
32
33 isFirstInvocation = false;
34
35 // release gpios for baso LPS25 driver
36 m_i2c.deinit();
37 }
38
39 return variant;
40}
void write(uint8_t addr, const uint8_t *data, size_t size)
Definition i2c_bb.cpp:190
bool init(brain_pin_e scl, brain_pin_e sda)
Definition i2c_bb.cpp:37
void writeRead(uint8_t addr, const uint8_t *writeData, size_t writeSize, uint8_t *readData, size_t readSize)
Definition i2c_bb.cpp:204
void deinit()
Definition i2c_bb.cpp:64
static bool isFirstInvocation

Referenced by hackHellenBoardId().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hackHellenBoardId()

int hackHellenBoardId ( int  detectedId)

Definition at line 42 of file pca_board_id.h.

42 {
43 return getBoardRevision();
44}
static uint32_t getBoardRevision()
Definition pca_board_id.h:9
Here is the call graph for this function:

Go to the source code of this file.