only:alphax-4k-gdi
This commit is contained in:
rusefi 2024-11-15 21:31:14 -05:00
parent 89ff3c1583
commit b4f78d194e
2 changed files with 20 additions and 8 deletions

View File

@ -62,13 +62,13 @@
#define CAN_IOBOX_BASE2 0x220
#define CAN_IOBOX_BASE3 0x240
/* Packets from MS3 to device */
/* Packets from ECU to device */
#define CAN_IOBOX_PING 0x00
#define CAN_IOBOX_CONFIG 0x01
#define CAN_IOBOX_SET_PWM(n) (0x02 + ((n) & 0x03))
#define CAN_IOBOX_LAST_IN 0x05
/* Packets from device to MS3 */
/* Packets from device to ECU */
#define CAN_IOBOX_WHOAMI 0x08
#define CAN_IOBOX_ADC14 0x09
#define CAN_IOBOX_ADC57 0x0A
@ -171,6 +171,11 @@ public:
MsIoBox();
MsIoBox(uint32_t bus, uint32_t base, uint16_t period);
void printState() {
efiPrintf("IO state: %d", (int)state);
efiPrintf("pwmBaseFreq: %d", (int)pwmBaseFreq);
}
CanListener* request() override;
bool acceptFrame(const CANRxFrame& frame) const override;
@ -536,9 +541,9 @@ CanListener* MsIoBox::request(void) {
static MsIoBox instance[BOARD_CAN_GPIO_COUNT];
int initCanGpioMsiobox() {
void initCanGpioMsiobox() {
if (engineConfiguration->msIoBox0.id == MsIoBoxId::OFF) {
return 0;
return;
}
// MSIOBOX_0_OUT_1
@ -550,10 +555,17 @@ int initCanGpioMsiobox() {
registerCanListener(instance[i]);
/* register */
int ret = gpiochip_register(Gpio::MSIOBOX_0_OUT_1, DRIVER_NAME, instance[i], MSIOBOX_SIGNALS);
if (ret < 0)
return ret;
if (ret < 0) {
// no error handling, not returning error code
return;
}
}
}
return 0;
addConsoleAction("msioinfo", [](){
for (size_t i = 0; i < BOARD_CAN_GPIO_COUNT; i++) {
instance[i].printState();
}
});
}
#endif // EFI_CAN_GPIO

View File

@ -12,4 +12,4 @@
#define BOARD_CAN_GPIO_COUNT 0
#endif
int initCanGpioMsiobox();
void initCanGpioMsiobox();