Skip to content

Commit 4c68eae

Browse files
authored
Merge pull request #12097 from shuopeng-deng/pr/fix-iar-warnings
cypress target: fix iar warnings
2 parents 298f3f2 + 6f3852d commit 4c68eae

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

targets/TARGET_Cypress/TARGET_PSOC6/cy_port_api.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void port_init(port_t *obj, PortName port, int mask, PinDirection dir)
4141

4242
void port_mode(port_t *obj, PinMode mode)
4343
{
44-
gpio_t gpio = {.pin = 0, .direction = obj->direction, .drive_mode = obj->drive_mode};
44+
gpio_t gpio = {.direction = obj->direction, .drive_mode = obj->drive_mode};
4545
for (uint8_t pin = 0; pin < 8; pin++) {
4646
if ((1 << pin) & obj->mask) {
4747
gpio.pin = port_pin(obj->port, pin);
@@ -52,7 +52,7 @@ void port_mode(port_t *obj, PinMode mode)
5252

5353
void port_dir(port_t *obj, PinDirection dir)
5454
{
55-
gpio_t gpio = {.pin = 0, .direction = obj->direction, .drive_mode = obj->drive_mode};
55+
gpio_t gpio = {.direction = obj->direction, .drive_mode = obj->drive_mode};
5656
for (uint8_t pin = 0; pin < 8; pin++) {
5757
if ((1 << pin) & obj->mask) {
5858
gpio.pin = port_pin(obj->port, pin);

targets/TARGET_Cypress/TARGET_PSOC6/cy_serial_api.c

+3-4
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
125125
break;
126126
default:
127127
MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_DRIVER_SERIAL, MBED_ERROR_CODE_UNSUPPORTED), "Unsupported parity");
128-
return;
129128
}
130129
cyhal_uart_cfg_t cfg = {
131130
.data_bits = data_bits,
@@ -152,11 +151,11 @@ void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable)
152151
static const cyhal_uart_event_t interrupt_mask = (cyhal_uart_event_t)
153152
(CYHAL_UART_IRQ_RX_DONE | CYHAL_UART_IRQ_RX_ERROR | CYHAL_UART_IRQ_RX_NOT_EMPTY);
154153
ser->rx_event_mask = enable
155-
? (ser->rx_event_mask | interrupt_mask)
156-
: (ser->rx_event_mask & ~interrupt_mask);
154+
? (cyhal_uart_event_t)(ser->rx_event_mask | interrupt_mask)
155+
: (cyhal_uart_event_t)(ser->rx_event_mask & ~interrupt_mask);
157156
cyhal_uart_enable_event(&(ser->hal_obj), interrupt_mask, CYHAL_ISR_PRIORITY_DEFAULT, (bool)enable);
158157
} else if (irq == TxIrq) {
159-
static const cyhal_uart_event_t interrupt_mask = CYHAL_UART_IRQ_TX_DONE | CYHAL_UART_IRQ_TX_ERROR | CYHAL_UART_IRQ_TX_EMPTY;
158+
static const cyhal_uart_event_t interrupt_mask = (cyhal_uart_event_t)(CYHAL_UART_IRQ_TX_DONE | CYHAL_UART_IRQ_TX_ERROR | CYHAL_UART_IRQ_TX_EMPTY);
160159
ser->tx_event_mask = enable
161160
? (cyhal_uart_event_t)(ser->tx_event_mask | interrupt_mask)
162161
: (cyhal_uart_event_t)(ser->tx_event_mask & ~interrupt_mask);

targets/TARGET_Cypress/TARGET_PSOC6/cy_spi_api.c

-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ SPIName spi_get_peripheral_name(PinName mosi, PinName miso, PinName mclk)
4545
return (SPIName)CYHAL_SCB_BASE_ADDRESSES[map->inst->block_num];
4646
}
4747
MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_DRIVER_SPI, MBED_ERROR_CODE_FAILED_OPERATION), "SPI not found");
48-
return (SPIName)0;
4948
}
5049

5150
static void cy_spi_irq_handler_internal(void *handler_arg, cyhal_spi_event_t event)

0 commit comments

Comments
 (0)