altos/lpc: Add casts to reduce -Wconversion warnings
[fw/altos] / src / lpc / ao_exti_lpc.c
index fdb6a1caa976bef23789dc7aea69669b3b4be550..5722e17d2b887400ae83df7db76de08d9d38d802 100644 (file)
@@ -3,7 +3,8 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -52,7 +53,7 @@ pin_isr(5)
 pin_isr(6)
 pin_isr(7)
 
-#define pin_id(port,pin)       ((port) * 24 + (pin));
+#define pin_id(port,pin)       ((uint8_t) ((port) * 24 + (pin)))
 
 static void
 _ao_exti_set_enable(uint8_t pint)
@@ -82,7 +83,7 @@ void
 ao_exti_setup (uint8_t port, uint8_t pin, uint8_t mode, void (*callback)(void)) {
        uint8_t         id = pin_id(port,pin);
        uint8_t         pint;
-       uint32_t        mask;
+       uint8_t         mask;
        uint8_t         prio;
 
        for (pint = 0; pint < LPC_NUM_PINT; pint++)
@@ -97,7 +98,7 @@ ao_exti_setup (uint8_t port, uint8_t pin, uint8_t mode, void (*callback)(void))
        ao_arch_block_interrupts();
        mask = (1 << pint);
        ao_pint_inuse |= mask;
-       ao_pint_enabled &= ~mask;
+       ao_pint_enabled &= (uint8_t) ~mask;
 
        ao_pint_map[id] = pint;
        ao_exti_callback[pint] = callback;
@@ -108,7 +109,7 @@ ao_exti_setup (uint8_t port, uint8_t pin, uint8_t mode, void (*callback)(void))
        /* Set edge triggered */
        lpc_gpio_pin.isel &= ~mask;
 
-       ao_pint_enabled &= ~mask;
+       ao_pint_enabled &= (uint8_t) ~mask;
        ao_pint_mode[pint] = mode;
        _ao_exti_set_enable(pint);
 
@@ -139,7 +140,7 @@ ao_exti_set_mode(uint8_t port, uint8_t pin, uint8_t mode)
 }
 
 void
-ao_exti_set_callback(uint8_t port, uint8_t pin, void (*callback)()) {
+ao_exti_set_callback(uint8_t port, uint8_t pin, void (*callback)(void)) {
        uint8_t         id = pin_id(port,pin);
        uint8_t         pint = ao_pint_map[id];
 
@@ -166,7 +167,7 @@ ao_exti_disable(uint8_t port, uint8_t pin) {
        uint8_t         mask = 1 << pint;
 
        ao_arch_block_interrupts();
-       ao_pint_enabled &= ~mask;
+       ao_pint_enabled &= (uint8_t) ~mask;
        _ao_exti_set_enable(pint);
        ao_arch_release_interrupts();
 }