mirror of https://github.com/FOME-Tech/fome-fw.git
CAN side of automated testing #4630
This commit is contained in:
parent
ad39e5aee9
commit
b80c75223a
|
@ -224,3 +224,7 @@ void setBoardDefaultConfiguration() {
|
|||
int getBoardMetaOutputsCount() {
|
||||
return efi::size(MRE_OUTPUTS);
|
||||
}
|
||||
|
||||
Gpio* getBoardMetaOutputs() {
|
||||
return &MRE_OUTPUTS;
|
||||
}
|
||||
|
|
|
@ -201,3 +201,7 @@ void boardPrepareForStop() {
|
|||
int getBoardMetaOutputsCount() {
|
||||
return efi::size(PROTEUS_OUTPUTS);
|
||||
}
|
||||
|
||||
Gpio* getBoardMetaOutputs() {
|
||||
return &PROTEUS_OUTPUTS;
|
||||
}
|
||||
|
|
|
@ -1152,3 +1152,4 @@ __attribute__((weak)) void setBoardDefaultConfiguration() { }
|
|||
__attribute__((weak)) void setBoardConfigOverrides() { }
|
||||
|
||||
__attribute__((weak)) int getBoardMetaOutputsCount() { return 0; }
|
||||
__attribute__((weak)) Gpio* getBoardMetaOutputs() { return nullptr; }
|
||||
|
|
|
@ -99,3 +99,4 @@ extern bool isActiveConfigurationVoid;
|
|||
#define isPinOrModeChanged(pin, mode) (isConfigurationChanged(pin) || isConfigurationChanged(mode))
|
||||
|
||||
int getBoardMetaOutputsCount();
|
||||
Gpio* getBoardMetaOutputs();
|
||||
|
|
|
@ -10,6 +10,14 @@
|
|||
|
||||
#if EFI_CAN_SUPPORT
|
||||
|
||||
static void setPin(const CANRxFrame& frame, int value) {
|
||||
int index = frame.data8[1];
|
||||
if (index >= getBoardMetaOutputsCount())
|
||||
return;
|
||||
Gpio pin = getBoardMetaOutputs()[index];
|
||||
palWritePad(getHwPort("can_write", pin), getHwPin("can_write", pin), value);
|
||||
}
|
||||
|
||||
void processCanBenchTest(const CANRxFrame& frame) {
|
||||
if (CAN_EID(frame) != CAN_ECU_HW_META) {
|
||||
return;
|
||||
|
@ -24,12 +32,11 @@ void processCanBenchTest(const CANRxFrame& frame) {
|
|||
msg[1] = 0;
|
||||
msg[2] = getBoardMetaOutputsCount();
|
||||
|
||||
} else if (command == CAN_BENCH_GET_COUNT) {
|
||||
|
||||
} else if (command == CAN_BENCH_GET_SET) {
|
||||
setPin(frame, 1);
|
||||
} else if (command == CAN_BENCH_GET_CLEAR) {
|
||||
setPin(frame, 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // EFI_CAN_SUPPORT
|
||||
|
|
Loading…
Reference in New Issue