Skip to content

Don't use define checks on DEVICE_FOO macros (partner code) #9163

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

Merged
merged 1 commit into from
Jan 7, 2019
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/

#ifdef DEVICE_FLASH
#if DEVICE_FLASH
#include "flash_api.h"
#include "flash_data.h"
#include "mbed_critical.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include "adi_gpio_def.h"
#include "ADuCM302x_device.h"

#ifdef DEVICE_INTERRUPTIN
#if DEVICE_INTERRUPTIN

#define MAX_GPIO_LINES 16
#define MAX_GPIO_PORTS ADI_GPIO_NUM_PORTS
Expand Down Expand Up @@ -327,4 +327,4 @@ void gpio_irq_disable(gpio_irq_t *obj)
channel_ids[port][pin_num].int_enable = 0;
}

#endif // #ifdef DEVICE_INTERRUPTIN
#endif // #if DEVICE_INTERRUPTIN
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

#include "sleep_api.h"

#ifdef DEVICE_SLEEP
#if DEVICE_SLEEP

#include "adi_pwr.h"
#include "adi_pwr_def.h"
Expand Down Expand Up @@ -218,4 +218,4 @@ void hal_deepsleep(void)
pADI_CLKG0_CLK->CTL5 = 0;
}

#endif // #ifdef DEVICE_SLEEP
#endif // #if DEVICE_SLEEP
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/

#if defined(DEVICE_TRNG)
#if DEVICE_TRNG

#include <stdlib.h>
#include <drivers/rng/adi_rng.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/

#ifdef DEVICE_FLASH
#if DEVICE_FLASH
#include "flash_api.h"
#include "flash_data.h"
#include "mbed_critical.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include "adi_gpio.h"
#include "adi_gpio_def.h"

#ifdef DEVICE_INTERRUPTIN
#if DEVICE_INTERRUPTIN

#define MAX_GPIO_LINES 16
#define MAX_GPIO_PORTS ADI_GPIO_NUM_PORTS
Expand Down Expand Up @@ -326,4 +326,4 @@ void gpio_irq_disable(gpio_irq_t *obj)
channel_ids[port][pin_num].int_enable = 0;
}

#endif // #ifdef DEVICE_INTERRUPTIN
#endif // #if DEVICE_INTERRUPTIN
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

#include "sleep_api.h"

#ifdef DEVICE_SLEEP
#if DEVICE_SLEEP

#include "adi_pwr.h"
#include "adi_pwr_def.h"
Expand Down Expand Up @@ -253,4 +253,4 @@ void hal_deepsleep(void)
pADI_CLKG0_CLK->CTL5 = 0;
}

#endif // #ifdef DEVICE_SLEEP
#endif // #if DEVICE_SLEEP
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/

#if defined(DEVICE_TRNG)
#if DEVICE_TRNG

#include <stdlib.h>
#include <adi_rng.h>
Expand Down
2 changes: 1 addition & 1 deletion targets/TARGET_Atmel/TARGET_SAM_CortexM0P/serial_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
enable_usart(obj);
}

#ifdef DEVICE_SERIAL_FC
#if DEVICE_SERIAL_FC

void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, PinName txflow)
{
Expand Down
4 changes: 2 additions & 2 deletions targets/TARGET_Atmel/TARGET_SAM_CortexM4/serial_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
sysclk_enable_peripheral_clock(clockid);
}

#ifdef DEVICE_SERIAL_FC
#if DEVICE_SERIAL_FC

void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, PinName txflow)
{
Expand Down Expand Up @@ -783,4 +783,4 @@ void serial_rx_abort_asynch(serial_t *obj)
pSERIAL_S(obj)->actrec = false;
}

#endif
#endif
8 changes: 4 additions & 4 deletions targets/TARGET_Cypress/TARGET_PSOC6/PeripheralPins.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,28 @@ extern const PinMap PinMap_PWM_OUT[];
#endif

//*** SERIAL ***
#ifdef DEVICE_SERIAL
#if DEVICE_SERIAL
extern const PinMap PinMap_UART_TX[];
extern const PinMap PinMap_UART_RX[];
extern const PinMap PinMap_UART_RTS[];
extern const PinMap PinMap_UART_CTS[];
#endif

