From 57d3a14e0f982fc935fac03078589528100774fe Mon Sep 17 00:00:00 2001 From: David Lin Date: Thu, 13 Feb 2020 22:35:57 +0800 Subject: [PATCH 1/2] Minor optimisation to mcr20a-rf-driver code This is a minor optimisation to the mcr20a-rf-driver code: 1. The function parameter is 'uint8_t *byteArray', (byteArray == NULL) instead of using (byteArray == 0). The code is more readable. --- .../802.15.4_RF/mcr20a-rf-driver/source/MCR20Drv.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/components/802.15.4_RF/mcr20a-rf-driver/source/MCR20Drv.c b/components/802.15.4_RF/mcr20a-rf-driver/source/MCR20Drv.c index dc99f2d1b3..bbd0d46b96 100644 --- a/components/802.15.4_RF/mcr20a-rf-driver/source/MCR20Drv.c +++ b/components/802.15.4_RF/mcr20a-rf-driver/source/MCR20Drv.c @@ -165,7 +165,7 @@ void MCR20Drv_DirectAccessSPIMultiByteWrite { uint8_t txData; - if ((numOfBytes == 0) || (byteArray == 0)) { + if ((numOfBytes == 0) || (byteArray == NULL)) { return; } @@ -230,7 +230,7 @@ void MCR20Drv_PB_SPIBurstWrite { uint8_t txData; - if ((numOfBytes == 0) || (byteArray == 0)) { + if ((numOfBytes == 0) || (byteArray == NULL)) { return; } @@ -301,7 +301,7 @@ uint8_t MCR20Drv_DirectAccessSPIMultiByteRead uint8_t txData; uint8_t phyIRQSTS1; - if ((numOfBytes == 0) || (byteArray == 0)) { + if ((numOfBytes == 0) || (byteArray == NULL)) { return 0; } @@ -338,7 +338,7 @@ uint8_t MCR20Drv_PB_SPIBurstRead uint8_t txData; uint8_t phyIRQSTS1; - if ((numOfBytes == 0) || (byteArray == 0)) { + if ((numOfBytes == 0) || (byteArray == NULL)) { return 0; } @@ -406,7 +406,7 @@ void MCR20Drv_IndirectAccessSPIMultiByteWrite { uint16_t txData; - if ((numOfBytes == 0) || (byteArray == 0)) { + if ((numOfBytes == 0) || (byteArray == NULL)) { return; } @@ -473,7 +473,7 @@ void MCR20Drv_IndirectAccessSPIMultiByteRead { uint16_t txData; - if ((numOfBytes == 0) || (byteArray == 0)) { + if ((numOfBytes == 0) || (byteArray == NULL)) { return; } From f1c479651f80a7a6ec8f6538e6dc41a92f158559 Mon Sep 17 00:00:00 2001 From: David Lin Date: Tue, 18 Feb 2020 20:00:00 +0800 Subject: [PATCH 2/2] Minor optimisation to mcr20a-rf-driver code This is a minor optimisation to the mcr20a-rf-driver code: Note that function parameter is pointer. The code is more readable when 'NULL' instead of using '0'. --- components/802.15.4_RF/mcr20a-rf-driver/source/MCR20Drv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/components/802.15.4_RF/mcr20a-rf-driver/source/MCR20Drv.c b/components/802.15.4_RF/mcr20a-rf-driver/source/MCR20Drv.c index bbd0d46b96..90633a0205 100644 --- a/components/802.15.4_RF/mcr20a-rf-driver/source/MCR20Drv.c +++ b/components/802.15.4_RF/mcr20a-rf-driver/source/MCR20Drv.c @@ -45,6 +45,7 @@ #if defined(MBED_CONF_NANOSTACK_CONFIGURATION) && DEVICE_SPI && DEVICE_INTERRUPTIN && defined(MBED_CONF_RTOS_PRESENT) #include "platform/mbed_critical.h" +#include /***************************************************************************** * PRIVATE VARIABLES *