Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending CAN mode to include FIFO #4359

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion drivers/CAN.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ class CAN {
Silent,
LocalTest,
GlobalTest,
SilentTest
SilentTest,
FIFO // Tx message order preserved
};

/** Change CAN operation to the specified mode
Expand Down
3 changes: 2 additions & 1 deletion hal/can_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ typedef enum {
MODE_SILENT,
MODE_TEST_LOCAL,
MODE_TEST_GLOBAL,
MODE_TEST_SILENT
MODE_TEST_SILENT,
MODE_FIFO
} CanMode;

typedef void (*can_irq_handler)(uint32_t id, CanIrqType type);
Expand Down
8 changes: 7 additions & 1 deletion targets/TARGET_STM/can_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,15 @@ int can_mode(can_t *obj, CanMode mode)
}

switch (mode) {
case MODE_NORMAL:
case MODE_FIFO:
can->MCR |= CAN_MCR_TXFP;
can->BTR &= ~(CAN_BTR_SILM | CAN_BTR_LBKM);
success = 1;
break;
case MODE_NORMAL:
can->BTR &= ~(CAN_BTR_SILM | CAN_BTR_LBKM | CAN_MCR_TXFP);
success = 1;
break;
case MODE_SILENT:
can->BTR |= CAN_BTR_SILM;
can->BTR &= ~CAN_BTR_LBKM;
Expand Down Expand Up @@ -593,3 +598,4 @@ void can_irq_set(can_t *obj, CanIrqType type, uint32_t enable)

#endif // DEVICE_CAN