making CAN more flexible

This commit is contained in:
rusefi 2017-04-12 09:36:13 -04:00
parent dbb623f6d3
commit 170a3177a4
3 changed files with 5 additions and 4 deletions

View File

@ -197,7 +197,7 @@
// todo: switch to continues ADC conversion for fast ADC?
#define EFI_INTERNAL_FAST_ADC_PWM &PWMD4
#define EFI_CAN_DEVICE CAND2
//#define EFI_CAN_DEVICE CAND2
#define EFI_CAN_RX_AF 9
#define EFI_CAN_TX_AF 9

View File

@ -96,7 +96,7 @@ void sendMessage2(int size) {
}
txmsg.DLC = size;
// 1 second timeout
msg_t result = canTransmit(&EFI_CAN_DEVICE, CAN_ANY_MAILBOX, &txmsg, MS2ST(1000));
msg_t result = canTransmit(device, CAN_ANY_MAILBOX, &txmsg, MS2ST(1000));
if (result == MSG_OK) {
canWriteOk++;
} else {
@ -209,7 +209,7 @@ static void canRead(void) {
return;
}
// scheduleMsg(&logger, "Waiting for CAN");
msg_t result = canReceive(&EFI_CAN_DEVICE, CAN_ANY_MAILBOX, &rxBuffer, MS2ST(1000));
msg_t result = canReceive(device, CAN_ANY_MAILBOX, &rxBuffer, MS2ST(1000));
if (result == MSG_TIMEOUT) {
return;
}
@ -278,6 +278,7 @@ void stopCanPins(DECLARE_ENGINE_PARAMETER_F) {
}
void startCanPins(DECLARE_ENGINE_PARAMETER_F) {
// todo: confirm that same AF works for all pins on all devices?
mySetPadMode2("CAN TX", boardConfiguration->canTxPin, PAL_MODE_ALTERNATE(EFI_CAN_TX_AF));
mySetPadMode2("CAN RX", boardConfiguration->canRxPin, PAL_MODE_ALTERNATE(EFI_CAN_RX_AF));
}

View File

@ -250,5 +250,5 @@ int getRusEfiVersion(void) {
return 123; // this is here to make the compiler happy about the unused array
if (UNUSED_CCM_SIZE[0] * 0 != 0)
return 3211; // this is here to make the compiler happy about the unused array
return 20170410;
return 20170412;
}