parent
49c502b53b
commit
b87f1e8174
|
@ -90,9 +90,11 @@ static void canInfo() {
|
||||||
|
|
||||||
efiPrintf("CAN1 TX %s %s", hwPortname(engineConfiguration->canTxPin), getCan_baudrate_e(engineConfiguration->canBaudRate));
|
efiPrintf("CAN1 TX %s %s", hwPortname(engineConfiguration->canTxPin), getCan_baudrate_e(engineConfiguration->canBaudRate));
|
||||||
efiPrintf("CAN1 RX %s", hwPortname(engineConfiguration->canRxPin));
|
efiPrintf("CAN1 RX %s", hwPortname(engineConfiguration->canRxPin));
|
||||||
|
canHwInfo(detectCanDevice(engineConfiguration->canRxPin, engineConfiguration->canTxPin));
|
||||||
|
|
||||||
efiPrintf("CAN2 TX %s %s", hwPortname(engineConfiguration->can2TxPin), getCan_baudrate_e(engineConfiguration->can2BaudRate));
|
efiPrintf("CAN2 TX %s %s", hwPortname(engineConfiguration->can2TxPin), getCan_baudrate_e(engineConfiguration->can2BaudRate));
|
||||||
efiPrintf("CAN2 RX %s", hwPortname(engineConfiguration->can2RxPin));
|
efiPrintf("CAN2 RX %s", hwPortname(engineConfiguration->can2RxPin));
|
||||||
|
canHwInfo(detectCanDevice(engineConfiguration->can2RxPin, engineConfiguration->can2TxPin));
|
||||||
|
|
||||||
efiPrintf("type=%d canReadEnabled=%s canWriteEnabled=%s period=%d", engineConfiguration->canNbcType,
|
efiPrintf("type=%d canReadEnabled=%s canWriteEnabled=%s period=%d", engineConfiguration->canNbcType,
|
||||||
boolToString(engineConfiguration->canReadEnabled), boolToString(engineConfiguration->canWriteEnabled),
|
boolToString(engineConfiguration->canReadEnabled), boolToString(engineConfiguration->canWriteEnabled),
|
||||||
|
|
|
@ -126,4 +126,10 @@ const CANConfig * findCanConfig(can_baudrate_e rate) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void canHwInfo(CANDriver* cand)
|
||||||
|
{
|
||||||
|
/* TODO: */
|
||||||
|
(void)cand;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* EFI_CAN_SUPPORT */
|
#endif /* EFI_CAN_SUPPORT */
|
|
@ -240,6 +240,12 @@ CANDriver* detectCanDevice(brain_pin_e pinRx, brain_pin_e pinTx) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void canHwInfo(CANDriver* cand)
|
||||||
|
{
|
||||||
|
/* TODO: */
|
||||||
|
(void)cand;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* EFI_CAN_SUPPORT */
|
#endif /* EFI_CAN_SUPPORT */
|
||||||
|
|
||||||
bool allowFlashWhileRunning() {
|
bool allowFlashWhileRunning() {
|
||||||
|
|
|
@ -233,6 +233,12 @@ CANDriver* detectCanDevice(brain_pin_e pinRx, brain_pin_e pinTx) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void canHwInfo(CANDriver* cand)
|
||||||
|
{
|
||||||
|
/* TODO: */
|
||||||
|
(void)cand;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* EFI_CAN_SUPPORT */
|
#endif /* EFI_CAN_SUPPORT */
|
||||||
|
|
||||||
bool allowFlashWhileRunning() {
|
bool allowFlashWhileRunning() {
|
||||||
|
|
|
@ -43,6 +43,7 @@ bool readSlowAnalogInputs(adcsample_t* convertedSamples);
|
||||||
bool isValidCanTxPin(brain_pin_e pin);
|
bool isValidCanTxPin(brain_pin_e pin);
|
||||||
bool isValidCanRxPin(brain_pin_e pin);
|
bool isValidCanRxPin(brain_pin_e pin);
|
||||||
CANDriver* detectCanDevice(brain_pin_e pinRx, brain_pin_e pinTx);
|
CANDriver* detectCanDevice(brain_pin_e pinRx, brain_pin_e pinTx);
|
||||||
|
void canHwInfo(CANDriver* cand);
|
||||||
#endif // HAL_USE_CAN
|
#endif // HAL_USE_CAN
|
||||||
|
|
||||||
// Serial
|
// Serial
|
||||||
|
|
|
@ -231,4 +231,28 @@ const CANConfig * findCanConfig(can_baudrate_e rate) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void canHwInfo(CANDriver* cand)
|
||||||
|
{
|
||||||
|
if (cand == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (cand->state != CAN_READY) {
|
||||||
|
efiPrintf("Interface is not ready");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cand->can == NULL) {
|
||||||
|
efiPrintf("No device assigned!");
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t esr = cand->can->ESR;
|
||||||
|
efiPrintf("Receive error counter %d", (esr >> 24) & 0xff);
|
||||||
|
efiPrintf("Transmit error counter %d", (esr >> 16) & 0xff);
|
||||||
|
efiPrintf("Last error %d", (esr >> 4) & 0x7);
|
||||||
|
efiPrintf("Flags: %s %s %s",
|
||||||
|
(esr & 0x4) ? "BOFF" : "",
|
||||||
|
(esr & 0x2) ? "EPVF" : "",
|
||||||
|
(esr & 0x1) ? "EWGF" : "");
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* EFI_CAN_SUPPORT */
|
#endif /* EFI_CAN_SUPPORT */
|
|
@ -4,6 +4,7 @@
|
||||||
CANDriver* detectCanDevice(brain_pin_e pinRx, brain_pin_e pinTx);
|
CANDriver* detectCanDevice(brain_pin_e pinRx, brain_pin_e pinTx);
|
||||||
static bool isValidCanTxPin(brain_pin_e) { return true; }
|
static bool isValidCanTxPin(brain_pin_e) { return true; }
|
||||||
static bool isValidCanRxPin(brain_pin_e) { return true; }
|
static bool isValidCanRxPin(brain_pin_e) { return true; }
|
||||||
|
static canHwInfo(CANDriver*) { return; }
|
||||||
#endif // HAL_USE_CAN
|
#endif // HAL_USE_CAN
|
||||||
|
|
||||||
static bool allowFlashWhileRunning() { return true; }
|
static bool allowFlashWhileRunning() { return true; }
|
||||||
|
|
Loading…
Reference in New Issue