commit dada2194ad887b7cd1e8266e2f89eee60da3cba5
Author: Thomas Schöpping <tschoepp@cit-ec.uni-bielefeld.de>
Date:   Wed Jan 23 11:06:24 2019 +0100

    Introduced a macro AOS_IOEVENT_FLAG() in aos_types.h.
    This macro acts similar to EVENT_MASK() and should help to simplify development.
    The new macro was applied to existing code wherever possible.

diff --git a/core/inc/aos_types.h b/core/inc/aos_types.h
index dd8585b..6925a0a 100644
--- a/core/inc/aos_types.h
+++ b/core/inc/aos_types.h
@@ -28,6 +28,11 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #define _AMIROOS_TYPES_H_
 
 /**
+ * @brief   Converts a GPIO pad number to a unique event flag.
+ */
+#define AOS_IOEVENT_FLAG(pad)                   ((eventflags_t)1 << pad)
+
+/**
  * @brief   Error codes used in AMiRo-OS.
  */
 typedef enum {
diff --git a/core/src/aos_system.c b/core/src/aos_system.c
index 2c14a6a..e40d1ec 100644
--- a/core/src/aos_system.c
+++ b/core/src/aos_system.c
@@ -645,7 +645,7 @@ static void _intCallback(void* args)
   aosDbgCheck((args != NULL) && (*((iopadid_t*)args) < sizeof(eventflags_t) * 8));
 
   chSysLockFromISR();
-  chEvtBroadcastFlagsI(&aos.events.io, (eventflags_t)1 << *((iopadid_t*)args));
+  chEvtBroadcastFlagsI(&aos.events.io, AOS_IOEVENT_FLAG(*((iopadid_t*)args)));
   chSysUnlockFromISR();
 
   return;
@@ -689,7 +689,7 @@ static void _signalSyncCallback(void *args)
     }
   }
   // broadcast event
-  chEvtBroadcastFlagsI(&aos.events.io, (eventflags_t)1 << *((iopadid_t*)args));
+  chEvtBroadcastFlagsI(&aos.events.io, AOS_IOEVENT_FLAG(*((iopadid_t*)args)));
   chSysUnlockFromISR();
 
   return;
