Merge pull request #12097 from shuopeng-deng/pr/fix-iar-warnings

cypress target: fix iar warnings
pull/12132/head
Anna Bridge 2019-12-17 16:26:05 +00:00 committed by GitHub
commit 4c68eaecd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 7 deletions

View File

@ -41,7 +41,7 @@ void port_init(port_t *obj, PortName port, int mask, PinDirection dir)
void port_mode(port_t *obj, PinMode mode)
{
gpio_t gpio = {.pin = 0, .direction = obj->direction, .drive_mode = obj->drive_mode};
gpio_t gpio = {.direction = obj->direction, .drive_mode = obj->drive_mode};
for (uint8_t pin = 0; pin < 8; pin++) {
if ((1 << pin) & obj->mask) {
gpio.pin = port_pin(obj->port, pin);
@ -52,7 +52,7 @@ void port_mode(port_t *obj, PinMode mode)
void port_dir(port_t *obj, PinDirection dir)
{
gpio_t gpio = {.pin = 0, .direction = obj->direction, .drive_mode = obj->drive_mode};
gpio_t gpio = {.direction = obj->direction, .drive_mode = obj->drive_mode};
for (uint8_t pin = 0; pin < 8; pin++) {
if ((1 << pin) & obj->mask) {
gpio.pin = port_pin(obj->port, pin);

View File

@ -125,7 +125,6 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
break;
default:
MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_DRIVER_SERIAL, MBED_ERROR_CODE_UNSUPPORTED), "Unsupported parity");
return;
}
cyhal_uart_cfg_t cfg = {
.data_bits = data_bits,
@ -152,11 +151,11 @@ void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable)
static const cyhal_uart_event_t interrupt_mask = (cyhal_uart_event_t)
(CYHAL_UART_IRQ_RX_DONE | CYHAL_UART_IRQ_RX_ERROR | CYHAL_UART_IRQ_RX_NOT_EMPTY);
ser->rx_event_mask = enable
? (ser->rx_event_mask | interrupt_mask)
: (ser->rx_event_mask & ~interrupt_mask);
? (cyhal_uart_event_t)(ser->rx_event_mask | interrupt_mask)
: (cyhal_uart_event_t)(ser->rx_event_mask & ~interrupt_mask);
cyhal_uart_enable_event(&(ser->hal_obj), interrupt_mask, CYHAL_ISR_PRIORITY_DEFAULT, (bool)enable);
} else if (irq == TxIrq) {
static const cyhal_uart_event_t interrupt_mask = CYHAL_UART_IRQ_TX_DONE | CYHAL_UART_IRQ_TX_ERROR | CYHAL_UART_IRQ_TX_EMPTY;
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);
ser->tx_event_mask = enable
? (cyhal_uart_event_t)(ser->tx_event_mask | interrupt_mask)
: (cyhal_uart_event_t)(ser->tx_event_mask & ~interrupt_mask);

View File

@ -45,7 +45,6 @@ SPIName spi_get_peripheral_name(PinName mosi, PinName miso, PinName mclk)
return (SPIName)CYHAL_SCB_BASE_ADDRESSES[map->inst->block_num];
}
MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_DRIVER_SPI, MBED_ERROR_CODE_FAILED_OPERATION), "SPI not found");
return (SPIName)0;
}
static void cy_spi_irq_handler_internal(void *handler_arg, cyhal_spi_event_t event)