making CAN more flexible
This commit is contained in:
parent
dbb623f6d3
commit
170a3177a4
|
@ -197,7 +197,7 @@
|
||||||
// todo: switch to continues ADC conversion for fast ADC?
|
// todo: switch to continues ADC conversion for fast ADC?
|
||||||
#define EFI_INTERNAL_FAST_ADC_PWM &PWMD4
|
#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_RX_AF 9
|
||||||
#define EFI_CAN_TX_AF 9
|
#define EFI_CAN_TX_AF 9
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ void sendMessage2(int size) {
|
||||||
}
|
}
|
||||||
txmsg.DLC = size;
|
txmsg.DLC = size;
|
||||||
// 1 second timeout
|
// 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) {
|
if (result == MSG_OK) {
|
||||||
canWriteOk++;
|
canWriteOk++;
|
||||||
} else {
|
} else {
|
||||||
|
@ -209,7 +209,7 @@ static void canRead(void) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// scheduleMsg(&logger, "Waiting for CAN");
|
// 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) {
|
if (result == MSG_TIMEOUT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -278,6 +278,7 @@ void stopCanPins(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void startCanPins(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 TX", boardConfiguration->canTxPin, PAL_MODE_ALTERNATE(EFI_CAN_TX_AF));
|
||||||
mySetPadMode2("CAN RX", boardConfiguration->canRxPin, PAL_MODE_ALTERNATE(EFI_CAN_RX_AF));
|
mySetPadMode2("CAN RX", boardConfiguration->canRxPin, PAL_MODE_ALTERNATE(EFI_CAN_RX_AF));
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,5 +250,5 @@ int getRusEfiVersion(void) {
|
||||||
return 123; // this is here to make the compiler happy about the unused array
|
return 123; // this is here to make the compiler happy about the unused array
|
||||||
if (UNUSED_CCM_SIZE[0] * 0 != 0)
|
if (UNUSED_CCM_SIZE[0] * 0 != 0)
|
||||||
return 3211; // this is here to make the compiler happy about the unused array
|
return 3211; // this is here to make the compiler happy about the unused array
|
||||||
return 20170410;
|
return 20170412;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue