mirror of https://github.com/ARMmbed/mbed-os.git
parent
b0a1fd9c86
commit
67a75d96c6
|
@ -261,14 +261,14 @@ int can_read(can_t *obj, CAN_Message *msg, int handle)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the Id */
|
/* Get the Id */
|
||||||
msg->format = (CANFormat)((uint8_t)0x04 & can->sFIFOMailBox[handle].RIR);
|
msg->format = (CANFormat)(((uint8_t)0x04 & can->sFIFOMailBox[handle].RIR) >> 2);
|
||||||
if (!msg->format) {
|
if (!msg->format) {
|
||||||
msg->id = (uint32_t)0x000007FF & (can->sFIFOMailBox[handle].RIR >> 21);
|
msg->id = (uint32_t)0x000007FF & (can->sFIFOMailBox[handle].RIR >> 21);
|
||||||
} else {
|
} else {
|
||||||
msg->id = (uint32_t)0x1FFFFFFF & (can->sFIFOMailBox[handle].RIR >> 3);
|
msg->id = (uint32_t)0x1FFFFFFF & (can->sFIFOMailBox[handle].RIR >> 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg->type = (CANType)((uint8_t)0x02 & can->sFIFOMailBox[handle].RIR);
|
msg->type = (CANType)(((uint8_t)0x02 & can->sFIFOMailBox[handle].RIR) >> 1);
|
||||||
/* Get the DLC */
|
/* Get the DLC */
|
||||||
msg->len = (uint8_t)0x0F & can->sFIFOMailBox[handle].RDTR;
|
msg->len = (uint8_t)0x0F & can->sFIFOMailBox[handle].RDTR;
|
||||||
/* Get the FMI */
|
/* Get the FMI */
|
||||||
|
@ -460,37 +460,47 @@ static void can_irq(CANName name, int id)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(TARGET_STM32F0)
|
#if defined(TARGET_STM32F0)
|
||||||
void CAN_IRQHandler(void) {
|
void CAN_IRQHandler(void)
|
||||||
|
{
|
||||||
can_irq(CAN_1, 0);
|
can_irq(CAN_1, 0);
|
||||||
}
|
}
|
||||||
#elif defined(TARGET_STM32F3)
|
#elif defined(TARGET_STM32F3)
|
||||||
void CAN_RX0_IRQHandler(void) {
|
void CAN_RX0_IRQHandler(void)
|
||||||
|
{
|
||||||
can_irq(CAN_1, 0);
|
can_irq(CAN_1, 0);
|
||||||
}
|
}
|
||||||
void CAN_TX_IRQHandler(void) {
|
void CAN_TX_IRQHandler(void)
|
||||||
|
{
|
||||||
can_irq(CAN_1, 0);
|
can_irq(CAN_1, 0);
|
||||||
}
|
}
|
||||||
void CAN_SCE_IRQHandler(void) {
|
void CAN_SCE_IRQHandler(void)
|
||||||
|
{
|
||||||
can_irq(CAN_1, 0);
|
can_irq(CAN_1, 0);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void CAN1_RX0_IRQHandler(void) {
|
void CAN1_RX0_IRQHandler(void)
|
||||||
|
{
|
||||||
can_irq(CAN_1, 0);
|
can_irq(CAN_1, 0);
|
||||||
}
|
}
|
||||||
void CAN1_TX_IRQHandler(void) {
|
void CAN1_TX_IRQHandler(void)
|
||||||
|
{
|
||||||
can_irq(CAN_1, 0);
|
can_irq(CAN_1, 0);
|
||||||
}
|
}
|
||||||
void CAN1_SCE_IRQHandler(void) {
|
void CAN1_SCE_IRQHandler(void)
|
||||||
|
{
|
||||||
can_irq(CAN_1, 0);
|
can_irq(CAN_1, 0);
|
||||||
}
|
}
|
||||||
#if defined(CAN2_BASE) && (CAN_NUM == 2)
|
#if defined(CAN2_BASE) && (CAN_NUM == 2)
|
||||||
void CAN2_RX0_IRQHandler(void) {
|
void CAN2_RX0_IRQHandler(void)
|
||||||
|
{
|
||||||
can_irq(CAN_2, 1);
|
can_irq(CAN_2, 1);
|
||||||
}
|
}
|
||||||
void CAN2_TX_IRQHandler(void) {
|
void CAN2_TX_IRQHandler(void)
|
||||||
|
{
|
||||||
can_irq(CAN_2, 1);
|
can_irq(CAN_2, 1);
|
||||||
}
|
}
|
||||||
void CAN2_SCE_IRQHandler(void) {
|
void CAN2_SCE_IRQHandler(void)
|
||||||
|
{
|
||||||
can_irq(CAN_2, 1);
|
can_irq(CAN_2, 1);
|
||||||
}
|
}
|
||||||
#endif // defined(CAN2_BASE) && (CAN_NUM == 2)
|
#endif // defined(CAN2_BASE) && (CAN_NUM == 2)
|
||||||
|
|
Loading…
Reference in New Issue