From 75dd2c22d1a28c6937e854ce37b85b45a3c0c0de Mon Sep 17 00:00:00 2001 From: cyliangtw Date: Fri, 27 Aug 2021 00:46:14 +0800 Subject: [PATCH] Follow Mbed OS coding style of if statement --- targets/TARGET_NUVOTON/TARGET_M451/can_api.c | 9 +++++---- targets/TARGET_NUVOTON/TARGET_M480/can_api.c | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/targets/TARGET_NUVOTON/TARGET_M451/can_api.c b/targets/TARGET_NUVOTON/TARGET_M451/can_api.c index 775f98f8b0..ece4ede7b6 100644 --- a/targets/TARGET_NUVOTON/TARGET_M451/can_api.c +++ b/targets/TARGET_NUVOTON/TARGET_M451/can_api.c @@ -286,14 +286,15 @@ int can_mode(can_t *obj, CanMode mode) int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t handle) { uint32_t numask = mask; - if( numask == 0x0000 ) - { + + if (numask == 0x0000) { return CAN_SetRxMsg((CAN_T *)NU_MODBASE(obj->can), handle, (uint32_t)format, id); } - if( format == CANStandard ) - { + + if (format == CANStandard) { numask = (mask << 18); } + numask = (numask | CAN_IF_MASK2_MDIR_Msk | CAN_IF_MASK2_MXTD_Msk); return CAN_SetRxMsgAndMsk((CAN_T *)NU_MODBASE(obj->can), handle, (uint32_t)format, id, numask); } diff --git a/targets/TARGET_NUVOTON/TARGET_M480/can_api.c b/targets/TARGET_NUVOTON/TARGET_M480/can_api.c index e82ad24911..88d44fca82 100644 --- a/targets/TARGET_NUVOTON/TARGET_M480/can_api.c +++ b/targets/TARGET_NUVOTON/TARGET_M480/can_api.c @@ -330,14 +330,15 @@ int can_mode(can_t *obj, CanMode mode) int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t handle) { uint32_t numask = mask; - if( numask == 0x0000 ) - { + + if (numask == 0x0000) { return CAN_SetRxMsg((CAN_T *)NU_MODBASE(obj->can), handle, (uint32_t)format, id); } - if( format == CANStandard ) - { + + if (format == CANStandard) { numask = (mask << 18); } + numask = (numask | CAN_IF_MASK2_MDIR_Msk | CAN_IF_MASK2_MXTD_Msk); return CAN_SetRxMsgAndMsk((CAN_T *)NU_MODBASE(obj->can), handle, (uint32_t)format, id, numask); }