rusEFI
The most advanced open source ECU
|
Data Structures | |
struct | GpioChip |
Functions | |
int | gpiochips_getPinOffset (brain_pin_e pin) |
const char * | gpiochips_getChipName (brain_pin_e pin) |
Get external chip name. | |
const char * | gpiochips_getPinName (brain_pin_e pin) |
Get external chip port name. | |
int | gpiochip_register (brain_pin_e base, const char *name, GpioChip &chip, size_t size) |
Register gpiochip. | |
int | gpiochips_setPinNames (brain_pin_e base, const char **names) |
Set pins names for registered gpiochip. | |
int | gpiochips_init (void) |
Init all registered gpiochips. | |
int | gpiochips_setPadMode (brain_pin_e pin, iomode_t mode) |
Set pin mode of gpiochip. | |
int | gpiochips_writePad (brain_pin_e pin, int value) |
Set value to gpio of gpiochip. | |
int | gpiochips_readPad (brain_pin_e pin) |
Get value to gpio of gpiochip. | |
brain_pin_diag_e | gpiochips_getDiag (brain_pin_e pin) |
Get diagnostic for given gpio. | |
void | gpiochips_debug () |
hardware_pwm * | gpiochip_tryInitPwm (const char *msg, brain_pin_e pin, float frequency, float duty) |
Try to init PWM on given pin. | |
int | gpiochips_get_total_pins (void) |
Get total pin count allocated for external gpio chips. | |
int gpiochip_register | ( | brain_pin_e | base, |
const char * | name, | ||
GpioChip & | gpioChip, | ||
size_t | size | ||
) |
Register gpiochip.
should be called from board file. Can be called before os ready. All chips should be registered before gpiochips_init() called. returns -101 in case of no free chips left returns -100 in case of no ops provided, incorrect chip size returns -102 or -103 in case chip overlaps already registered chip(s) else returns chip base
Definition at line 186 of file core.cpp.
Referenced by drv8860_add(), initCanGpioMsiobox(), l9779_add(), mc33810_add(), mc33972_add(), protectedGpio_add(), tle6240_add(), tle8888_add(), and tle9104_add().
hardware_pwm * gpiochip_tryInitPwm | ( | const char * | msg, |
brain_pin_e | pin, | ||
float | frequency, | ||
float | duty | ||
) |
Try to init PWM on given pin.
success of call depends on chip capabilities returns nullptr in case there is no chip for given pin returns nullptr in case of pin is not PWM capable returns nullptr in case all extPwms are already used returns hardware_pwm if succes, later user can call ->setDuty to change duty
Definition at line 439 of file core.cpp.
Referenced by startSimplePwm().
void gpiochips_debug | ( | ) |
Definition at line 413 of file core.cpp.
Referenced by reportPins().
int gpiochips_get_total_pins | ( | void | ) |
Get total pin count allocated for external gpio chips.
Will also include unused pins for chips that was registered but later fails to init.
Definition at line 396 of file core.cpp.
const char * gpiochips_getChipName | ( | brain_pin_e | pin | ) |
Get external chip name.
return gpiochip name
Definition at line 148 of file core.cpp.
Referenced by hwPhysicalPinName(), and reportPins().
brain_pin_diag_e gpiochips_getDiag | ( | brain_pin_e | pin | ) |
Get diagnostic for given gpio.
actual output value depend on gpiochip capabilities returns PIN_UNKNOWN in case of pin not belong to any gpio chip returns PIN_OK in case of chip does not support getting diagnostic else return brain_pin_diag_e from gpiochip driver;
Definition at line 381 of file core.cpp.
Referenced by OutputPin::getDiag(), and reportPins().
const char * gpiochips_getPinName | ( | brain_pin_e | pin | ) |
Get external chip port name.
return pin name or gpiochip name (if no pins names provided)
Definition at line 162 of file core.cpp.
Referenced by hwPhysicalPinName(), and reportPins().
int gpiochips_getPinOffset | ( | brain_pin_e | pin | ) |
return numeric part of EXTERNAL pin name.
Definition at line 132 of file core.cpp.
Referenced by hwPhysicalPinName(), and reportPins().
int gpiochips_init | ( | void | ) |
Init all registered gpiochips.
will call gpiochip init ops for all registered chips calles when OS is ready, so gpiochip can start threads, use drivers and so on.
Definition at line 284 of file core.cpp.
Referenced by initSmartGpio().
int gpiochips_readPad | ( | brain_pin_e | pin | ) |
Get value to gpio of gpiochip.
actual input value depent on current gpiochip implementation returns -1 in case of pin not belong to any gpio chip returns -1 in case of chip does not support getting output value (output only) else return value from gpiochip driver;
Definition at line 363 of file core.cpp.
Referenced by efiReadPin().
int gpiochips_setPadMode | ( | brain_pin_e | pin, |
iomode_t | mode | ||
) |
Set pin mode of gpiochip.
set pad mode for given pin. return -107 if driver does not implemet setPadMode ops else return value from gpiochip driver.
Definition at line 317 of file core.cpp.
Referenced by efiSetPadModeWithoutOwnershipAcquisition(), and efiSetPadUnused().
int gpiochips_setPinNames | ( | brain_pin_e | base, |
const char ** | names | ||
) |
Set pins names for registered gpiochip.
should be called after chip registration. May be called several times Names array size should be aqual to chip gpio count
Definition at line 266 of file core.cpp.
Referenced by drv8860_add(), l9779_add(), mc33810_add(), tle6240_add(), and tle8888_add().
int gpiochips_writePad | ( | brain_pin_e | pin, |
int | value | ||
) |
Set value to gpio of gpiochip.
actual output value depent on current gpiochip implementation for smart switch inactive supposed to be closed switch (no current flows) returns -1 in case of pin not belong to any gpio chip returns -1 in case of chip does not support seting output value (input only) else return value from gpiochip driver;
Definition at line 336 of file core.cpp.
Referenced by directWritePad(), and OutputPin::setValue().