Skip to content

Commit aa80b7c

Browse files
committed
Don't use define checks on DEVICE_FOO macros (partner code)
The DEVICE_FOO macros are always defined (either 0 or 1). This patch replaces any instances of a define check on a DEVICE_FOO macro with value test instead. Signed-off-by: Alastair D'Silva <[email protected]>
1 parent 442cbba commit aa80b7c

File tree

92 files changed

+127
-138
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+127
-138
lines changed

targets/TARGET_Analog_Devices/TARGET_ADUCM302X/TARGET_ADUCM3029/api/flash_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* POSSIBILITY OF SUCH DAMAGE.
3939
******************************************************************************/
4040

41-
#ifdef DEVICE_FLASH
41+
#if DEVICE_FLASH
4242
#include "flash_api.h"
4343
#include "flash_data.h"
4444
#include "mbed_critical.h"

targets/TARGET_Analog_Devices/TARGET_ADUCM302X/TARGET_ADUCM3029/api/gpio_irq_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#include "adi_gpio_def.h"
4444
#include "ADuCM302x_device.h"
4545

46-
#ifdef DEVICE_INTERRUPTIN
46+
#if DEVICE_INTERRUPTIN
4747

4848
#define MAX_GPIO_LINES 16
4949
#define MAX_GPIO_PORTS ADI_GPIO_NUM_PORTS
@@ -327,4 +327,4 @@ void gpio_irq_disable(gpio_irq_t *obj)
327327
channel_ids[port][pin_num].int_enable = 0;
328328
}
329329

330-
#endif // #ifdef DEVICE_INTERRUPTIN
330+
#endif // #if DEVICE_INTERRUPTIN

targets/TARGET_Analog_Devices/TARGET_ADUCM302X/TARGET_ADUCM3029/api/sleep.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
#include "sleep_api.h"
4242

43-
#ifdef DEVICE_SLEEP
43+
#if DEVICE_SLEEP
4444

4545
#include "adi_pwr.h"
4646
#include "adi_pwr_def.h"
@@ -218,4 +218,4 @@ void hal_deepsleep(void)
218218
pADI_CLKG0_CLK->CTL5 = 0;
219219
}
220220

221-
#endif // #ifdef DEVICE_SLEEP
221+
#endif // #if DEVICE_SLEEP

targets/TARGET_Analog_Devices/TARGET_ADUCM302X/TARGET_ADUCM3029/api/trng_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* POSSIBILITY OF SUCH DAMAGE.
3939
******************************************************************************/
4040

41-
#if defined(DEVICE_TRNG)
41+
#if DEVICE_TRNG
4242

4343
#include <stdlib.h>
4444
#include <drivers/rng/adi_rng.h>

targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/api/flash_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* POSSIBILITY OF SUCH DAMAGE.
3939
******************************************************************************/
4040

41-
#ifdef DEVICE_FLASH
41+
#if DEVICE_FLASH
4242
#include "flash_api.h"
4343
#include "flash_data.h"
4444
#include "mbed_critical.h"

targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/api/gpio_irq_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#include "adi_gpio.h"
4343
#include "adi_gpio_def.h"
4444

45-
#ifdef DEVICE_INTERRUPTIN
45+
#if DEVICE_INTERRUPTIN
4646

4747
#define MAX_GPIO_LINES 16
4848
#define MAX_GPIO_PORTS ADI_GPIO_NUM_PORTS
@@ -326,4 +326,4 @@ void gpio_irq_disable(gpio_irq_t *obj)
326326
channel_ids[port][pin_num].int_enable = 0;
327327
}
328328

329-
#endif // #ifdef DEVICE_INTERRUPTIN
329+
#endif // #if DEVICE_INTERRUPTIN

targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/api/sleep.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
#include "sleep_api.h"
4242

43-
#ifdef DEVICE_SLEEP
43+
#if DEVICE_SLEEP
4444