diff --git a/modules/DiWheelDrive_1-1/module.h b/modules/DiWheelDrive_1-1/module.h
index 956c186..966d1ee 100644
--- a/modules/DiWheelDrive_1-1/module.h
+++ b/modules/DiWheelDrive_1-1/module.h
@@ -243,52 +243,52 @@ extern ROMCONST apalControlGpio_t moduleGpioSysWarmrst;
 /**
  * @brief   Event flag to be set on a SYS_SYNC interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSSYNC          ((eventflags_t)1 << GPIOC_SYS_INT_N)
+#define MODULE_OS_IOEVENTFLAGS_SYSSYNC          AOS_IOEVENT_FLAG(GPIOC_SYS_INT_N)
 
 /**
  * @brief   Event flag to be set on a SYS_WARMRST interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSWARMRST       ((eventflags_t)1 << GPIOD_SYS_WARMRST_N)
+#define MODULE_OS_IOEVENTFLAGS_SYSWARMRST       AOS_IOEVENT_FLAG(GPIOD_SYS_WARMRST_N)
 
 /**
  * @brief   Event flag to be set on a PATH_DCSTAT interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_PATHDCSTAT       ((eventflags_t)1 << GPIOC_PATH_DCEN)
+#define MODULE_OS_IOEVENTFLAGS_PATHDCSTAT       AOS_IOEVENT_FLAG(GPIOC_PATH_DCEN)
 
 /**
  * @brief   Event flag to be set on a COMPASS_DRDY interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_COMPASSDRDY      ((eventflags_t)1 << GPIOB_COMPASS_DRDY)
+#define MODULE_OS_IOEVENTFLAGS_COMPASSDRDY      AOS_IOEVENT_FLAG(GPIOB_COMPASS_DRDY)
 
 /**
  * @brief   Event flag to be set on a SYS_PD interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSPD            ((eventflags_t)1 << GPIOC_SYS_PD_N)
+#define MODULE_OS_IOEVENTFLAGS_SYSPD            AOS_IOEVENT_FLAG(GPIOC_SYS_PD_N)
 
 /**
  * @brief   Event flag to be set on a SYS_REG_EN interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSREGEN         ((eventflags_t)1 << GPIOC_SYS_REG_EN)
+#define MODULE_OS_IOEVENTFLAGS_SYSREGEN         AOS_IOEVENT_FLAG(GPIOC_SYS_REG_EN)
 
 /**
  * @brief   Event flag to be set on a IR_INT interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_IRINT            ((eventflags_t)1 << GPIOB_IR_INT)
+#define MODULE_OS_IOEVENTFLAGS_IRINT            AOS_IOEVENT_FLAG(GPIOB_IR_INT)
 
 /**
  * @brief   Event flag to be set on a GYRO_DRDY interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_GYRODRDY         ((eventflags_t)1 << GPIOB_GYRO_DRDY)
+#define MODULE_OS_IOEVENTFLAGS_GYRODRDY         AOS_IOEVENT_FLAG(GPIOB_GYRO_DRDY)
 
 /**
  * @brief   Event flag to be set on a SYS_UART_UP interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSUARTUP        ((eventflags_t)1 << GPIOB_SYS_UART_UP)
+#define MODULE_OS_IOEVENTFLAGS_SYSUARTUP        AOS_IOEVENT_FLAG(GPIOB_SYS_UART_UP)
 
 /**
  * @brief   Event flag to be set on a ACCEL_INT interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_ACCELINT         ((eventflags_t)1 << GPIOB_ACCEL_INT_N)
+#define MODULE_OS_IOEVENTFLAGS_ACCELINT         AOS_IOEVENT_FLAG(GPIOB_ACCEL_INT_N)
 
 #if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__)
 /**
diff --git a/modules/LightRing_1-0/module.h b/modules/LightRing_1-0/module.h
index b428bc7..8e949b7 100644
--- a/modules/LightRing_1-0/module.h
+++ b/modules/LightRing_1-0/module.h
@@ -158,32 +158,32 @@ extern ROMCONST apalControlGpio_t moduleGpioSysSync;
 /**
  * @brief   Event flag to be set on a LASER_OC interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_LASEROC          ((eventflags_t)1 << GPIOB_LASER_OC_N)
+#define MODULE_OS_IOEVENTFLAGS_LASEROC          AOS_IOEVENT_FLAG(GPIOB_LASER_OC_N)
 
 /**
  * @brief   Event flag to be set on a SYS_UART_DN interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSUARTDN        ((eventflags_t)1 << GPIOB_SYS_UART_DN)
+#define MODULE_OS_IOEVENTFLAGS_SYSUARTDN        AOS_IOEVENT_FLAG(GPIOB_SYS_UART_DN)
 
 /**
  * @brief   Event flag to be set on a WL_GDO2 interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_WLGDO2           ((eventflags_t)1 << GPIOB_WL_GDO2)
+#define MODULE_OS_IOEVENTFLAGS_WLGDO2           AOS_IOEVENT_FLAG(GPIOB_WL_GDO2)
 
 /**
  * @brief   Event flag to be set on a WL_GDO0 interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_WLGDO0           ((eventflags_t)1 << GPIOB_WL_GDO0)
+#define MODULE_OS_IOEVENTFLAGS_WLGDO0           AOS_IOEVENT_FLAG(GPIOB_WL_GDO0)
 
 /**
  * @brief   Event flag to be set on a SYS_PD interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSPD            ((eventflags_t)1 << GPIOC_SYS_PD_N)
+#define MODULE_OS_IOEVENTFLAGS_SYSPD            AOS_IOEVENT_FLAG(GPIOC_SYS_PD_N)
 
 /**
  * @brief   Event flag to be set on a SYS_SYNC interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSSYNC          ((eventflags_t)1 << GPIOD_SYS_INT_N)
+#define MODULE_OS_IOEVENTFLAGS_SYSSYNC          AOS_IOEVENT_FLAG(GPIOD_SYS_INT_N)
 
 #if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__)
 /**
diff --git a/modules/PowerManagement_1-1/module.h b/modules/PowerManagement_1-1/module.h
index 209474f..b561cf5 100644
--- a/modules/PowerManagement_1-1/module.h
+++ b/modules/PowerManagement_1-1/module.h
@@ -317,72 +317,72 @@ extern ROMCONST apalControlGpio_t moduleGpioChargeEn2;
 /**
  * @brief   Event flag to be set on a IR_INT1 / CHARGE_STAT1A interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_IRINT1           ((eventflags_t)1 << GPIOB_IR_INT1_N)
+#define MODULE_OS_IOEVENTFLAGS_IRINT1           AOS_IOEVENT_FLAG(GPIOB_IR_INT1_N)
 
 /**
  * @brief   Event flag to be set on a GAUGE_BATLOW1 interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_GAUGEBATLOW1     ((eventflags_t)1 << GPIOC_GAUGE_BATLOW1)
+#define MODULE_OS_IOEVENTFLAGS_GAUGEBATLOW1     AOS_IOEVENT_FLAG(GPIOC_GAUGE_BATLOW1)
 
 /**
  * @brief   Event flag to be set on a GAUGE_BATGD1 interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_GAUGEBATGD1      ((eventflags_t)1 << GPIOC_GAUGE_BATGD1_N)
+#define MODULE_OS_IOEVENTFLAGS_GAUGEBATGD1      AOS_IOEVENT_FLAG(GPIOC_GAUGE_BATGD1_N)
 
 /**
  * @brief   Event flag to be set on a SYS_UART_DN interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSUARTDN        ((eventflags_t)1 << GPIOB_SYS_UART_DN)
+#define MODULE_OS_IOEVENTFLAGS_SYSUARTDN        AOS_IOEVENT_FLAG(GPIOB_SYS_UART_DN)
 
 /**
  * @brief   Event flag to be set on a IR_INT2 / CHARGE_STAT2A interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_IRINT2           ((eventflags_t)1 << GPIOC_IR_INT2_N)
+#define MODULE_OS_IOEVENTFLAGS_IRINT2           AOS_IOEVENT_FLAG(GPIOC_IR_INT2_N)
 
 /**
  * @brief   Event flag to be set on a TOUCH_INT interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_TOUCHINT         ((eventflags_t)1 << GPIOC_TOUCH_INT_N)
+#define MODULE_OS_IOEVENTFLAGS_TOUCHINT         AOS_IOEVENT_FLAG(GPIOC_TOUCH_INT_N)
 
 /**
  * @brief   Event flag to be set on a GAUGE_BATLOW2 interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_GAUGEBATLOW2     ((eventflags_t)1 << GPIOB_GAUGE_BATLOW2)
+#define MODULE_OS_IOEVENTFLAGS_GAUGEBATLOW2     AOS_IOEVENT_FLAG(GPIOB_GAUGE_BATLOW2)
 
 /**
  * @brief   Event flag to be set on a GAUGE_BATGD2 interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_GAUGEBATGD2      ((eventflags_t)1 << GPIOB_GAUGE_BATGD2_N)
+#define MODULE_OS_IOEVENTFLAGS_GAUGEBATGD2      AOS_IOEVENT_FLAG(GPIOB_GAUGE_BATGD2_N)
 
 /**
  * @brief   Event flag to be set on a PATH_DC interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_PATHDC           ((eventflags_t)1 << GPIOC_PATH_DC)
+#define MODULE_OS_IOEVENTFLAGS_PATHDC           AOS_IOEVENT_FLAG(GPIOC_PATH_DC)
 
 /**
  * @brief   Event flag to be set on a SYS_SPI_DIR interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSSPIDIR        ((eventflags_t)1 << GPIOC_SYS_SPI_DIR)
+#define MODULE_OS_IOEVENTFLAGS_SYSSPIDIR        AOS_IOEVENT_FLAG(GPIOC_SYS_SPI_DIR)
 
 /**
  * @brief   Event flag to be set on a SYS_SYNC interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSSYNC          ((eventflags_t)1 << GPIOC_SYS_INT_N)
+#define MODULE_OS_IOEVENTFLAGS_SYSSYNC          AOS_IOEVENT_FLAG(GPIOC_SYS_INT_N)
 
 /**
  * @brief   Event flag to be set on a SYS_PD interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSPD            ((eventflags_t)1 << GPIOC_SYS_PD_N)
+#define MODULE_OS_IOEVENTFLAGS_SYSPD            AOS_IOEVENT_FLAG(GPIOC_SYS_PD_N)
 
 /**
  * @brief   Event flag to be set on a SYS_WARMRST interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSWARMRST       ((eventflags_t)1 << GPIOC_SYS_WARMRST_N)
+#define MODULE_OS_IOEVENTFLAGS_SYSWARMRST       AOS_IOEVENT_FLAG(GPIOC_SYS_WARMRST_N)
 
 /**
  * @brief   Event flag to be set on a SYS_UART_UP interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSUARTUP        ((eventflags_t)1 << GPIOB_SYS_UART_UP)
+#define MODULE_OS_IOEVENTFLAGS_SYSUARTUP        AOS_IOEVENT_FLAG(GPIOB_SYS_UART_UP)
 
 #if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__)
 /**
diff --git a/modules/STM32F4Discovery/module.h b/modules/STM32F4Discovery/module.h
index d2700f5..d29974c 100644
--- a/modules/STM32F4Discovery/module.h
+++ b/modules/STM32F4Discovery/module.h
@@ -143,7 +143,7 @@ extern ROMCONST apalControlGpio_t moduleGpioUserButton;
 /**
  * @brief   Event flag to be set on a USER_BUTTON interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_USERBUTTON       ((eventflags_t)1 << GPIOA_BUTTON)
+#define MODULE_OS_IOEVENTFLAGS_USERBUTTON       AOS_IOEVENT_FLAG(GPIOA_BUTTON)
 
 #if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__)
 /**