//*** SPI ***
#ifdef DEVICE_SPI
#if DEVICE_SPI
extern const PinMap PinMap_SPI_MOSI[];
extern const PinMap PinMap_SPI_MISO[];
extern const PinMap PinMap_SPI_SCLK[];
extern const PinMap PinMap_SPI_SSEL[];
#endif

//*** ADC ***
#ifdef DEVICE_ANALOGIN
#if DEVICE_ANALOGIN
extern const PinMap PinMap_ADC[];
#endif

//*** DAC ***
#ifdef DEVICE_ANALOGOUT
#if DEVICE_ANALOGOUT
extern const PinMap PinMap_DAC[];
#endif

Expand Down
6 changes: 3 additions & 3 deletions targets/TARGET_Cypress/TARGET_PSOC6/objects.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ struct pwmout_s {
};
#endif // DEVICE_PWMOUT

#ifdef DEVICE_ANALOGIN
#if DEVICE_ANALOGIN
#include "cy_sar.h"

struct analogin_s {
Expand All @@ -196,7 +196,7 @@ struct analogin_s {
};
#endif // DEVICE_ANALOGIN

#ifdef DEVICE_ANALOGOUT
#if DEVICE_ANALOGOUT
#include "cy_ctdac.h"

struct dac_s {
Expand All @@ -206,7 +206,7 @@ struct dac_s {
};
#endif // DEVICE_ANALOGOUT

#ifdef DEVICE_FLASH
#if DEVICE_FLASH
struct flash_s {
/* nothing to be stored for now */
void *dummy;
Expand Down
2 changes: 1 addition & 1 deletion targets/TARGET_Cypress/TARGET_PSOC6/sleep_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "device.h"
#include "cy_syspm.h"

#ifdef DEVICE_SLEEP
#if DEVICE_SLEEP

void hal_sleep(void)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* Reference: "K66 Sub-Family Reference Manual, Rev. 2", chapter 38
*/

#if defined(DEVICE_TRNG)
#if DEVICE_TRNG

#include <stdlib.h>
#include "cmsis.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

#if defined(DEVICE_TRNG)
#if DEVICE_TRNG

#include <stdlib.h>
#include "cmsis.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* Reference: "MKW41Z/31Z/21Z Reference Manual", chapter 43
*/

#if defined(DEVICE_TRNG)
#if DEVICE_TRNG

#include "fsl_trng.h"
#include "trng_api.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

#if defined(DEVICE_TRNG)
#if DEVICE_TRNG

#include <stdlib.h>
#include "cmsis.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

#if defined(DEVICE_TRNG)
#if DEVICE_TRNG

#include <stdlib.h>
#include "cmsis.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "drivers/fsl_crc.h"
#include "platform/mbed_assert.h"

#ifdef DEVICE_CRC
#if DEVICE_CRC

static crc_bits_t width;
static uint32_t final_xor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* Reference: "K64 Sub-Family Reference Manual, Rev. 2", chapter 34
*/

#if defined(DEVICE_TRNG)
#if DEVICE_TRNG

#include <stdlib.h>
#include "cmsis.h"
Expand Down
12 changes: 6 additions & 6 deletions targets/TARGET_GigaDevice/TARGET_GD32F30X/PeripheralPins.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ extern const int GD_GPIO_MODE[];
extern const int GD_GPIO_SPEED[];

/* ADC */
#ifdef DEVICE_ANALOGIN
#if DEVICE_ANALOGIN
extern const PinMap PinMap_ADC[];
#endif

/* DAC */
#ifdef DEVICE_ANALOGOUT
#if DEVICE_ANALOGOUT
extern const PinMap PinMap_DAC[];
#endif

Expand All @@ -48,25 +48,25 @@ extern const PinMap PinMap_PWM[];
#endif

/* SERIAL */
#ifdef DEVICE_SERIAL
#if DEVICE_SERIAL
extern const PinMap PinMap_UART_TX[];
extern const PinMap PinMap_UART_RX[];
#ifdef DEVICE_SERIAL_FC
#if DEVICE_SERIAL_FC
extern const PinMap PinMap_UART_RTS[];
extern const PinMap PinMap_UART_CTS[];
#endif
#endif

/* SPI */
#ifdef DEVICE_SPI
#if DEVICE_SPI
extern const PinMap PinMap_SPI_MOSI[];
extern const PinMap PinMap_SPI_MISO[];
extern const PinMap PinMap_SPI_SCLK[];
extern const PinMap PinMap_SPI_SSEL[];
#endif

/* CAN */
#ifdef DEVICE_CAN
#if DEVICE_CAN
extern const PinMap PinMap_CAN_RD[];
extern const PinMap PinMap_CAN_TD[];
#endif
Expand Down
2 changes: 1 addition & 1 deletion targets/TARGET_Maxim/TARGET_MAX32600/rtc_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void rtc_init(void)
MXC_PWRSEQ->reg0 |= MXC_F_PWRSEQ_REG0_PWR_RTCEN_RUN;

// Prepare interrupt handlers
#ifdef DEVICE_LPTICKER
#if DEVICE_LPTICKER
NVIC_SetVector(RTC0_IRQn, (uint32_t)lp_ticker_irq_handler);
NVIC_EnableIRQ(RTC0_IRQn);
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "pinmap.h"
#include "nrf_drv_adc.h"

#ifdef DEVICE_ANALOGIN
#if DEVICE_ANALOGIN


#define ADC_10BIT_RANGE 0x3FF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*
*/

#if (defined(DEVICE_FLASH) && defined(DEVICE_LPTICKER))
#if DEVICE_FLASH && DEVICE_LPTICKER

#include "hal/flash_api.h"
#include "hal/lp_ticker_api.h"
Expand Down
2 changes: 1 addition & 1 deletion targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/i2c_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

#include "i2c_api.h"

#if (defined(DEVICE_I2C) && defined(DEVICE_LPTICKER))
#if DEVICE_I2C && DEVICE_LPTICKER

#include "mbed_assert.h"
#include "mbed_error.h"
Expand Down
2 changes: 1 addition & 1 deletion targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/trng_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*
*/

#if (defined(DEVICE_TRNG) && defined(DEVICE_LPTICKER))
#if DEVICE_TRNG && DEVICE_LPTICKER

#include "hal/trng_api.h"
#include "hal/lp_ticker_api.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ void SystemInit(void)
*
* The ITM has to be initialized before the SoftDevice which weren't guaranteed using the normal API.
*/
#if defined (DEVICE_ITM)
#if DEVICE_ITM
/* Enable SWO trace functionality */
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
NRF_CLOCK->TRACECONFIG |= CLOCK_TRACECONFIG_TRACEMUX_Serial << CLOCK_TRACECONFIG_TRACEMUX_Pos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ void SystemInit(void)
*
* The ITM has to be initialized before the SoftDevice which weren't guaranteed using the normal API.
*/
#if defined (DEVICE_ITM)
#if DEVICE_ITM
/* Enable SWO trace functionality */
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
NRF_CLOCK->TRACECONFIG |= CLOCK_TRACECONFIG_TRACEMUX_Serial << CLOCK_TRACECONFIG_TRACEMUX_Pos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#ifdef DEVICE_ANALOGIN
#if DEVICE_ANALOGIN
#include "hal/analogin_api.h"

#include "pinmap.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*
*/

#if (defined(DEVICE_FLASH) && defined(DEVICE_LPTICKER))
#if DEVICE_FLASH && DEVICE_LPTICKER

#include "hal/flash_api.h"
#include "hal/lp_ticker_api.h"
Expand Down
2 changes: 1 addition & 1 deletion targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/i2c_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*
*/

#if (defined(DEVICE_I2C) && defined(DEVICE_LPTICKER))
#if DEVICE_I2C && DEVICE_LPTICKER
/* I2C
*
* This HAL implementation uses the nrf_drv_twi.h API primarily but switches to TWI for the
Expand Down
2 changes: 1 addition & 1 deletion targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/itm_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#if defined(DEVICE_ITM)
#if DEVICE_ITM

#include "hal/itm_api.h"

Expand Down
Loading