4545
#include "adi_pwr.h"
4646
#include "adi_pwr_def.h"
@@ -253,4 +253,4 @@ void hal_deepsleep(void)
253253
pADI_CLKG0_CLK->CTL5 = 0;
254254
}
255255

256-
#endif // #ifdef DEVICE_SLEEP
256+
#endif // #if DEVICE_SLEEP

targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/api/trng_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* POSSIBILITY OF SUCH DAMAGE.
3939
******************************************************************************/
4040

41-
#if defined(DEVICE_TRNG)
41+
#if DEVICE_TRNG
4242

4343
#include <stdlib.h>
4444
#include <adi_rng.h>

targets/TARGET_Atmel/TARGET_SAM_CortexM0P/serial_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
503503
enable_usart(obj);
504504
}
505505

506-
#ifdef DEVICE_SERIAL_FC
506+
#if DEVICE_SERIAL_FC
507507

508508
void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, PinName txflow)
509509
{

targets/TARGET_Atmel/TARGET_SAM_CortexM4/serial_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
283283
sysclk_enable_peripheral_clock(clockid);
284284
}
285285

286-
#ifdef DEVICE_SERIAL_FC
286+
#if DEVICE_SERIAL_FC
287287

288288
void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, PinName txflow)
289289
{
@@ -783,4 +783,4 @@ void serial_rx_abort_asynch(serial_t *obj)
783783
pSERIAL_S(obj)->actrec = false;
784784
}
785785

786-
#endif
786+
#endif

targets/TARGET_Cypress/TARGET_PSOC6/PeripheralPins.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,28 @@ extern const PinMap PinMap_PWM_OUT[];
3434
#endif
3535

3636
//*** SERIAL ***
37-
#ifdef DEVICE_SERIAL
37+
#if DEVICE_SERIAL
3838
extern const PinMap PinMap_UART_TX[];
3939
extern const PinMap PinMap_UART_RX[];
4040
extern const PinMap PinMap_UART_RTS[];
4141
extern const PinMap PinMap_UART_CTS[];
4242
#endif
4343

4444
//*** SPI ***
45-
#ifdef DEVICE_SPI
45+
#if DEVICE_SPI
4646
extern const PinMap PinMap_SPI_MOSI[];
4747
extern const PinMap PinMap_SPI_MISO[];
4848
extern const PinMap PinMap_SPI_SCLK[];
4949
extern const PinMap PinMap_SPI_SSEL[];
5050
#endif
5151

5252
//*** ADC ***
53-
#ifdef DEVICE_ANALOGIN
53+
#if DEVICE_ANALOGIN
5454
extern const PinMap PinMap_ADC[];
5555
#endif
5656

5757
//*** DAC ***
58-
#ifdef DEVICE_ANALOGOUT
58+
#if DEVICE_ANALOGOUT
5959
extern const PinMap PinMap_DAC[];
6060
#endif
6161

targets/TARGET_Cypress/TARGET_PSOC6/objects.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ struct pwmout_s {
185185
};
186186
#endif // DEVICE_PWMOUT
187187

188-
#ifdef DEVICE_ANALOGIN
188+
#if DEVICE_ANALOGIN
189189
#include "cy_sar.h"
190190

