rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Data Structures | Functions
mc33972.h File Reference

Data Structures

struct  mc33972_config
 

Functions

int mc33972_add (brain_pin_e base, unsigned int index, const struct mc33972_config *cfg)
 MC33972 driver add.
 

Function Documentation

◆ mc33972_add()

int mc33972_add ( brain_pin_e  base,
unsigned int  index,
const struct mc33972_config cfg 
)

MC33972 driver add.

Checks for valid config

Definition at line 414 of file mc33972.cpp.

415{
416 /* no config or no such chip */
417 if ((!cfg) || (!cfg->spi_bus) || (index >= BOARD_MC33972_COUNT))
418 return -1;
419
420 /* check for valid cs.
421 * TODO: remove this check? CS can be driven by SPI */
422 if (!cfg->spi_config.ssport) {
423 return -1;
424 }
425
426 Mc33972& chip = chips[index];
427
428 /* already initted? */
429 if (chip.cfg != NULL)
430 return -1;
431
432 chip.cfg = cfg;
433 chip.i_state = 0;
434 chip.drv_state = MC33972_WAIT_INIT;
435
436 /* register, return gpio chip base */
437 return gpiochip_register(base, DRIVER_NAME, chip, MC33972_INPUTS);
438}
int gpiochip_register(brain_pin_e base, const char *name, GpioChip &gpioChip, size_t size)
Register gpiochip.
Definition core.cpp:186
@ MC33972_WAIT_INIT
Definition mc33972.cpp:39
static Mc33972 chips[BOARD_MC33972_COUNT]
Definition mc33972.cpp:124
SPIConfig spi_config
Definition mc33972.h:23
SPIDriver * spi_bus
Definition mc33972.h:22

Referenced by initSmartGpio().

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

Go to the source code of this file.