mirror of
https://github.com/candle-usb/candleLight_fw.git
synced 2025-01-14 05:42:53 +08:00
CAN errors : comment some funcs + defines
This commit is contained in:
parent
ceeac236c4
commit
7f9a0ea331
@ -50,5 +50,15 @@ bool can_is_rx_pending(can_data_t *hcan);
|
|||||||
|
|
||||||
bool can_send(can_data_t *hcan, struct gs_host_frame *frame);
|
bool can_send(can_data_t *hcan, struct gs_host_frame *frame);
|
||||||
|
|
||||||
|
/** return CAN->ESR register which contains tx/rx error counters and
|
||||||
|
* LEC (last error code).
|
||||||
|
*/
|
||||||
uint32_t can_get_error_status(can_data_t *hcan);
|
uint32_t can_get_error_status(can_data_t *hcan);
|
||||||
|
|
||||||
|
#define CAN_ERRCOUNT_THRESHOLD 15 /* send an error frame if tx/rx counters increase by more than this amount */
|
||||||
|
|
||||||
|
/** parse status value returned by can_get_error_status().
|
||||||
|
* @param frame : will hold the generated error frame
|
||||||
|
* @return 1 when status changes (if any) need a new error frame sent
|
||||||
|
*/
|
||||||
bool can_parse_error_status(uint32_t err, uint32_t last_err, can_data_t *hcan, struct gs_host_frame *frame);
|
bool can_parse_error_status(uint32_t err, uint32_t last_err, can_data_t *hcan, struct gs_host_frame *frame);
|
||||||
|
@ -290,10 +290,10 @@ bool can_parse_error_status(uint32_t err, uint32_t last_err, can_data_t *hcan, s
|
|||||||
should_send = true;
|
should_send = true;
|
||||||
}
|
}
|
||||||
/* If either error counter increased by 15. */
|
/* If either error counter increased by 15. */
|
||||||
if (((int)last_tx_error_cnt + 15) < tx_error_cnt) {
|
if (((int)last_tx_error_cnt + CAN_ERRCOUNT_THRESHOLD) < tx_error_cnt) {
|
||||||
should_send = true;
|
should_send = true;
|
||||||
}
|
}
|
||||||
if (((int)last_rx_error_cnt + 15) < rx_error_cnt) {
|
if (((int)last_rx_error_cnt + CAN_ERRCOUNT_THRESHOLD) < rx_error_cnt) {
|
||||||
should_send = true;
|
should_send = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user