191191
struct analogin_s {
@@ -196,7 +196,7 @@ struct analogin_s {
196196
};
197197
#endif // DEVICE_ANALOGIN
198198

199-
#ifdef DEVICE_ANALOGOUT
199+
#if DEVICE_ANALOGOUT
200200
#include "cy_ctdac.h"
201201

202202
struct dac_s {
@@ -206,7 +206,7 @@ struct dac_s {
206206
};
207207
#endif // DEVICE_ANALOGOUT
208208

209-
#ifdef DEVICE_FLASH
209+
#if DEVICE_FLASH
210210
struct flash_s {
211211
/* nothing to be stored for now */
212212
void *dummy;

targets/TARGET_Cypress/TARGET_PSOC6/sleep_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "device.h"
2020
#include "cy_syspm.h"
2121

22-
#ifdef DEVICE_SLEEP
22+
#if DEVICE_SLEEP
2323

2424
void hal_sleep(void)
2525
{

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K66F/trng_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* Reference: "K66 Sub-Family Reference Manual, Rev. 2", chapter 38
2323
*/
2424

25-
#if defined(DEVICE_TRNG)
25+
#if DEVICE_TRNG
2626

2727
#include <stdlib.h>
2828
#include "cmsis.h"

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KW24D/trng_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*
1919
*/
2020

21-
#if defined(DEVICE_TRNG)
21+
#if DEVICE_TRNG
2222

2323
#include <stdlib.h>
2424
#include "cmsis.h"

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KW41Z/trng_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* Reference: "MKW41Z/31Z/21Z Reference Manual", chapter 43
2323
*/
2424

25-
#if defined(DEVICE_TRNG)
25+
#if DEVICE_TRNG
2626

2727
#include "fsl_trng.h"
2828
#include "trng_api.h"

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K22F/trng_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*
1919
*/
2020

21-
#if defined(DEVICE_TRNG)
21+
#if DEVICE_TRNG
2222

2323
#include <stdlib.h>
2424
#include "cmsis.h"

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K24F/trng_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*
1919
*/
2020

21-
#if defined(DEVICE_TRNG)
21+
#if DEVICE_TRNG
2222

2323
#include <stdlib.h>
2424
#include "cmsis.h"

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/mbed_crc_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include "drivers/fsl_crc.h"
1919
#include "platform/mbed_assert.h"
2020

21-
#ifdef DEVICE_CRC
21+
#if DEVICE_CRC
2222

2323
static crc_bits_t width;
2424
static uint32_t final_xor;

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/trng_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* Reference: "K64 Sub-Family Reference Manual, Rev. 2", chapter 34
2323
*/
2424

25-
#if defined(DEVICE_TRNG)
25+
#if DEVICE_TRNG
2626

2727
#include <stdlib.h>
2828
#include "cmsis.h"

targets/TARGET_GigaDevice/TARGET_GD32F30X/PeripheralPins.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ extern const int GD_GPIO_MODE[];
2727
extern const int GD_GPIO_SPEED[];
2828

2929
/* ADC */
30-
#ifdef DEVICE_ANALOGIN
30+
#if DEVICE_ANALOGIN
3131
extern const PinMap PinMap_ADC[];
3232
#endif
3333

3434
/* DAC */
35-
#ifdef DEVICE_ANALOGOUT
35+
#if DEVICE_ANALOGOUT
3636
extern const PinMap PinMap_DAC[];
3737
#endif
3838

@@ -48,25 +48,25 @@ extern const PinMap PinMap_PWM[];
4848
#endif
4949

5050
/* SERIAL */
51-
#ifdef DEVICE_SERIAL
51+
#if DEVICE_SERIAL
5252
extern const PinMap PinMap_UART_TX[];
5353
extern const PinMap PinMap_UART_RX[];
54-
#ifdef DEVICE_SERIAL_FC
54+
#if DEVICE_SERIAL_FC
5555
extern const PinMap PinMap_UART_RTS[];
5656
extern const PinMap PinMap_UART_CTS[];
5757
#endif
5858
#endif
5959

6060
/* SPI */
61-
#ifdef DEVICE_SPI
61+
#if DEVICE_SPI
6262
extern const PinMap PinMap_SPI_MOSI[];
6363
extern const PinMap PinMap_SPI_MISO[];
6464
extern const PinMap PinMap_SPI_SCLK[];
6565
extern const PinMap PinMap_SPI_SSEL[];
6666
#endif
6767

6868
/* CAN */
69-
#ifdef DEVICE_CAN
69+
#if DEVICE_CAN
7070
extern const PinMap PinMap_CAN_RD[];
7171
extern const PinMap PinMap_CAN_TD[];
7272
#endif

targets/TARGET_Maxim/TARGET_MAX32600/rtc_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void rtc_init(void)
7474
MXC_PWRSEQ->reg0 |= MXC_F_PWRSEQ_REG0_PWR_RTCEN_RUN;
7575

7676
// Prepare interrupt handlers
77-
#ifdef DEVICE_LPTICKER
77+
#if DEVICE_LPTICKER
7878
NVIC_SetVector(RTC0_IRQn, (uint32_t)lp_ticker_irq_handler);
7979
NVIC_EnableIRQ(RTC0_IRQn);
8080
#endif

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/TARGET_MCU_NRF51822_UNIFIED/analogin_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "pinmap.h"
2020
#include "nrf_drv_adc.h"
2121

22-
#ifdef DEVICE_ANALOGIN
22+
#if DEVICE_ANALOGIN
2323

2424

2525
#define ADC_10BIT_RANGE 0x3FF

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/flash_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
*
3737
*/
3838

39-
#if (defined(DEVICE_FLASH) && defined(DEVICE_LPTICKER))
39+
#if DEVICE_FLASH && DEVICE_LPTICKER
4040

4141
#include "hal/flash_api.h"
4242
#include "hal/lp_ticker_api.h"

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/i2c_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
#include "i2c_api.h"
4141

42-
#if (defined(DEVICE_I2C) && defined(DEVICE_LPTICKER))
42+
#if DEVICE_I2C && DEVICE_LPTICKER
4343

4444
#include "mbed_assert.h"
4545
#include "mbed_error.h"

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/trng_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
*
3737
*/
3838

39-
#if (defined(DEVICE_TRNG) && defined(DEVICE_LPTICKER))
39+
#if DEVICE_TRNG && DEVICE_LPTICKER
4040

4141
#include "hal/trng_api.h"
4242
#include "hal/lp_ticker_api.h"

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/device/system_nrf52.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ void SystemInit(void)
222222
*
223223
* The ITM has to be initialized before the SoftDevice which weren't guaranteed using the normal API.
224224
*/
225-
#if defined (DEVICE_ITM)
225+
#if DEVICE_ITM
226226
/* Enable SWO trace functionality */
227227
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
228228
NRF_CLOCK->TRACECONFIG |= CLOCK_TRACECONFIG_TRACEMUX_Serial << CLOCK_TRACECONFIG_TRACEMUX_Pos;

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/system_nrf52840.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ void SystemInit(void)
198198
*
199199
* The ITM has to be initialized before the SoftDevice which weren't guaranteed using the normal API.
200200
*/
201-
#if defined (DEVICE_ITM)
201+
#if DEVICE_ITM
202202
/* Enable SWO trace functionality */
203203
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
204204
NRF_CLOCK->TRACECONFIG |= CLOCK_TRACECONFIG_TRACEMUX_Serial << CLOCK_TRACECONFIG_TRACEMUX_Pos;

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/analogin_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
#ifdef DEVICE_ANALOGIN
17+
#if DEVICE_ANALOGIN
1818
#include "hal/analogin_api.h"
1919

2020
#include "pinmap.h"

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/flash_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
*
3737
*/
3838

39-
#if (defined(DEVICE_FLASH) && defined(DEVICE_LPTICKER))
39+
#if DEVICE_FLASH && DEVICE_LPTICKER
4040

4141
#include "hal/flash_api.h"
4242
#include "hal/lp_ticker_api.h"

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/i2c_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
*
3737
*/
3838

39-
#if (defined(DEVICE_I2C) && defined(DEVICE_LPTICKER))
39+
#if DEVICE_I2C && DEVICE_LPTICKER
4040
/* I2C
4141
*
4242
* This HAL implementation uses the nrf_drv_twi.h API primarily but switches to TWI for the

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/itm_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
#if defined(DEVICE_ITM)
17+
#if DEVICE_ITM
1818

1919
#include "hal/itm_api.h"
2020

0 commit comments

Comments
 (0)