commit 0128be0f68f5fbdd8965cec028d6ebbac4658227
Author: Marc Rothmann <mrothmann@techfak.uni-bielefeld.de>
Date:   Wed Aug 29 16:41:47 2018 +0200

    Updated Chibi-OS to version 18.2 and adapted AMiRo-OS accordingly:
    	- Switched to new time conversion macros
    	- Use PAL for interrupts instead of the EXT Driver
    	- Use new kernel tests

diff --git a/kernel/ChibiOS b/kernel/ChibiOS
index 6494e27..d9a22f3 160000
--- a/kernel/ChibiOS
+++ b/kernel/ChibiOS
@@ -1 +1 @@
-Subproject commit 6494e27fd86fc8b674547e0740dbba1a3b1d5f35
+Subproject commit d9a22f36378a8898ce95c3ad807aff622a2fb2a1
diff --git a/modules/DiWheelDrive_1-1/Makefile b/modules/DiWheelDrive_1-1/Makefile
index 644cd37..1124e83 100644
--- a/modules/DiWheelDrive_1-1/Makefile
+++ b/modules/DiWheelDrive_1-1/Makefile
@@ -132,7 +132,8 @@ include $(CHIBIOS)/os/hal/osal/rt/osal.mk
 include $(CHIBIOS)/os/rt/rt.mk
 include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
 # Other files (optional).
-include $(CHIBIOS)/test/rt/test.mk
+include $(CHIBIOS)/test/lib/test.mk
+include $(CHIBIOS)/test/rt/rt_test.mk
 # AMiRo-BLT files
 include ../../bootloader/bootloader.mk
 # AMiRo-LLD files
diff --git a/modules/DiWheelDrive_1-1/chconf.h b/modules/DiWheelDrive_1-1/chconf.h
index c64d84b..68fe112 100644
--- a/modules/DiWheelDrive_1-1/chconf.h
+++ b/modules/DiWheelDrive_1-1/chconf.h
@@ -1,93 +1,697 @@
-/*
-AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
-Copyright (C) 2016..2018  Thomas Schöpping et al.
-
-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, either version 3 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
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file    os/modules/DiWheelDrive/chconf.h
- * @brief   ChibiOS Configuration file for the DiWheelDrive v1.1 module.
- * @details Contains the application specific kernel settings.
- *
- * @addtogroup config
- * @details Kernel related settings and hooks.
- * @{
- */
-
-#ifndef _CHCONF_H_
-#define _CHCONF_H_
-
-#include <aosconf.h>
-
-/*===========================================================================*/
-/**
- * @name System timers settings
- * @{
- */
-/*===========================================================================*/
-
-/**
- * @brief   System time counter resolution.
- * @note    Allowed values are 16 or 32 bits.
- */
-#define CH_CFG_ST_RESOLUTION                16
-
-/**
- * @brief   System tick frequency.
- * @details Frequency of the system timer that drives the system ticks. This
- *          setting also defines the system tick time unit.
- */
-#if (AMIROOS_CFG_TESTS_ENABLE != true) || defined(__DOXYGEN__)
-#define CH_CFG_ST_FREQUENCY                 1000000UL
-#else
-#define CH_CFG_ST_FREQUENCY                 100000UL
-#endif
-
-/**
- * @brief   Time delta constant for the tick-less mode.
- * @note    If this value is zero then the system uses the classic
- *          periodic tick. This value represents the minimum number
- *          of ticks that is safe to specify in a timeout directive.
- *          The value one is not valid, timeouts are rounded up to
- *          this value.
- */
-#if (AMIROOS_CFG_TESTS_ENABLE != true) || defined(__DOXYGEN__)
-#define CH_CFG_ST_TIMEDELTA                 20
-#else
-#define CH_CFG_ST_TIMEDELTA                 2
-#endif
-
-/** @} */
-
-/*===========================================================================*/
-/**
- * @name Port specific settings
- * @{
- */
-/*===========================================================================*/
-
-/**
- * @brief   NVIC VTOR initialization offset.
- * @details On initialization, the code at this address in the flash memory will be executed.
- */
-#define CORTEX_VTOR_INIT 0x00006000U
-
-/** @} */
-
-#include <aos_chconf.h>
-
-#endif  /* _CHCONF_H_ */
-
-/** @} */
+/*
+ * AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
+ * Copyright (C) 2016..2018  Thomas Schöpping et al.
+ *
+ * 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, either version 3 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
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * @file    os/modules/DiWheelDrive/chconf.h
+ * @brief   ChibiOS Configuration file for the DiWheelDrive v1.1 module.
+ * @details Contains the application specific kernel settings.
+ *
+ * @addtogroup config
+ * @details Kernel related settings and hooks.
+ * @{
+ */
+
+#ifndef CHCONF_H
+#define CHCONF_H
+
+#define _CHIBIOS_RT_CONF_
+#define _CHIBIOS_RT_CONF_VER_5_1_
+
+/*===========================================================================*/
+/**
+ * @name System timers settings
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief   System time counter resolution.
+ * @note    Allowed values are 16 or 32 bits.
+ */
+#if !defined(CH_CFG_ST_RESOLUTION)
+#define CH_CFG_ST_RESOLUTION                16
+#endif
+
+/**
+ * @brief   System tick frequency.
+ * @details Frequency of the system timer that drives the system ticks. This
+ *          setting also defines the system tick time unit.
+ */
+#if !defined(CH_CFG_ST_FREQUENCY)
+#define CH_CFG_ST_FREQUENCY                 1000000UL
+#endif
+
+/**
+ * @brief   Time intervals data size.
+ * @note    Allowed values are 16, 32 or 64 bits.
+ */
+#if !defined(CH_CFG_INTERVALS_SIZE)
+#define CH_CFG_INTERVALS_SIZE               64
+#endif
+
+/**
+ * @brief   Time types data size.
+ * @note    Allowed values are 16 or 32 bits.
+ */
+#if !defined(CH_CFG_TIME_TYPES_SIZE)
+#define CH_CFG_TIME_TYPES_SIZE              32
+#endif
+
+/**
+ * @brief   Time delta constant for the tick-less mode.
+ * @note    If this value is zero then the system uses the classic
+ *          periodic tick. This value represents the minimum number
+ *          of ticks that is safe to specify in a timeout directive.
+ *          The value one is not valid, timeouts are rounded up to
+ *          this value.
+ */
+#if !defined(CH_CFG_ST_TIMEDELTA)
+#define CH_CFG_ST_TIMEDELTA                 10
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Kernel parameters and options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief   Round robin interval.
+ * @details This constant is the number of system ticks allowed for the
+ *          threads before preemption occurs. Setting this value to zero
+ *          disables the preemption for threads with equal priority and the
+ *          round robin becomes cooperative. Note that higher priority
+ *          threads can still preempt, the kernel is always preemptive.
+ * @note    Disabling the round robin preemption makes the kernel more compact
+ *          and generally faster.
+ * @note    The round robin preemption is not supported in tickless mode and
+ *          must be set to zero in that case.
+ */
+#if !defined(CH_CFG_TIME_QUANTUM)
+#define CH_CFG_TIME_QUANTUM                 0
+#endif
+
+/**
+ * @brief   Managed RAM size.
+ * @details Size of the RAM area to be managed by the OS. If set to zero
+ *          then the whole available RAM is used. The core memory is made
+ *          available to the heap allocator and/or can be used directly through
+ *          the simplified core memory allocator.
+ *
+ * @note    In order to let the OS manage the whole RAM the linker script must
+ *          provide the @p __heap_base__ and @p __heap_end__ symbols.
+ * @note    Requires @p CH_CFG_USE_MEMCORE.
+ */
+#if !defined(CH_CFG_MEMCORE_SIZE)
+#define CH_CFG_MEMCORE_SIZE                 0
+#endif
+
+/**
+ * @brief   Idle thread automatic spawn suppression.
+ * @details When this option is activated the function @p chSysInit()
+ *          does not spawn the idle thread. The application @p main()
+ *          function becomes the idle thread and must implement an
+ *          infinite loop.
+ */
+#if !defined(CH_CFG_NO_IDLE_THREAD)
+#define CH_CFG_NO_IDLE_THREAD               FALSE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Performance options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief   OS optimization.
+ * @details If enabled then time efficient rather than space efficient code
+ *          is used when two possible implementations exist.
+ *
+ * @note    This is not related to the compiler optimization options.
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_OPTIMIZE_SPEED)
+#define CH_CFG_OPTIMIZE_SPEED               TRUE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Subsystem options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief   Time Measurement APIs.
+ * @details If enabled then the time measurement APIs are included in
+ *          the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_TM)
+#define CH_CFG_USE_TM                       FALSE
+#endif
+
+/**
+ * @brief   Threads registry APIs.
+ * @details If enabled then the registry APIs are included in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_REGISTRY)
+#define CH_CFG_USE_REGISTRY                 FALSE
+#endif
+
+/**
+ * @brief   Threads synchronization APIs.
+ * @details If enabled then the @p chThdWait() function is included in
+ *          the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_WAITEXIT)
+#define CH_CFG_USE_WAITEXIT                 TRUE
+#endif
+
+/**
+ * @brief   Semaphores APIs.
+ * @details If enabled then the Semaphores APIs are included in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_SEMAPHORES)
+#define CH_CFG_USE_SEMAPHORES               FALSE
+#endif
+
+/**
+ * @brief   Semaphores queuing mode.
+ * @details If enabled then the threads are enqueued on semaphores by
+ *          priority rather than in FIFO order.
+ *
+ * @note    The default is @p FALSE. Enable this if you have special
+ *          requirements.
+ * @note    Requires @p CH_CFG_USE_SEMAPHORES.
+ */
+#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
+#define CH_CFG_USE_SEMAPHORES_PRIORITY      FALSE
+#endif
+
+/**
+ * @brief   Mutexes APIs.
+ * @details If enabled then the mutexes APIs are included in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MUTEXES)
+#define CH_CFG_USE_MUTEXES                  TRUE
+#endif
+
+/**
+ * @brief   Enables recursive behavior on mutexes.
+ * @note    Recursive mutexes are heavier and have an increased
+ *          memory footprint.
+ *
+ * @note    The default is @p FALSE.
+ * @note    Requires @p CH_CFG_USE_MUTEXES.
+ */
+#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
+#define CH_CFG_USE_MUTEXES_RECURSIVE        FALSE
+#endif
+
+/**
+ * @brief   Conditional Variables APIs.
+ * @details If enabled then the conditional variables APIs are included
+ *          in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ * @note    Requires @p CH_CFG_USE_MUTEXES.
+ */
+#if !defined(CH_CFG_USE_CONDVARS)
+#define CH_CFG_USE_CONDVARS                 FALSE
+#endif
+
+/**
+ * @brief   Conditional Variables APIs with timeout.
+ * @details If enabled then the conditional variables APIs with timeout
+ *          specification are included in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ * @note    Requires @p CH_CFG_USE_CONDVARS.
+ */
+#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
+#define CH_CFG_USE_CONDVARS_TIMEOUT         FALSE
+#endif
+
+/**
+ * @brief   Events Flags APIs.
+ * @details If enabled then the event flags APIs are included in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_EVENTS)
+#define CH_CFG_USE_EVENTS                   TRUE
+#endif
+
+/**
+ * @brief   Events Flags APIs with timeout.
+ * @details If enabled then the events APIs with timeout specification
+ *          are included in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ * @note    Requires @p CH_CFG_USE_EVENTS.
+ */
+#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
+#define CH_CFG_USE_EVENTS_TIMEOUT           TRUE
+#endif
+
+/**
+ * @brief   Synchronous Messages APIs.
+ * @details If enabled then the synchronous messages APIs are included
+ *          in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MESSAGES)
+#define CH_CFG_USE_MESSAGES                 FALSE
+#endif
+
+/**
+ * @brief   Synchronous Messages queuing mode.
+ * @details If enabled then messages are served by priority rather than in
+ *          FIFO order.
+ *
+ * @note    The default is @p FALSE. Enable this if you have special
+ *          requirements.
+ * @note    Requires @p CH_CFG_USE_MESSAGES.
+ */
+#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
+#define CH_CFG_USE_MESSAGES_PRIORITY        FALSE
+#endif
+
+/**
+ * @brief   Mailboxes APIs.
+ * @details If enabled then the asynchronous messages (mailboxes) APIs are
+ *          included in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ * @note    Requires @p CH_CFG_USE_SEMAPHORES.
+ */
+#if !defined(CH_CFG_USE_MAILBOXES)
+#define CH_CFG_USE_MAILBOXES                FALSE
+#endif
+
+/**
+ * @brief   Core Memory Manager APIs.
+ * @details If enabled then the core memory manager APIs are included
+ *          in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MEMCORE)
+#define CH_CFG_USE_MEMCORE                  FALSE
+#endif
+
+/**
+ * @brief   Heap Allocator APIs.
+ * @details If enabled then the memory heap allocator APIs are included
+ *          in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ * @note    Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
+ *          @p CH_CFG_USE_SEMAPHORES.
+ * @note    Mutexes are recommended.
+ */
+#if !defined(CH_CFG_USE_HEAP)
+#define CH_CFG_USE_HEAP                     FALSE
+#endif
+
+/**
+ * @brief   Memory Pools Allocator APIs.
+ * @details If enabled then the memory pools allocator APIs are included
+ *          in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MEMPOOLS)
+#define CH_CFG_USE_MEMPOOLS                 FALSE
+#endif
+
+/**
+ * @brief  Objects FIFOs APIs.
+ * @details If enabled then the objects FIFOs APIs are included
+ *          in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_OBJ_FIFOS)
+#define CH_CFG_USE_OBJ_FIFOS                FALSE
+#endif
+
+/**
+ * @brief   Dynamic Threads APIs.
+ * @details If enabled then the dynamic threads creation APIs are included
+ *          in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ * @note    Requires @p CH_CFG_USE_WAITEXIT.
+ * @note    Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
+ */
+#if !defined(CH_CFG_USE_DYNAMIC)
+#define CH_CFG_USE_DYNAMIC                  FALSE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Objects factory options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief   Objects Factory APIs.
+ * @details If enabled then the objects factory APIs are included in the
+ *          kernel.
+ *
+ * @note    The default is @p FALSE.
+ */
+#if !defined(CH_CFG_USE_FACTORY)
+#define CH_CFG_USE_FACTORY                  FALSE
+#endif
+
+/**
+ * @brief   Maximum length for object names.
+ * @details If the specified length is zero then the name is stored by
+ *          pointer but this could have unintended side effects.
+ */
+#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH)
+#define CH_CFG_FACTORY_MAX_NAMES_LENGTH     8
+#endif
+
+/**
+ * @brief   Enables the registry of generic objects.
+ */
+#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY)
+#define CH_CFG_FACTORY_OBJECTS_REGISTRY     TRUE
+#endif
+
+/**
+ * @brief   Enables factory for generic buffers.
+ */
+#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
+#define CH_CFG_FACTORY_GENERIC_BUFFERS      TRUE
+#endif
+
+/**
+ * @brief   Enables factory for semaphores.
+ */
+#if !defined(CH_CFG_FACTORY_SEMAPHORES)
+#define CH_CFG_FACTORY_SEMAPHORES           TRUE
+#endif
+
+/**
+ * @brief   Enables factory for mailboxes.
+ */
+#if !defined(CH_CFG_FACTORY_MAILBOXES)
+#define CH_CFG_FACTORY_MAILBOXES            TRUE
+#endif
+
+/**
+ * @brief   Enables factory for objects FIFOs.
+ */
+#if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
+#define CH_CFG_FACTORY_OBJ_FIFOS            TRUE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Debug options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief   Debug option, kernel statistics.
+ *
+ * @note    The default is @p FALSE.
+ */
+#if !defined(CH_DBG_STATISTICS)
+#define CH_DBG_STATISTICS                   FALSE
+#endif
+
+/**
+ * @brief   Debug option, system state check.
+ * @details If enabled the correct call protocol for system APIs is checked
+ *          at runtime.
+ *
+ * @note    The default is @p FALSE.
+ */
+#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
+#define CH_DBG_SYSTEM_STATE_CHECK           FALSE
+#endif
+
+/**
+ * @brief   Debug option, parameters checks.
+ * @details If enabled then the checks on the API functions input
+ *          parameters are activated.
+ *
+ * @note    The default is @p FALSE.
+ */
+#if !defined(CH_DBG_ENABLE_CHECKS)
+#define CH_DBG_ENABLE_CHECKS                FALSE
+#endif
+
+/**
+ * @brief   Debug option, consistency checks.
+ * @details If enabled then all the assertions in the kernel code are
+ *          activated. This includes consistency checks inside the kernel,
+ *          runtime anomalies and port-defined checks.
+ *
+ * @note    The default is @p FALSE.
+ */
+#if !defined(CH_DBG_ENABLE_ASSERTS)
+#define CH_DBG_ENABLE_ASSERTS               TRUE
+#endif
+
+/**
+ * @brief   Debug option, trace buffer.
+ * @details If enabled then the trace buffer is activated.
+ *
+ * @note    The default is @p CH_DBG_TRACE_MASK_DISABLED.
+ */
+#if !defined(CH_DBG_TRACE_MASK)
+#define CH_DBG_TRACE_MASK                   CH_DBG_TRACE_MASK_DISABLED
+#endif
+
+/**
+ * @brief   Trace buffer entries.
+ * @note    The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
+ *          different from @p CH_DBG_TRACE_MASK_DISABLED.
+ */
+#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
+#define CH_DBG_TRACE_BUFFER_SIZE            128
+#endif
+
+/**
+ * @brief   Debug option, stack checks.
+ * @details If enabled then a runtime stack check is performed.
+ *
+ * @note    The default is @p FALSE.
+ * @note    The stack check is performed in a architecture/port dependent way.
+ *          It may not be implemented or some ports.
+ * @note    The default failure mode is to halt the system with the global
+ *          @p panic_msg variable set to @p NULL.
+ */
+#if !defined(CH_DBG_ENABLE_STACK_CHECK)
+#define CH_DBG_ENABLE_STACK_CHECK           TRUE
+#endif
+
+/**
+ * @brief   Debug option, stacks initialization.
+ * @details If enabled then the threads working area is filled with a byte
+ *          value when a thread is created. This can be useful for the
+ *          runtime measurement of the used stack.
+ *
+ * @note    The default is @p FALSE.
+ */
+#if !defined(CH_DBG_FILL_THREADS)
+#define CH_DBG_FILL_THREADS                 TRUE
+#endif
+
+/**
+ * @brief   Debug option, threads profiling.
+ * @details If enabled then a field is added to the @p thread_t structure that
+ *          counts the system ticks occurred while executing the thread.
+ *
+ * @note    The default is @p FALSE.
+ * @note    This debug option is not currently compatible with the
+ *          tickless mode.
+ */
+#if !defined(CH_DBG_THREADS_PROFILING)
+#define CH_DBG_THREADS_PROFILING            FALSE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Kernel hooks
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief   System structure extension.
+ * @details User fields added to the end of the @p ch_system_t structure.
+ */
+#define CH_CFG_SYSTEM_EXTRA_FIELDS                                          \
+  /* Add threads custom fields here.*/
+
+/**
+ * @brief   System initialization hook.
+ * @details User initialization code added to the @p chSysInit() function
+ *          just before interrupts are enabled globally.
+ */
+#define CH_CFG_SYSTEM_INIT_HOOK(tp) {                                       \
+  /* Add threads initialization code here.*/                                \
+}
+
+/**
+ * @brief   Threads descriptor structure extension.
+ * @details User fields added to the end of the @p thread_t structure.
+ */
+#define CH_CFG_THREAD_EXTRA_FIELDS                                          \
+  /* Add threads custom fields here.*/
+
+/**
+ * @brief   Threads initialization hook.
+ * @details User initialization code added to the @p _thread_init() function.
+ *
+ * @note    It is invoked from within @p _thread_init() and implicitly from all
+ *          the threads creation APIs.
+ */
+#define CH_CFG_THREAD_INIT_HOOK(tp) {                                       \
+  /* Add threads initialization code here.*/                                \
+}
+
+/**
+ * @brief   Threads finalization hook.
+ * @details User finalization code added to the @p chThdExit() API.
+ */
+#define CH_CFG_THREAD_EXIT_HOOK(tp) {                                       \
+  /* Add threads finalization code here.*/                                  \
+}
+
+/**
+ * @brief   Context switch hook.
+ * @details This hook is invoked just before switching between threads.
+ */
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) {                              \
+  /* Context switch code here.*/                                            \
+}
+
+/**
+ * @brief   ISR enter hook.
+ */
+#define CH_CFG_IRQ_PROLOGUE_HOOK() {                                        \
+  /* IRQ prologue code here.*/                                              \
+}
+
+/**
+ * @brief   ISR exit hook.
+ */
+#define CH_CFG_IRQ_EPILOGUE_HOOK() {                                        \
+  /* IRQ epilogue code here.*/                                              \
+}
+
+/**
+ * @brief   Idle thread enter hook.
+ * @note    This hook is invoked within a critical zone, no OS functions
+ *          should be invoked from here.
+ * @note    This macro can be used to activate a power saving mode.
+ */
+#define CH_CFG_IDLE_ENTER_HOOK() {                                          \
+  /* Idle-enter code here.*/                                                \
+}
+
+/**
+ * @brief   Idle thread leave hook.
+ * @note    This hook is invoked within a critical zone, no OS functions
+ *          should be invoked from here.
+ * @note    This macro can be used to deactivate a power saving mode.
+ */
+#define CH_CFG_IDLE_LEAVE_HOOK() {                                          \
+  /* Idle-leave code here.*/                                                \
+}
+
+/**
+ * @brief   Idle Loop hook.
+ * @details This hook is continuously invoked by the idle thread loop.
+ */
+#define CH_CFG_IDLE_LOOP_HOOK() {                                           \
+  /* Idle loop code here.*/                                                 \
+}
+
+/**
+ * @brief   System tick event hook.
+ * @details This hook is invoked in the system tick handler immediately
+ *          after processing the virtual timers queue.
+ */
+#define CH_CFG_SYSTEM_TICK_HOOK() {                                         \
+  /* System tick event code here.*/                                         \
+}
+
+/**
+ * @brief   System halt hook.
+ * @details This hook is invoked in case to a system halting error before
+ *          the system is halted.
+ */
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) {                                   \
+  /* System halt code here.*/                                               \
+}
+
+/**
+ * @brief   Trace hook.
+ * @details This hook is invoked each time a new record is written in the
+ *          trace buffer.
+ */
+#define CH_CFG_TRACE_HOOK(tep) {                                            \
+  /* Trace code here.*/                                                     \
+}
+
+/** @} */
+
+/*===========================================================================*/
+/* Port-specific settings (override port settings defaulted in chcore.h).    */
+/*===========================================================================*/
+
+#endif  /* CHCONF_H */
+
+/** @} */
diff --git a/modules/DiWheelDrive_1-1/halconf.h b/modules/DiWheelDrive_1-1/halconf.h
index 2308fb7..9b15e98 100644
--- a/modules/DiWheelDrive_1-1/halconf.h
+++ b/modules/DiWheelDrive_1-1/halconf.h
@@ -1,4 +1,31 @@
 /*
+ * AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
+ * Copyright (C) 2016..2018  Thomas Schöpping et al.
+ *
+ * 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, either version 3 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
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * @file    os/modules/DiWheelDrive/chconf.h
+ * @brief   ChibiOS Configuration file for the DiWheelDrive v1.1 module.
+ * @details Contains the application specific kernel settings.
+ *
+ * @addtogroup config
+ * @details Kernel related settings and hooks.
+ * @{
+ */
+/*
 AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
 Copyright (C) 2016..2018  Thomas Schöpping et al.
 
@@ -62,7 +89,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
  * @brief   Enables the EXT subsystem.
  */
 #if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
-#define HAL_USE_EXT                 TRUE
+#define HAL_USE_EXT                 FALSE
 #endif
 
 /**
diff --git a/modules/DiWheelDrive_1-1/module.c b/modules/DiWheelDrive_1-1/module.c
index 0c9b0dc..da71d77 100644
--- a/modules/DiWheelDrive_1-1/module.c
+++ b/modules/DiWheelDrive_1-1/module.c
@@ -29,14 +29,11 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 /**
  * @brief   Interrupt service routine callback for I/O interrupt signals.
  *
- * @param   extp      EXT driver to handle the ISR.
- * @param   channel   Channel on which the interrupt was encountered.
+ * @param   args      Channel on which the interrupt was encountered.
  */
-static void _moduleIsrCallback(EXTDriver* extp, expchannel_t channel) {
-  (void)extp;
-
+static void _modulePalIsrCallback(void *args) {
   chSysLockFromISR();
-  chEvtBroadcastFlagsI(&aos.events.io, (1 << channel));
+  chEvtBroadcastFlagsI(&aos.events.io, (1 << (*(uint16_t*)args)));
   chSysUnlockFromISR();
 
   return;
@@ -56,85 +53,92 @@ CANConfig moduleHalCanConfig = {
   /* btr  */ CAN_BTR_SJW(1) | CAN_BTR_TS2(2) | CAN_BTR_TS1(13) | CAN_BTR_BRP(1),
 };
 
-EXTConfig moduleHalExtConfig = {
-  /* channel configrations */ {
-    /* channel  0 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
-    },
+aos_interrupt_cfg_t moduleIntConfig[10] = {
     /* channel  1 */ { // SYS_INT_N/SYS_SYNC_N: automatic interrupt on event
-      /* mode     */ EXT_MODE_GPIOC | EXT_CH_MODE_BOTH_EDGES | EXT_CH_MODE_AUTOSTART,
-      /* callback */ _moduleIsrCallback,
+      /* port     */ GPIOC,
+      /* pad      */ GPIOC_SYS_INT_N,
+      /* flags    */ AOS_INTERRUPT_AUTOSTART,
+      /* mode     */ PAL_EVENT_MODE_BOTH_EDGES,
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 1,
     },
     /* channel  2 */ { // SYS_WARMRST_N: automatic interrupt when activated
-      /* mode     */ EXT_MODE_GPIOD | EXT_CH_MODE_FALLING_EDGE | EXT_CH_MODE_AUTOSTART,
-      /* callback */ _moduleIsrCallback,
+      /* port     */ GPIOD,
+      /* pad      */ GPIOD_SYS_WARMRST_N,
+      /* flags    */ AOS_INTERRUPT_AUTOSTART,
+      /* mode     */ PAL_EVENT_MODE_FALLING_EDGE,
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 2,
     },
     /* channel  3 */ { // PATH_DCSTAT: must be enabled explicitely when charging is in progress to detect unexpected voltage drop
-      /* mode     */ EXT_MODE_GPIOC | EXT_CH_MODE_FALLING_EDGE,
-      /* callback */ _moduleIsrCallback,
-    },
-    /* channel  4 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
+      /* port     */ GPIOC,
+      /* pad      */ GPIOC_PATH_DCSTAT,
+      /* flags    */ 0,
+      /* mode     */ PAL_EVENT_MODE_FALLING_EDGE,
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 3,
     },
     /* channel  5 */ { // COMPASS_DRDY: must be enabled explicitely
-      /* mode     */ EXT_MODE_GPIOB | APAL2CH_EDGE(HMC5883L_LLD_INT_EDGE),
-      /* callback */ _moduleIsrCallback,
-    },
-    /* channel  6 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
-    },
-    /* channel  7 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
+      /* port     */ GPIOB,
+      /* pad      */ GPIOB_COMPASS_DRDY,
+      /* flags    */ 0,
+      /* mode     */ APAL2CH_EDGE(HMC5883L_LLD_INT_EDGE),
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 4,
     },
     /* channel  8 */ { // SYS_PD_N: automatic interrupt when activated
-      /* mode     */ EXT_MODE_GPIOC | EXT_CH_MODE_FALLING_EDGE | EXT_CH_MODE_AUTOSTART,
-      /* callback */ _moduleIsrCallback,
+      /* port     */ GPIOC,
+      /* pad      */ GPIOC_SYS_PD_N,
+      /* flags    */ AOS_INTERRUPT_AUTOSTART,
+      /* mode     */ PAL_EVENT_MODE_FALLING_EDGE,
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 5,
     },
     /* channel  9 */ { // SYS_REG_EN: automatic interrupt when activated
-      /* mode     */ EXT_MODE_GPIOC | EXT_CH_MODE_FALLING_EDGE | EXT_CH_MODE_AUTOSTART,
-      /* callback */ _moduleIsrCallback,
-    },
-    /* channel 10 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
-    },
-    /* channel 11 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
+      /* port     */ GPIOC,
+      /* pad      */ GPIOC_SYS_REG_EN,
+      /* flags    */ AOS_INTERRUPT_AUTOSTART,
+      /* mode     */ PAL_EVENT_MODE_FALLING_EDGE,
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 6,
     },
     /* channel 12 */ { // IR_INT: must be enabled explicitely
-      /* mode     */ EXT_MODE_GPIOB | APAL2CH_EDGE(VCNL4020_LLD_INT_EDGE),
-      /* callback */ _moduleIsrCallback,
+      /* port     */ GPIOB,
+      /* pad      */ GPIOB_IR_INT,
+      /* flags    */ 0,
+      /* mode     */ APAL2CH_EDGE(VCNL4020_LLD_INT_EDGE),
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 7,
     },
     /* channel 13 */ { // GYRO_DRDY: must be enabled explicitely
-      /* mode     */ EXT_MODE_GPIOB | APAL2CH_EDGE(L3G4200D_LLD_INT_EDGE),
-      /* callback */ _moduleIsrCallback,
+      /* port     */ GPIOB,
+      /* pad      */ GPIOB_GYRO_DRDY,
+      /* flags    */ 0,
+      /* mode     */ APAL2CH_EDGE(L3G4200D_LLD_INT_EDGE),
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 8,
     },
     /* channel 14 */ { // SYS_UART_UP: automatic interrupt on event
-      /* mode     */ EXT_MODE_GPIOB | EXT_CH_MODE_BOTH_EDGES | EXT_CH_MODE_AUTOSTART,
-      /* callback */ _moduleIsrCallback,
+      /* port     */ GPIOB,
+      /* pad      */ GPIOB_SYS_UART_UP,
+      /* flags    */ AOS_INTERRUPT_AUTOSTART,
+      /* mode     */ PAL_EVENT_MODE_BOTH_EDGES,
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 9,
     },
     /* channel 15 */ { // ACCEL_INT_N: must be enabled explicitely
-      /* mode     */ EXT_MODE_GPIOB | APAL2CH_EDGE(LIS331DLH_LLD_INT_EDGE),
-      /* callback */ _moduleIsrCallback,
+      /* port     */ GPIOB,
+      /* pad      */ GPIOB_ACCEL_INT_N,
+      /* flags    */ 0,
+      /* mode     */ APAL2CH_EDGE(LIS331DLH_LLD_INT_EDGE),
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 10,
     },
-    /* channel 16 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
-    },
-    /* channel 17 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
-    },
-    /* channel 18 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
-    },
-  },
+};
+
+aos_interrupt_driver_t moduleIntDriver = {
+  /* config     */ NULL,
+  /* interrupts */ 10,
 };
 
 I2CConfig moduleHalI2cCompassConfig = {
@@ -199,6 +203,7 @@ SerialConfig moduleHalProgIfConfig = {
 };
 
 SPIConfig moduleHalSpiAccelerometerConfig = {
+  /* circular buffer mode         */ false,
   /* callback function pointer    */ NULL,
   /* chip select line port        */ GPIOC,
   /* chip select line pad number  */ GPIOC_ACCEL_SS_N,
@@ -207,6 +212,7 @@ SPIConfig moduleHalSpiAccelerometerConfig = {
 };
 
 SPIConfig moduleHalSpiGyroscopeConfig = {
+  /* circular buffer mode         */ false,
   /* callback function pointer    */ NULL,
   /* chip select line port        */ GPIOC,
   /* chip select line pad number  */ GPIOC_GYRO_SS_N,
@@ -511,14 +517,15 @@ static int _utShellCmdCb_AlldHmc5883l(BaseSequentialStream* stream, int argc, ch
 {
   (void)argc;
   (void)argv;
-  extChannelEnable(&MODULE_HAL_EXT, MODULE_GPIO_EXTCHANNEL_COMPASSDRDY);
+  aosIntEnable(&moduleIntDriver, MODULE_GPIO_INT_COMPASSDRDY);
   aosUtRun(stream, &moduleUtAlldHmc5883l, NULL);
+  aosIntDisable(&moduleIntDriver, MODULE_GPIO_INT_COMPASSDRDY);
   return AOS_OK;
 }
 static ut_hmc5883ldata_t _utHmc5883lData = {
   /* HMC driver   */ &moduleLldCompass,
   /* event source */ &aos.events.io,
-  /* event flags  */ (1 << MODULE_GPIO_EXTCHANNEL_COMPASSDRDY),
+  /* event flags  */ (1 << MODULE_GPIO_INT_COMPASSDRDY),
   /* timeout      */ MICROSECONDS_PER_SECOND,
 };
 aos_unittest_t moduleUtAlldHmc5883l = {
@@ -564,17 +571,18 @@ static int _utShellCmdCb_AlldL3g4200d(BaseSequentialStream* stream, int argc, ch
 {
   (void)argc;
   (void)argv;
-  extChannelEnable(&MODULE_HAL_EXT, MODULE_GPIO_EXTCHANNEL_GYRODRDY);
+  aosIntEnable(&moduleIntDriver, MODULE_GPIO_INT_GYRODRDY);
   spiStart(((ut_l3g4200ddata_t*)moduleUtAlldL3g4200d.data)->l3gd->spid, ((ut_l3g4200ddata_t*)moduleUtAlldL3g4200d.data)->spiconf);
   aosUtRun(stream, &moduleUtAlldL3g4200d, NULL);
   spiStop(((ut_l3g4200ddata_t*)moduleUtAlldL3g4200d.data)->l3gd->spid);
+  aosIntDisable(&moduleIntDriver, MODULE_GPIO_INT_GYRODRDY);
   return AOS_OK;
 }
 static ut_l3g4200ddata_t _utL3g4200dData = {
   /* driver            */ &moduleLldGyroscope,
   /* SPI configuration */ &moduleHalSpiGyroscopeConfig,
   /* event source */ &aos.events.io,
-  /* event flags  */ (1 << MODULE_GPIO_EXTCHANNEL_GYRODRDY),
+  /* event flags  */ (1 << MODULE_GPIO_INT_GYRODRDY),
 };
 aos_unittest_t moduleUtAlldL3g4200d = {
   /* name           */ "L3G4200D",
@@ -613,17 +621,18 @@ static int _utShellCmdCb_AlldLis331dlh(BaseSequentialStream* stream, int argc, c
 {
   (void)argc;
   (void)argv;
-  extChannelEnable(&MODULE_HAL_EXT, MODULE_GPIO_EXTCHANNEL_ACCELINT);
+  aosIntEnable(&moduleIntDriver, MODULE_GPIO_INT_ACCELINT);
   spiStart(((ut_lis331dlhdata_t*)moduleUtAlldLis331dlh.data)->lisd->spid, ((ut_lis331dlhdata_t*)moduleUtAlldLis331dlh.data)->spiconf);
   aosUtRun(stream, &moduleUtAlldLis331dlh, NULL);
   spiStop(((ut_lis331dlhdata_t*)moduleUtAlldLis331dlh.data)->lisd->spid);
+  aosIntDisable(&moduleIntDriver, MODULE_GPIO_INT_ACCELINT);
   return AOS_OK;
 }
 static ut_lis331dlhdata_t _utLis331dlhData = {
   /* driver            */ &moduleLldAccelerometer,
   /* SPI configuration */ &moduleHalSpiAccelerometerConfig,
   /* event source */ &aos.events.io,
-  /* event flags  */ (1 << MODULE_GPIO_EXTCHANNEL_ACCELINT),
+  /* event flags  */ (1 << MODULE_GPIO_INT_ACCELINT),
 };
 aos_unittest_t moduleUtAlldLis331dlh = {
   /* name           */ "LIS331DLH",
@@ -739,7 +748,7 @@ static int _utShellCmdCb_AlldVcnl4020(BaseSequentialStream* stream, int argc, ch
     _utAlldVcnl4020_disableInterrupt(((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->vcnld);
     pca9544a_lld_setchannel(&moduleLldI2cMultiplexer, PCA9544A_LLD_CH3, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
     _utAlldVcnl4020_disableInterrupt(((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->vcnld);
-    extChannelEnable(&MODULE_HAL_EXT, MODULE_GPIO_EXTCHANNEL_IRINT);
+    aosIntEnable(&moduleIntDriver, MODULE_GPIO_INT_IRINT);
     switch (sensor) {
       case FL:
         pca9544a_lld_setchannel(&moduleLldI2cMultiplexer, PCA9544A_LLD_CH3, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
@@ -760,6 +769,7 @@ static int _utShellCmdCb_AlldVcnl4020(BaseSequentialStream* stream, int argc, ch
       default:
         break;
     }
+    aosIntDisable(&moduleIntDriver, MODULE_GPIO_INT_IRINT);
     return AOS_OK;
   }
   // print help
@@ -779,7 +789,7 @@ static ut_vcnl4020data_t _utVcnl4020Data = {
   /* driver       */ &moduleLldProximity,
   /* timeout      */ MICROSECONDS_PER_SECOND,
   /* event source */ &aos.events.io,
-  /* event flags  */ (1 << MODULE_GPIO_EXTCHANNEL_IRINT),
+  /* event flags  */ (1 << MODULE_GPIO_INT_IRINT),
 };
 aos_unittest_t moduleUtAlldVcnl4020 = {
   /* name           */ "VCNL4020",
diff --git a/modules/DiWheelDrive_1-1/module.h b/modules/DiWheelDrive_1-1/module.h
index 431b0d8..85d871a 100644
--- a/modules/DiWheelDrive_1-1/module.h
+++ b/modules/DiWheelDrive_1-1/module.h
@@ -36,6 +36,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 /*===========================================================================*/
 #include <hal.h>
 #include <hal_qei.h>
+#include <aos_interrupts.h>
 
 /**
  * @brief   CAN driver to use.
@@ -48,14 +49,15 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 extern CANConfig moduleHalCanConfig;
 
 /**
- * @brief   Interrupt driver to use.
+ * @brief   Interrupt driver (PAL).
  */
-#define MODULE_HAL_EXT                          EXTD1
+
+extern aos_interrupt_driver_t moduleIntDriver;
 
 /**
- * @brief   Interrupt driver configuration.
+ * @brief   Interrupt driver config.
  */
-extern EXTConfig moduleHalExtConfig;
+extern aos_interrupt_cfg_t moduleIntConfig[10];
 
 /**
  * @brief   I2C driver to access the compass.
@@ -171,52 +173,52 @@ extern SPIConfig moduleHalSpiGyroscopeConfig;
 /**
  * @brief   Interrupt channel for the SYS_SYNC signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_SYSSYNC          ((expchannel_t)1)
+#define MODULE_GPIO_INT_SYSSYNC          ((uint8_t)1)
 
 /**
  * @brief   Interrupt channel for the SYS_WARMRST signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_SYSWARMRST       ((expchannel_t)2)
+#define MODULE_GPIO_INT_SYSWARMRST       ((uint8_t)2)
 
 /**
  * @brief   Interrupt channel for the PATH_DCSTAT signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_PATHDCSTAT       ((expchannel_t)3)
+#define MODULE_GPIO_INT_PATHDCSTAT       ((uint8_t)3)
 
 /**
  * @brief   Interrupt channel for the COMPASS_DRDY signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_COMPASSDRDY      ((expchannel_t)5)
+#define MODULE_GPIO_INT_COMPASSDRDY      ((uint8_t)4)
 
 /**
  * @brief   Interrupt channel for the SYS_PD signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_SYSPD            ((expchannel_t)8)
+#define MODULE_GPIO_INT_SYSPD            ((uint8_t)5)
 
 /**
  * @brief   Interrupt channel for the SYS_REG_EN signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_SYSREGEN         ((expchannel_t)9)
+#define MODULE_GPIO_INT_SYSREGEN         ((uint8_t)6)
 
 /**
  * @brief   Interrupt channel for the IR_INT signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_IRINT            ((expchannel_t)12)
+#define MODULE_GPIO_INT_IRINT            ((uint8_t)7)
 
 /**
  * @brief   Interrupt channel for the GYRO_DRDY signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_GYRODRDY         ((expchannel_t)13)
+#define MODULE_GPIO_INT_GYRODRDY         ((uint8_t)8)
 
 /**
  * @brief   Interrupt channel for the SYS_UART_UP signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_SYSUARTUP        ((expchannel_t)14)
+#define MODULE_GPIO_INT_SYSUARTUP        ((uint8_t)9)
 
 /**
  * @brief   Interrupt channel for the ACCEL_INT signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_ACCELINT         ((expchannel_t)15)
+#define MODULE_GPIO_INT_ACCELINT         ((uint8_t)10)
 
 /**
  * @brief   LED output signal GPIO.
@@ -295,52 +297,52 @@ extern apalGpio_t moduleGpioSysWarmrst;
 /**
  * @brief   Event flag to be set on a SYS_SYNC interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSSYNC          ((eventflags_t)(1 << MODULE_GPIO_EXTCHANNEL_SYSSYNC))
+#define MODULE_OS_IOEVENTFLAGS_SYSSYNC          ((eventflags_t)(1 << MODULE_GPIO_INT_SYSSYNC))
 
 /**
  * @brief   Event flag to be set on a SYS_WARMRST interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSWARMRST       ((eventflags_t)(1 << MODULE_GPIO_EXTCHANNEL_SYSWARMRST))
+#define MODULE_OS_IOEVENTFLAGS_SYSWARMRST       ((eventflags_t)(1 << MODULE_GPIO_INT_SYSWARMRST))
 
 /**
  * @brief   Event flag to be set on a PATH_DCSTAT interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_PATHDCSTAT       ((eventflags_t)(1 << MODULE_GPIO_EXTCHANNEL_PATHDCSTAT))
+#define MODULE_OS_IOEVENTFLAGS_PATHDCSTAT       ((eventflags_t)(1 << MODULE_GPIO_INT_PATHDCSTAT))
 
 /**
  * @brief   Event flag to be set on a COMPASS_DRDY interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_COMPASSDRDY      ((eventflags_t)(1 << MODULE_GPIO_EXTCHANNEL_COMPASSDRDY))
+#define MODULE_OS_IOEVENTFLAGS_COMPASSDRDY      ((eventflags_t)(1 << MODULE_GPIO_INT_COMPASSDRDY))
 
 /**
  * @brief   Event flag to be set on a SYS_PD interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSPD            ((eventflags_t)(1 << MODULE_GPIO_EXTCHANNEL_SYSPD))
+#define MODULE_OS_IOEVENTFLAGS_SYSPD            ((eventflags_t)(1 << MODULE_GPIO_INT_SYSPD))
 
 /**
  * @brief   Event flag to be set on a SYS_REG_EN interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSREGEN         ((eventflags_t)(1 << MODULE_GPIO_EXTCHANNEL_SYSREGEN))
+#define MODULE_OS_IOEVENTFLAGS_SYSREGEN         ((eventflags_t)(1 << MODULE_GPIO_INT_SYSREGEN))
 
 /**
  * @brief   Event flag to be set on a IR_INT interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_IRINT            ((eventflags_t)(1 << MODULE_GPIO_EXTCHANNEL_IRINT))
+#define MODULE_OS_IOEVENTFLAGS_IRINT            ((eventflags_t)(1 << MODULE_GPIO_INT_IRINT))
 
 /**
  * @brief   Event flag to be set on a GYRO_DRDY interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_GYRODRDY         ((eventflags_t)(1 << MODULE_GPIO_EXTCHANNEL_GYRODRDY))
+#define MODULE_OS_IOEVENTFLAGS_GYRODRDY         ((eventflags_t)(1 << MODULE_GPIO_INT_GYRODRDY))
 
 /**
  * @brief   Event flag to be set on a SYS_UART_UP interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSUARTUP        ((eventflags_t)(1 << MODULE_GPIO_EXTCHANNEL_SYSUARTUP))
+#define MODULE_OS_IOEVENTFLAGS_SYSUARTUP        ((eventflags_t)(1 << MODULE_GPIO_INT_SYSUARTUP))
 
 /**
  * @brief   Event flag to be set on a ACCEL_INT interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_ACCELINT         ((eventflags_t)(1 << MODULE_GPIO_EXTCHANNEL_ACCELINT))
+#define MODULE_OS_IOEVENTFLAGS_ACCELINT         ((eventflags_t)(1 << MODULE_GPIO_INT_ACCELINT))
 
 #if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__)
 /**
diff --git a/modules/LightRing_1-0/Makefile b/modules/LightRing_1-0/Makefile
index 644cd37..1124e83 100644
--- a/modules/LightRing_1-0/Makefile
+++ b/modules/LightRing_1-0/Makefile
@@ -132,7 +132,8 @@ include $(CHIBIOS)/os/hal/osal/rt/osal.mk
 include $(CHIBIOS)/os/rt/rt.mk
 include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
 # Other files (optional).
-include $(CHIBIOS)/test/rt/test.mk
+include $(CHIBIOS)/test/lib/test.mk
+include $(CHIBIOS)/test/rt/rt_test.mk
 # AMiRo-BLT files
 include ../../bootloader/bootloader.mk
 # AMiRo-LLD files
diff --git a/modules/LightRing_1-0/chconf.h b/modules/LightRing_1-0/chconf.h
index 329be8d..68fe112 100644
--- a/modules/LightRing_1-0/chconf.h
+++ b/modules/LightRing_1-0/chconf.h
@@ -1,93 +1,697 @@
-/*
-AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
-Copyright (C) 2016..2018  Thomas Schöpping et al.
-
-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, either version 3 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
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file    os/modules/LightRing/chconf.h
- * @brief   ChibiOS Configuration file for the LightRing v1.0 module.
- * @details Contains the application specific kernel settings.
- *
- * @addtogroup config
- * @details Kernel related settings and hooks.
- * @{
- */
-
-#ifndef _CHCONF_H_
-#define _CHCONF_H_
-
-#include <aosconf.h>
-
-/*===========================================================================*/
-/**
- * @name System timers settings
- * @{
- */
-/*===========================================================================*/
-
-/**
- * @brief   System time counter resolution.
- * @note    Allowed values are 16 or 32 bits.
- */
-#define CH_CFG_ST_RESOLUTION                16
-
-/**
- * @brief   System tick frequency.
- * @details Frequency of the system timer that drives the system ticks. This
- *          setting also defines the system tick time unit.
- */
-#if (AMIROOS_CFG_TESTS_ENABLE != true) || defined(__DOXYGEN__)
-#define CH_CFG_ST_FREQUENCY                 1000000UL
-#else
-#define CH_CFG_ST_FREQUENCY                 100000UL
-#endif
-
-/**
- * @brief   Time delta constant for the tick-less mode.
- * @note    If this value is zero then the system uses the classic
- *          periodic tick. This value represents the minimum number
- *          of ticks that is safe to specify in a timeout directive.
- *          The value one is not valid, timeouts are rounded up to
- *          this value.
- */
-#if (AMIROOS_CFG_TESTS_ENABLE != true) || defined(__DOXYGEN__)
-#define CH_CFG_ST_TIMEDELTA                 20
-#else
-#define CH_CFG_ST_TIMEDELTA                 2
-#endif
-
-/** @} */
-
-/*===========================================================================*/
-/**
- * @name Port specific settings
- * @{
- */
-/*===========================================================================*/
-
-/**
- * @brief   NVIC VTOR initialization offset.
- * @details On initialization, the code at this address in the flash memory will be executed.
- */
-#define CORTEX_VTOR_INIT 0x00006000U
-
-/** @} */
-
-#include <aos_chconf.h>
-
-#endif  /* _CHCONF_H_ */
-
-/** @} */
+/*
+ * AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
+ * Copyright (C) 2016..2018  Thomas Schöpping et al.
+ *
+ * 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, either version 3 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
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * @file    os/modules/DiWheelDrive/chconf.h
+ * @brief   ChibiOS Configuration file for the DiWheelDrive v1.1 module.
+ * @details Contains the application specific kernel settings.
+ *
+ * @addtogroup config
+ * @details Kernel related settings and hooks.
+ * @{
+ */
+
+#ifndef CHCONF_H
+#define CHCONF_H
+
+#define _CHIBIOS_RT_CONF_
+#define _CHIBIOS_RT_CONF_VER_5_1_
+
+/*===========================================================================*/
+/**
+ * @name System timers settings
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief   System time counter resolution.
+ * @note    Allowed values are 16 or 32 bits.
+ */
+#if !defined(CH_CFG_ST_RESOLUTION)
+#define CH_CFG_ST_RESOLUTION                16
+#endif
+
+/**
+ * @brief   System tick frequency.
+ * @details Frequency of the system timer that drives the system ticks. This
+ *          setting also defines the system tick time unit.
+ */
+#if !defined(CH_CFG_ST_FREQUENCY)
+#define CH_CFG_ST_FREQUENCY                 1000000UL
+#endif
+
+/**
+ * @brief   Time intervals data size.
+ * @note    Allowed values are 16, 32 or 64 bits.
+ */
+#if !defined(CH_CFG_INTERVALS_SIZE)
+#define CH_CFG_INTERVALS_SIZE               64
+#endif
+
+/**
+ * @brief   Time types data size.
+ * @note    Allowed values are 16 or 32 bits.
+ */
+#if !defined(CH_CFG_TIME_TYPES_SIZE)
+#define CH_CFG_TIME_TYPES_SIZE              32
+#endif
+
+/**
+ * @brief   Time delta constant for the tick-less mode.
+ * @note    If this value is zero then the system uses the classic
+ *          periodic tick. This value represents the minimum number
+ *          of ticks that is safe to specify in a timeout directive.
+ *          The value one is not valid, timeouts are rounded up to
+ *          this value.
+ */
+#if !defined(CH_CFG_ST_TIMEDELTA)
+#define CH_CFG_ST_TIMEDELTA                 10
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Kernel parameters and options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief   Round robin interval.
+ * @details This constant is the number of system ticks allowed for the
+ *          threads before preemption occurs. Setting this value to zero
+ *          disables the preemption for threads with equal priority and the
+ *          round robin becomes cooperative. Note that higher priority
+ *          threads can still preempt, the kernel is always preemptive.
+ * @note    Disabling the round robin preemption makes the kernel more compact
+ *          and generally faster.
+ * @note    The round robin preemption is not supported in tickless mode and
+ *          must be set to zero in that case.
+ */
+#if !defined(CH_CFG_TIME_QUANTUM)
+#define CH_CFG_TIME_QUANTUM                 0
+#endif
+
+/**
+ * @brief   Managed RAM size.
+ * @details Size of the RAM area to be managed by the OS. If set to zero
+ *          then the whole available RAM is used. The core memory is made
+ *          available to the heap allocator and/or can be used directly through
+ *          the simplified core memory allocator.
+ *
+ * @note    In order to let the OS manage the whole RAM the linker script must
+ *          provide the @p __heap_base__ and @p __heap_end__ symbols.
+ * @note    Requires @p CH_CFG_USE_MEMCORE.
+ */
+#if !defined(CH_CFG_MEMCORE_SIZE)
+#define CH_CFG_MEMCORE_SIZE                 0
+#endif
+
+/**
+ * @brief   Idle thread automatic spawn suppression.
+ * @details When this option is activated the function @p chSysInit()
+ *          does not spawn the idle thread. The application @p main()
+ *          function becomes the idle thread and must implement an
+ *          infinite loop.
+ */
+#if !defined(CH_CFG_NO_IDLE_THREAD)
+#define CH_CFG_NO_IDLE_THREAD               FALSE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Performance options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief   OS optimization.
+ * @details If enabled then time efficient rather than space efficient code
+ *          is used when two possible implementations exist.
+ *
+ * @note    This is not related to the compiler optimization options.
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_OPTIMIZE_SPEED)
+#define CH_CFG_OPTIMIZE_SPEED               TRUE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Subsystem options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief   Time Measurement APIs.
+ * @details If enabled then the time measurement APIs are included in
+ *          the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_TM)
+#define CH_CFG_USE_TM                       FALSE
+#endif
+
+/**
+ * @brief   Threads registry APIs.
+ * @details If enabled then the registry APIs are included in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_REGISTRY)
+#define CH_CFG_USE_REGISTRY                 FALSE
+#endif
+
+/**
+ * @brief   Threads synchronization APIs.
+ * @details If enabled then the @p chThdWait() function is included in
+ *          the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_WAITEXIT)
+#define CH_CFG_USE_WAITEXIT                 TRUE
+#endif
+
+/**
+ * @brief   Semaphores APIs.
+ * @details If enabled then the Semaphores APIs are included in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_SEMAPHORES)
+#define CH_CFG_USE_SEMAPHORES               FALSE
+#endif
+
+/**
+ * @brief   Semaphores queuing mode.
+ * @details If enabled then the threads are enqueued on semaphores by
+ *          priority rather than in FIFO order.
+ *
+ * @note    The default is @p FALSE. Enable this if you have special
+ *          requirements.
+ * @note    Requires @p CH_CFG_USE_SEMAPHORES.
+ */
+#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
+#define CH_CFG_USE_SEMAPHORES_PRIORITY      FALSE
+#endif
+
+/**
+ * @brief   Mutexes APIs.
+ * @details If enabled then the mutexes APIs are included in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MUTEXES)
+#define CH_CFG_USE_MUTEXES                  TRUE
+#endif
+
+/**
+ * @brief   Enables recursive behavior on mutexes.
+ * @note    Recursive mutexes are heavier and have an increased
+ *          memory footprint.
+ *
+ * @note    The default is @p FALSE.
+ * @note    Requires @p CH_CFG_USE_MUTEXES.
+ */
+#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
+#define CH_CFG_USE_MUTEXES_RECURSIVE        FALSE
+#endif
+
+/**
+ * @brief   Conditional Variables APIs.
+ * @details If enabled then the conditional variables APIs are included
+ *          in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ * @note    Requires @p CH_CFG_USE_MUTEXES.
+ */
+#if !defined(CH_CFG_USE_CONDVARS)
+#define CH_CFG_USE_CONDVARS                 FALSE
+#endif
+
+/**
+ * @brief   Conditional Variables APIs with timeout.
+ * @details If enabled then the conditional variables APIs with timeout
+ *          specification are included in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ * @note    Requires @p CH_CFG_USE_CONDVARS.
+ */
+#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
+#define CH_CFG_USE_CONDVARS_TIMEOUT         FALSE
+#endif
+
+/**
+ * @brief   Events Flags APIs.
+ * @details If enabled then the event flags APIs are included in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_EVENTS)
+#define CH_CFG_USE_EVENTS                   TRUE
+#endif
+
+/**
+ * @brief   Events Flags APIs with timeout.
+ * @details If enabled then the events APIs with timeout specification
+ *          are included in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ * @note    Requires @p CH_CFG_USE_EVENTS.
+ */
+#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
+#define CH_CFG_USE_EVENTS_TIMEOUT           TRUE
+#endif
+
+/**
+ * @brief   Synchronous Messages APIs.
+ * @details If enabled then the synchronous messages APIs are included
+ *          in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MESSAGES)
+#define CH_CFG_USE_MESSAGES                 FALSE
+#endif
+
+/**
+ * @brief   Synchronous Messages queuing mode.
+ * @details If enabled then messages are served by priority rather than in
+ *          FIFO order.
+ *
+ * @note    The default is @p FALSE. Enable this if you have special
+ *          requirements.
+ * @note    Requires @p CH_CFG_USE_MESSAGES.
+ */
+#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
+#define CH_CFG_USE_MESSAGES_PRIORITY        FALSE
+#endif
+
+/**
+ * @brief   Mailboxes APIs.
+ * @details If enabled then the asynchronous messages (mailboxes) APIs are
+ *          included in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ * @note    Requires @p CH_CFG_USE_SEMAPHORES.
+ */
+#if !defined(CH_CFG_USE_MAILBOXES)
+#define CH_CFG_USE_MAILBOXES                FALSE
+#endif
+
+/**
+ * @brief   Core Memory Manager APIs.
+ * @details If enabled then the core memory manager APIs are included
+ *          in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MEMCORE)
+#define CH_CFG_USE_MEMCORE                  FALSE
+#endif
+
+/**
+ * @brief   Heap Allocator APIs.
+ * @details If enabled then the memory heap allocator APIs are included
+ *          in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ * @note    Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
+ *          @p CH_CFG_USE_SEMAPHORES.
+ * @note    Mutexes are recommended.
+ */
+#if !defined(CH_CFG_USE_HEAP)
+#define CH_CFG_USE_HEAP                     FALSE
+#endif
+
+/**
+ * @brief   Memory Pools Allocator APIs.
+ * @details If enabled then the memory pools allocator APIs are included
+ *          in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MEMPOOLS)
+#define CH_CFG_USE_MEMPOOLS                 FALSE
+#endif
+
+/**
+ * @brief  Objects FIFOs APIs.
+ * @details If enabled then the objects FIFOs APIs are included
+ *          in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_OBJ_FIFOS)
+#define CH_CFG_USE_OBJ_FIFOS                FALSE
+#endif
+
+/**
+ * @brief   Dynamic Threads APIs.
+ * @details If enabled then the dynamic threads creation APIs are included
+ *          in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ * @note    Requires @p CH_CFG_USE_WAITEXIT.
+ * @note    Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
+ */
+#if !defined(CH_CFG_USE_DYNAMIC)
+#define CH_CFG_USE_DYNAMIC                  FALSE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Objects factory options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief   Objects Factory APIs.
+ * @details If enabled then the objects factory APIs are included in the
+ *          kernel.
+ *
+ * @note    The default is @p FALSE.
+ */
+#if !defined(CH_CFG_USE_FACTORY)
+#define CH_CFG_USE_FACTORY                  FALSE
+#endif
+
+/**
+ * @brief   Maximum length for object names.
+ * @details If the specified length is zero then the name is stored by
+ *          pointer but this could have unintended side effects.
+ */
+#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH)
+#define CH_CFG_FACTORY_MAX_NAMES_LENGTH     8
+#endif
+
+/**
+ * @brief   Enables the registry of generic objects.
+ */
+#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY)
+#define CH_CFG_FACTORY_OBJECTS_REGISTRY     TRUE
+#endif
+
+/**
+ * @brief   Enables factory for generic buffers.
+ */
+#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
+#define CH_CFG_FACTORY_GENERIC_BUFFERS      TRUE
+#endif
+
+/**
+ * @brief   Enables factory for semaphores.
+ */
+#if !defined(CH_CFG_FACTORY_SEMAPHORES)
+#define CH_CFG_FACTORY_SEMAPHORES           TRUE
+#endif
+
+/**
+ * @brief   Enables factory for mailboxes.
+ */
+#if !defined(CH_CFG_FACTORY_MAILBOXES)
+#define CH_CFG_FACTORY_MAILBOXES            TRUE
+#endif
+
+/**
+ * @brief   Enables factory for objects FIFOs.
+ */
+#if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
+#define CH_CFG_FACTORY_OBJ_FIFOS            TRUE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Debug options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief   Debug option, kernel statistics.
+ *
+ * @note    The default is @p FALSE.
+ */
+#if !defined(CH_DBG_STATISTICS)
+#define CH_DBG_STATISTICS                   FALSE
+#endif
+
+/**
+ * @brief   Debug option, system state check.
+ * @details If enabled the correct call protocol for system APIs is checked
+ *          at runtime.
+ *
+ * @note    The default is @p FALSE.
+ */
+#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
+#define CH_DBG_SYSTEM_STATE_CHECK           FALSE
+#endif
+
+/**
+ * @brief   Debug option, parameters checks.
+ * @details If enabled then the checks on the API functions input
+ *          parameters are activated.
+ *
+ * @note    The default is @p FALSE.
+ */
+#if !defined(CH_DBG_ENABLE_CHECKS)
+#define CH_DBG_ENABLE_CHECKS                FALSE
+#endif
+
+/**
+ * @brief   Debug option, consistency checks.
+ * @details If enabled then all the assertions in the kernel code are
+ *          activated. This includes consistency checks inside the kernel,
+ *          runtime anomalies and port-defined checks.
+ *
+ * @note    The default is @p FALSE.
+ */
+#if !defined(CH_DBG_ENABLE_ASSERTS)
+#define CH_DBG_ENABLE_ASSERTS               TRUE
+#endif
+
+/**
+ * @brief   Debug option, trace buffer.
+ * @details If enabled then the trace buffer is activated.
+ *
+ * @note    The default is @p CH_DBG_TRACE_MASK_DISABLED.
+ */
+#if !defined(CH_DBG_TRACE_MASK)
+#define CH_DBG_TRACE_MASK                   CH_DBG_TRACE_MASK_DISABLED
+#endif
+
+/**
+ * @brief   Trace buffer entries.
+ * @note    The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
+ *          different from @p CH_DBG_TRACE_MASK_DISABLED.
+ */
+#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
+#define CH_DBG_TRACE_BUFFER_SIZE            128
+#endif
+
+/**
+ * @brief   Debug option, stack checks.
+ * @details If enabled then a runtime stack check is performed.
+ *
+ * @note    The default is @p FALSE.
+ * @note    The stack check is performed in a architecture/port dependent way.
+ *          It may not be implemented or some ports.
+ * @note    The default failure mode is to halt the system with the global
+ *          @p panic_msg variable set to @p NULL.
+ */
+#if !defined(CH_DBG_ENABLE_STACK_CHECK)
+#define CH_DBG_ENABLE_STACK_CHECK           TRUE
+#endif
+
+/**
+ * @brief   Debug option, stacks initialization.
+ * @details If enabled then the threads working area is filled with a byte
+ *          value when a thread is created. This can be useful for the
+ *          runtime measurement of the used stack.
+ *
+ * @note    The default is @p FALSE.
+ */
+#if !defined(CH_DBG_FILL_THREADS)
+#define CH_DBG_FILL_THREADS                 TRUE
+#endif
+
+/**
+ * @brief   Debug option, threads profiling.
+ * @details If enabled then a field is added to the @p thread_t structure that
+ *          counts the system ticks occurred while executing the thread.
+ *
+ * @note    The default is @p FALSE.
+ * @note    This debug option is not currently compatible with the
+ *          tickless mode.
+ */
+#if !defined(CH_DBG_THREADS_PROFILING)
+#define CH_DBG_THREADS_PROFILING            FALSE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Kernel hooks
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief   System structure extension.
+ * @details User fields added to the end of the @p ch_system_t structure.
+ */
+#define CH_CFG_SYSTEM_EXTRA_FIELDS                                          \
+  /* Add threads custom fields here.*/
+
+/**
+ * @brief   System initialization hook.
+ * @details User initialization code added to the @p chSysInit() function
+ *          just before interrupts are enabled globally.
+ */
+#define CH_CFG_SYSTEM_INIT_HOOK(tp) {                                       \
+  /* Add threads initialization code here.*/                                \
+}
+
+/**
+ * @brief   Threads descriptor structure extension.
+ * @details User fields added to the end of the @p thread_t structure.
+ */
+#define CH_CFG_THREAD_EXTRA_FIELDS                                          \
+  /* Add threads custom fields here.*/
+
+/**
+ * @brief   Threads initialization hook.
+ * @details User initialization code added to the @p _thread_init() function.
+ *
+ * @note    It is invoked from within @p _thread_init() and implicitly from all
+ *          the threads creation APIs.
+ */
+#define CH_CFG_THREAD_INIT_HOOK(tp) {                                       \
+  /* Add threads initialization code here.*/                                \
+}
+
+/**
+ * @brief   Threads finalization hook.
+ * @details User finalization code added to the @p chThdExit() API.
+ */
+#define CH_CFG_THREAD_EXIT_HOOK(tp) {                                       \
+  /* Add threads finalization code here.*/                                  \
+}
+
+/**
+ * @brief   Context switch hook.
+ * @details This hook is invoked just before switching between threads.
+ */
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) {                              \
+  /* Context switch code here.*/                                            \
+}
+
+/**
+ * @brief   ISR enter hook.
+ */
+#define CH_CFG_IRQ_PROLOGUE_HOOK() {                                        \
+  /* IRQ prologue code here.*/                                              \
+}
+
+/**
+ * @brief   ISR exit hook.
+ */
+#define CH_CFG_IRQ_EPILOGUE_HOOK() {                                        \
+  /* IRQ epilogue code here.*/                                              \
+}
+
+/**
+ * @brief   Idle thread enter hook.
+ * @note    This hook is invoked within a critical zone, no OS functions
+ *          should be invoked from here.
+ * @note    This macro can be used to activate a power saving mode.
+ */
+#define CH_CFG_IDLE_ENTER_HOOK() {                                          \
+  /* Idle-enter code here.*/                                                \
+}
+
+/**
+ * @brief   Idle thread leave hook.
+ * @note    This hook is invoked within a critical zone, no OS functions
+ *          should be invoked from here.
+ * @note    This macro can be used to deactivate a power saving mode.
+ */
+#define CH_CFG_IDLE_LEAVE_HOOK() {                                          \
+  /* Idle-leave code here.*/                                                \
+}
+
+/**
+ * @brief   Idle Loop hook.
+ * @details This hook is continuously invoked by the idle thread loop.
+ */
+#define CH_CFG_IDLE_LOOP_HOOK() {                                           \
+  /* Idle loop code here.*/                                                 \
+}
+
+/**
+ * @brief   System tick event hook.
+ * @details This hook is invoked in the system tick handler immediately
+ *          after processing the virtual timers queue.
+ */
+#define CH_CFG_SYSTEM_TICK_HOOK() {                                         \
+  /* System tick event code here.*/                                         \
+}
+
+/**
+ * @brief   System halt hook.
+ * @details This hook is invoked in case to a system halting error before
+ *          the system is halted.
+ */
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) {                                   \
+  /* System halt code here.*/                                               \
+}
+
+/**
+ * @brief   Trace hook.
+ * @details This hook is invoked each time a new record is written in the
+ *          trace buffer.
+ */
+#define CH_CFG_TRACE_HOOK(tep) {                                            \
+  /* Trace code here.*/                                                     \
+}
+
+/** @} */
+
+/*===========================================================================*/
+/* Port-specific settings (override port settings defaulted in chcore.h).    */
+/*===========================================================================*/
+
+#endif  /* CHCONF_H */
+
+/** @} */
diff --git a/modules/LightRing_1-0/halconf.h b/modules/LightRing_1-0/halconf.h
index 5e21005..c9bae1c 100644
--- a/modules/LightRing_1-0/halconf.h
+++ b/modules/LightRing_1-0/halconf.h
@@ -62,7 +62,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
  * @brief   Enables the EXT subsystem.
  */
 #if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
-#define HAL_USE_EXT                 TRUE
+#define HAL_USE_EXT                 FALSE
 #endif
 
 /**
diff --git a/modules/LightRing_1-0/module.c b/modules/LightRing_1-0/module.c
index 11eaf26..dd2b229 100644
--- a/modules/LightRing_1-0/module.c
+++ b/modules/LightRing_1-0/module.c
@@ -29,14 +29,11 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 /**
  * @brief   Interrupt service routine callback for I/O interrupt signals.
  *
- * @param   extp      EXT driver to handle the ISR.
- * @param   channel   Channel on which the interrupt was encountered.
+ * @param   args      Channel on which the interrupt was encountered.
  */
-static void _moduleIsrCallback(EXTDriver* extp, expchannel_t channel) {
-  (void)extp;
-
+static void _modulePalIsrCallback(void *args) {
   chSysLockFromISR();
-  chEvtBroadcastFlagsI(&aos.events.io, (1 << channel));
+  chEvtBroadcastFlagsI(&aos.events.io, (1 << (*(uint16_t*)args)));
   chSysUnlockFromISR();
 
   return;
@@ -56,85 +53,60 @@ CANConfig moduleHalCanConfig = {
   /* btr  */ CAN_BTR_SJW(1) | CAN_BTR_TS2(2) | CAN_BTR_TS1(13) | CAN_BTR_BRP(1),
 };
 
-EXTConfig moduleHalExtConfig = {
-  /* channel configrations */ {
-    /* channel  0 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
-    },
-    /* channel  1 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
-    },
-    /* channel  2 */ { // SYS_SYNC_N: automatic interrupt on event
-      /* mode     */ EXT_MODE_GPIOD | EXT_CH_MODE_BOTH_EDGES | EXT_CH_MODE_AUTOSTART,
-      /* callback */ _moduleIsrCallback
-    },
-    /* channel  3 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
-    },
-    /* channel  4 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
-    },
-    /* channel  5 */ { // LASER_OC_N: must be enabled explicitely
-      /* mode     */ EXT_MODE_GPIOB | EXT_CH_MODE_FALLING_EDGE,
-      /* callback */ _moduleIsrCallback,
-    },
-    /* channel  6 */ { // SYS_UART_DN: automatic interrupt on event
-      /* mode     */ EXT_MODE_GPIOB | EXT_CH_MODE_BOTH_EDGES | EXT_CH_MODE_AUTOSTART,
-      /* callback */ _moduleIsrCallback,
-    },
-    /* channel  7 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
+aos_interrupt_cfg_t moduleIntConfig[6] = {
+    /* channel  1 */ { // SYS_INT_N/SYS_SYNC_N: automatic interrupt on event
+      /* port     */ GPIOD,
+      /* pad      */ GPIOD_SYS_INT_N,
+      /* flags    */ AOS_INTERRUPT_AUTOSTART,
+      /* mode     */ PAL_EVENT_MODE_BOTH_EDGES,
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 1,
     },
-    /* channel  8 */ { // WL_GDO0: must be enabled explicitely
-      /* mode     */ EXT_MODE_GPIOB | EXT_CH_MODE_BOTH_EDGES,
-      /* callback */ _moduleIsrCallback,
+    /* channel  2 */ { // LASER_OC_N: must be enabled explicitely
+      /* port     */ GPIOB,
+      /* pad      */ GPIOB_LASER_OC_N,
+      /* flags    */ 0,
+      /* mode     */ PAL_EVENT_MODE_FALLING_EDGE,
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 2,
     },
-    /* channel  9 */ { // WL_GDO2: must be enabled explicitely
-      /* mode     */ EXT_MODE_GPIOB | EXT_CH_MODE_BOTH_EDGES,
-      /* callback */ _moduleIsrCallback,
+    /* channel  3 */ { // SYS_UART_DN: automatic interrupt on event
+      /* port     */ GPIOB,
+      /* pad      */ GPIOB_SYS_UART_DN,
+      /* flags    */ AOS_INTERRUPT_AUTOSTART,
+      /* mode     */ PAL_EVENT_MODE_BOTH_EDGES,
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 3,
     },
-    /* channel 10 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
+    /* channel  4 */ { // WL_GDO0: must be enabled explicitely
+      /* port     */ GPIOB,
+      /* pad      */ GPIOB_WL_GDO0,
+      /* flags    */ 0,
+      /* mode     */ PAL_EVENT_MODE_BOTH_EDGES,
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 4,
     },
-    /* channel 11 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
+    /* channel  5 */ { // WL_GDO2: must be enabled explicitely
+      /* port     */ GPIOB,
+      /* pad      */ GPIOB_WL_GDO2,
+      /* flags    */ 0,
+      /* mode     */ PAL_EVENT_MODE_BOTH_EDGES,
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 5,
     },
-    /* channel 12 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
+    /* channel  6 */ { // SYS_PD_N: automatic interrupt on event
+      /* port     */ GPIOC,
+      /* pad      */ GPIOC_SYS_PD_N,
+      /* flags    */ AOS_INTERRUPT_AUTOSTART,
+      /* mode     */ PAL_EVENT_MODE_FALLING_EDGE,
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 6,
     },
-    /* channel 13 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
-    },
-    /* channel 14 */ { // SYS_PD_N: automatic interrupt when activated
-      /* mode     */ EXT_MODE_GPIOC | EXT_CH_MODE_FALLING_EDGE | EXT_CH_MODE_AUTOSTART,
-      /* callback */ _moduleIsrCallback
-    },
-    /* channel 15 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
-    },
-    /* channel 16 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
-    },
-    /* channel 17 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
-    },
-    /* channel 18 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
-    },
-  }
+};
+
+aos_interrupt_driver_t moduleIntDriver = {
+  /* config     */ NULL,
+  /* interrupts */ 6,
 };
 
 I2CConfig moduleHalI2cEepromConfig = {
@@ -151,6 +123,7 @@ SerialConfig moduleHalProgIfConfig = {
 };
 
 SPIConfig moduleHalSpiLightConfig = {
+  /* circular buffer mode        */ false,
   /* callback function pointer   */ NULL,
   /* chip select line port       */ GPIOC,
   /* chip select line pad number */ GPIOC_LIGHT_XLAT,
diff --git a/modules/LightRing_1-0/module.h b/modules/LightRing_1-0/module.h
index 652d5a5..7b4a9d1 100644
--- a/modules/LightRing_1-0/module.h
+++ b/modules/LightRing_1-0/module.h
@@ -35,6 +35,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 /*===========================================================================*/
 #include <hal.h>
+#include <aos_interrupts.h>
 
 /**
  * @brief   CAN driver to use.
@@ -47,14 +48,15 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 extern CANConfig moduleHalCanConfig;
 
 /**
- * @brief   Interrupt driver to use.
+ * @brief   Interrupt driver (PAL).
  */
-#define MODULE_HAL_EXT                          EXTD1
+
+extern aos_interrupt_driver_t moduleIntDriver;
 
 /**
- * @brief   Interrupt driver configuration.
+ * @brief   Interrupt driver config.
  */
-extern EXTConfig moduleHalExtConfig;
+extern aos_interrupt_cfg_t moduleIntConfig[6];
 
 /**
  * @brief   I2C driver to access the EEPROM.
@@ -104,32 +106,32 @@ extern SPIConfig moduleHalSpiLightConfig;
 /**
  * @brief   Interrupt channel for the SYS_SYNC signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_SYSSYNC          ((expchannel_t)2)
+#define MODULE_GPIO_INT_SYSSYNC          ((uint8_t)1)
 
 /**
  * @brief   Interrupt channel for the LASER_OC signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_LASEROC          ((expchannel_t)5)
+#define MODULE_GPIO_INT_LASEROC          ((uint8_t)2)
 
 /**
  * @brief   Interrupt channel for the SYS_UART_DN signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_SYSUARTDN        ((expchannel_t)6)
+#define MODULE_GPIO_INT_SYSUARTDN        ((uint8_t)3)
 
 /**
  * @brief   Interrupt channel for the WL_GDO2 signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_WLGDO2           ((expchannel_t)8)
+#define MODULE_GPIO_INT_WLGDO2           ((uint8_t)4)
 
 /**
  * @brief   Interrupt channel for the WL_GDO0 signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_WLGDO0           ((expchannel_t)9)
+#define MODULE_GPIO_INT_WLGDO0           ((uint8_t)5)
 
 /**
  * @brief   Interrupt channel for the SYS_PD signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_SYSPD            ((expchannel_t)14)
+#define MODULE_GPIO_INT_SYSPD            ((uint8_t)6)
 
 /**
  * @brief   LIGHT_BANK output signal GPIO.
@@ -188,32 +190,32 @@ extern apalGpio_t moduleGpioSysSync;
 /**
  * @brief   Event flag to be set on a LASER_OC interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_LASEROC          ((eventflags_t)(1 << MODULE_GPIO_EXTCHANNEL_LASEROC))
+#define MODULE_OS_IOEVENTFLAGS_LASEROC          ((eventflags_t)(1 << MODULE_GPIO_INT_LASEROC))
 
 /**
  * @brief   Event flag to be set on a SYS_UART_DN interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSUARTDN        ((eventflags_t)(1 << MODULE_GPIO_EXTCHANNEL_SYSUARTDN))
+#define MODULE_OS_IOEVENTFLAGS_SYSUARTDN        ((eventflags_t)(1 << MODULE_GPIO_INT_SYSUARTDN))
 
 /**
  * @brief   Event flag to be set on a WL_GDO2 interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_WLGDO2           ((eventflags_t)(1 << MODULE_GPIO_EXTCHANNEL_WLGDO2))
+#define MODULE_OS_IOEVENTFLAGS_WLGDO2           ((eventflags_t)(1 << MODULE_GPIO_INT_WLGDO2))
 
 /**
  * @brief   Event flag to be set on a WL_GDO0 interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_WLGDO0           ((eventflags_t)(1 << MODULE_GPIO_EXTCHANNEL_WLGDO0))
+#define MODULE_OS_IOEVENTFLAGS_WLGDO0           ((eventflags_t)(1 << MODULE_GPIO_INT_WLGDO0))
 
 /**
  * @brief   Event flag to be set on a SYS_PD interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSPD            ((eventflags_t)(1 << MODULE_GPIO_EXTCHANNEL_SYSPD))
+#define MODULE_OS_IOEVENTFLAGS_SYSPD            ((eventflags_t)(1 << MODULE_GPIO_INT_SYSPD))
 
 /**
  * @brief   Event flag to be set on a SYS_SYNC interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSSYNC          ((eventflags_t)(1 << MODULE_GPIO_EXTCHANNEL_SYSSYNC))
+#define MODULE_OS_IOEVENTFLAGS_SYSSYNC          ((eventflags_t)(1 << MODULE_GPIO_INT_SYSSYNC))
 
 #if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__)
 /**
diff --git a/modules/PowerManagement_1-1/Makefile b/modules/PowerManagement_1-1/Makefile
index 57c08b9..3d7618d 100644
--- a/modules/PowerManagement_1-1/Makefile
+++ b/modules/PowerManagement_1-1/Makefile
@@ -132,7 +132,8 @@ include $(CHIBIOS)/os/hal/osal/rt/osal.mk
 include $(CHIBIOS)/os/rt/rt.mk
 include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
 # Other files (optional).
-include $(CHIBIOS)/test/rt/test.mk
+include $(CHIBIOS)/test/lib/test.mk
+include $(CHIBIOS)/test/rt/rt_test.mk
 # AMiRo-BLT files
 include ../../bootloader/bootloader.mk
 # AMiRo-LLD files
diff --git a/modules/PowerManagement_1-1/board.c b/modules/PowerManagement_1-1/board.c
index 7e6ad50..d6d501e 100644
--- a/modules/PowerManagement_1-1/board.c
+++ b/modules/PowerManagement_1-1/board.c
@@ -17,14 +17,64 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include <hal.h>
+#include <stm32_gpio.h>
 
-#if HAL_USE_PAL || defined(__DOXYGEN__)
 /**
- * @brief   PAL setup.
- * @details Digital I/O ports static configuration as defined in @p board.h.
- *          This variable is used by the HAL when initializing the PAL driver.
+ * @brief   Type of STM32 GPIO port setup.
  */
-const PALConfig pal_default_config = {
+typedef struct {
+  uint32_t              moder;
+  uint32_t              otyper;
+  uint32_t              ospeedr;
+  uint32_t              pupdr;
+  uint32_t              odr;
+  uint32_t              afrl;
+  uint32_t              afrh;
+} gpio_setup_t;
+
+/**
+ * @brief   Type of STM32 GPIO initialization data.
+ */
+typedef struct {
+#if STM32_HAS_GPIOA || defined(__DOXYGEN__)
+  gpio_setup_t          PAData;
+#endif
+#if STM32_HAS_GPIOB || defined(__DOXYGEN__)
+  gpio_setup_t          PBData;
+#endif
+#if STM32_HAS_GPIOC || defined(__DOXYGEN__)
+  gpio_setup_t          PCData;
+#endif
+#if STM32_HAS_GPIOD || defined(__DOXYGEN__)
+  gpio_setup_t          PDData;
+#endif
+#if STM32_HAS_GPIOE || defined(__DOXYGEN__)
+  gpio_setup_t          PEData;
+#endif
+#if STM32_HAS_GPIOF || defined(__DOXYGEN__)
+  gpio_setup_t          PFData;
+#endif
+#if STM32_HAS_GPIOG || defined(__DOXYGEN__)
+  gpio_setup_t          PGData;
+#endif
+#if STM32_HAS_GPIOH || defined(__DOXYGEN__)
+  gpio_setup_t          PHData;
+#endif
+#if STM32_HAS_GPIOI || defined(__DOXYGEN__)
+  gpio_setup_t          PIData;
+#endif
+#if STM32_HAS_GPIOJ || defined(__DOXYGEN__)
+  gpio_setup_t          PJData;
+#endif
+#if STM32_HAS_GPIOK || defined(__DOXYGEN__)
+  gpio_setup_t          PKData;
+#endif
+} gpio_config_t;
+
+/**
+ * @brief   STM32 GPIO static initialization data.
+ */
+static const gpio_config_t gpio_default_config = {
 #if STM32_HAS_GPIOA
   {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR,
    VAL_GPIOA_ODR,   VAL_GPIOA_AFRL,   VAL_GPIOA_AFRH},
@@ -59,10 +109,80 @@ const PALConfig pal_default_config = {
 #endif
 #if STM32_HAS_GPIOI
   {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR,
-   VAL_GPIOI_ODR,   VAL_GPIOI_AFRL,   VAL_GPIOI_AFRH}
+   VAL_GPIOI_ODR,   VAL_GPIOI_AFRL,   VAL_GPIOI_AFRH},
+#endif
+#if STM32_HAS_GPIOJ
+  {VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR,
+   VAL_GPIOJ_ODR,   VAL_GPIOJ_AFRL,   VAL_GPIOJ_AFRH},
+#endif
+#if STM32_HAS_GPIOK
+  {VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR,
+   VAL_GPIOK_ODR,   VAL_GPIOK_AFRL,   VAL_GPIOK_AFRH}
 #endif
 };
+
+/**
+ * @brief   GPIO initialization.
+ *
+ * @param[in]   gpiop   GPIO register block. 
+ * @param[in]   config  GPIO configuration.
+ */
+static void gpio_init(stm32_gpio_t *gpiop, const gpio_setup_t *config) {
+
+  gpiop->OTYPER  = config->otyper;
+  gpiop->OSPEEDR = config->ospeedr;
+  gpiop->PUPDR   = config->pupdr;
+  gpiop->ODR     = config->odr;
+  gpiop->AFRL    = config->afrl;
+  gpiop->AFRH    = config->afrh;
+  gpiop->MODER   = config->moder;
+}
+
+/**
+ * @brief   GPIO initilization for all ports.
+ */
+static void stm32_gpio_init(void) {
+
+  /* Enabling GPIO-related clocks, the mask comes from the
+     registry header file.*/
+  rccResetAHB1(STM32_GPIO_EN_MASK);
+  rccEnableAHB1(STM32_GPIO_EN_MASK, true);
+
+  /* Initializing all the defined GPIO ports.*/
+#if STM32_HAS_GPIOA
+  gpio_init(GPIOA, &gpio_default_config.PAData);
+#endif
+#if STM32_HAS_GPIOB
+  gpio_init(GPIOB, &gpio_default_config.PBData);
+#endif
+#if STM32_HAS_GPIOC
+  gpio_init(GPIOC, &gpio_default_config.PCData);
+#endif
+#if STM32_HAS_GPIOD
+  gpio_init(GPIOD, &gpio_default_config.PDData);
+#endif
+#if STM32_HAS_GPIOE
+  gpio_init(GPIOE, &gpio_default_config.PEData);
+#endif
+#if STM32_HAS_GPIOF
+  gpio_init(GPIOF, &gpio_default_config.PFData);
+#endif
+#if STM32_HAS_GPIOG
+  gpio_init(GPIOG, &gpio_default_config.PGData);
+#endif
+#if STM32_HAS_GPIOH
+  gpio_init(GPIOH, &gpio_default_config.PHData);
+#endif
+#if STM32_HAS_GPIOI
+  gpio_init(GPIOI, &gpio_default_config.PIData);
 #endif
+#if STM32_HAS_GPIOJ
+  gpio_init(GPIOJ, &gpio_default_config.PJData);
+#endif
+#if STM32_HAS_GPIOK
+  gpio_init(GPIOK, &gpio_default_config.PKData);
+#endif
+}
 
 /**
  * @brief   Early initialization code.
@@ -71,6 +191,7 @@ const PALConfig pal_default_config = {
  */
 void __early_init(void) {
 
+  stm32_gpio_init();
   stm32_clock_init();
 }
 
diff --git a/modules/PowerManagement_1-1/chconf.h b/modules/PowerManagement_1-1/chconf.h
index 5789afe..9cff1c4 100644
--- a/modules/PowerManagement_1-1/chconf.h
+++ b/modules/PowerManagement_1-1/chconf.h
@@ -1,85 +1,722 @@
-/*
-AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
-Copyright (C) 2016..2018  Thomas Schöpping et al.
-
-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, either version 3 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
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file    os/modules/PowerManagement/chconf.h
- * @brief   ChibiOS Configuration file for the PowerManagement v1.1 module.
- * @details Contains the application specific kernel settings.
- *
- * @addtogroup config
- * @details Kernel related settings and hooks.
- * @{
- */
-
-#ifndef _CHCONF_H_
-#define _CHCONF_H_
-
-#include <aosconf.h>
-
-/*===========================================================================*/
-/**
- * @name System timers settings
- * @{
- */
-/*===========================================================================*/
-
-/**
- * @brief   System time counter resolution.
- * @note    Allowed values are 16 or 32 bits.
- */
-#define CH_CFG_ST_RESOLUTION                32
-
-/**
- * @brief   System tick frequency.
- * @details Frequency of the system timer that drives the system ticks. This
- *          setting also defines the system tick time unit.
- */
-#define CH_CFG_ST_FREQUENCY                 1000000UL
-
-/**
- * @brief   Time delta constant for the tick-less mode.
- * @note    If this value is zero then the system uses the classic
- *          periodic tick. This value represents the minimum number
- *          of ticks that is safe to specify in a timeout directive.
- *          The value one is not valid, timeouts are rounded up to
- *          this value.
- */
-#define CH_CFG_ST_TIMEDELTA                 20
-
-/** @} */
-
-/*===========================================================================*/
-/**
- * @name Port specific settings
- * @{
- */
-/*===========================================================================*/
-
-/**
- * @brief   NVIC VTOR initialization offset.
- * @details On initialization, the code at this address in the flash memory will be executed.
- */
-#define CORTEX_VTOR_INIT 0x00008000U
-
-/** @} */
-
-#include <aos_chconf.h>
-
-#endif  /* _CHCONF_H_ */
-
-/** @} */
+/*
+ * AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
+ * Copyright (C) 2016..2018  Thomas Schöpping et al.
+ *
+ * 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, either version 3 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
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * @file    os/modules/DiWheelDrive/chconf.h
+ * @brief   ChibiOS Configuration file for the DiWheelDrive v1.1 module.
+ * @details Contains the application specific kernel settings.
+ *
+ * @addtogroup config
+ * @details Kernel related settings and hooks.
+ * @{
+ */
+
+#ifndef CHCONF_H
+#define CHCONF_H
+
+#define _CHIBIOS_RT_CONF_
+#define _CHIBIOS_RT_CONF_VER_5_1_
+
+/*===========================================================================*/
+/**
+ * @name System timers settings
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief   System time counter resolution.
+ * @note    Allowed values are 16 or 32 bits.
+ */
+#if !defined(CH_CFG_ST_RESOLUTION)
+#define CH_CFG_ST_RESOLUTION                32
+#endif
+
+/**
+ * @brief   System tick frequency.
+ * @details Frequency of the system timer that drives the system ticks. This
+ *          setting also defines the system tick time unit.
+ */
+#if !defined(CH_CFG_ST_FREQUENCY)
+#define CH_CFG_ST_FREQUENCY                 1000000UL
+#endif
+
+/**
+ * @brief   Time intervals data size.
+ * @note    Allowed values are 16, 32 or 64 bits.
+ */
+#if !defined(CH_CFG_INTERVALS_SIZE)
+#define CH_CFG_INTERVALS_SIZE               64
+#endif
+
+/**
+ * @brief   Time types data size.
+ * @note    Allowed values are 16 or 32 bits.
+ */
+#if !defined(CH_CFG_TIME_TYPES_SIZE)
+#define CH_CFG_TIME_TYPES_SIZE              32
+#endif
+
+/**
+ * @brief   Time delta constant for the tick-less mode.
+ * @note    If this value is zero then the system uses the classic
+ *          periodic tick. This value represents the minimum number
+ *          of ticks that is safe to specify in a timeout directive.
+ *          The value one is not valid, timeouts are rounded up to
+ *          this value.
+ */
+#if !defined(CH_CFG_ST_TIMEDELTA)
+#define CH_CFG_ST_TIMEDELTA                 10
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Kernel parameters and options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief   Round robin interval.
+ * @details This constant is the number of system ticks allowed for the
+ *          threads before preemption occurs. Setting this value to zero
+ *          disables the preemption for threads with equal priority and the
+ *          round robin becomes cooperative. Note that higher priority
+ *          threads can still preempt, the kernel is always preemptive.
+ * @note    Disabling the round robin preemption makes the kernel more compact
+ *          and generally faster.
+ * @note    The round robin preemption is not supported in tickless mode and
+ *          must be set to zero in that case.
+ */
+#if !defined(CH_CFG_TIME_QUANTUM)
+#define CH_CFG_TIME_QUANTUM                 0
+#endif
+
+/**
+ * @brief   Managed RAM size.
+ * @details Size of the RAM area to be managed by the OS. If set to zero
+ *          then the whole available RAM is used. The core memory is made
+ *          available to the heap allocator and/or can be used directly through
+ *          the simplified core memory allocator.
+ *
+ * @note    In order to let the OS manage the whole RAM the linker script must
+ *          provide the @p __heap_base__ and @p __heap_end__ symbols.
+ * @note    Requires @p CH_CFG_USE_MEMCORE.
+ */
+#if !defined(CH_CFG_MEMCORE_SIZE)
+#define CH_CFG_MEMCORE_SIZE                 0
+#endif
+
+/**
+ * @brief   Idle thread automatic spawn suppression.
+ * @details When this option is activated the function @p chSysInit()
+ *          does not spawn the idle thread. The application @p main()
+ *          function becomes the idle thread and must implement an
+ *          infinite loop.
+ */
+#if !defined(CH_CFG_NO_IDLE_THREAD)
+#define CH_CFG_NO_IDLE_THREAD               FALSE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Performance options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief   OS optimization.
+ * @details If enabled then time efficient rather than space efficient code
+ *          is used when two possible implementations exist.
+ *
+ * @note    This is not related to the compiler optimization options.
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_OPTIMIZE_SPEED)
+#define CH_CFG_OPTIMIZE_SPEED               TRUE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Subsystem options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief   Time Measurement APIs.
+ * @details If enabled then the time measurement APIs are included in
+ *          the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_TM)
+#define CH_CFG_USE_TM                       FALSE
+#endif
+
+/**
+ * @brief   Threads registry APIs.
+ * @details If enabled then the registry APIs are included in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_REGISTRY)
+#define CH_CFG_USE_REGISTRY                 FALSE
+#endif
+
+/**
+ * @brief   Threads synchronization APIs.
+ * @details If enabled then the @p chThdWait() function is included in
+ *          the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_WAITEXIT)
+#define CH_CFG_USE_WAITEXIT                 TRUE
+#endif
+
+/**
+ * @brief   Semaphores APIs.
+ * @details If enabled then the Semaphores APIs are included in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_SEMAPHORES)
+#define CH_CFG_USE_SEMAPHORES               FALSE
+#endif
+
+/**
+ * @brief   Semaphores queuing mode.
+ * @details If enabled then the threads are enqueued on semaphores by
+ *          priority rather than in FIFO order.
+ *
+ * @note    The default is @p FALSE. Enable this if you have special
+ *          requirements.
+ * @note    Requires @p CH_CFG_USE_SEMAPHORES.
+ */
+#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
+#define CH_CFG_USE_SEMAPHORES_PRIORITY      FALSE
+#endif
+
+/**
+ * @brief   Mutexes APIs.
+ * @details If enabled then the mutexes APIs are included in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MUTEXES)
+#define CH_CFG_USE_MUTEXES                  TRUE
+#endif
+
+/**
+ * @brief   Enables recursive behavior on mutexes.
+ * @note    Recursive mutexes are heavier and have an increased
+ *          memory footprint.
+ *
+ * @note    The default is @p FALSE.
+ * @note    Requires @p CH_CFG_USE_MUTEXES.
+ */
+#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
+#define CH_CFG_USE_MUTEXES_RECURSIVE        FALSE
+#endif
+
+/**
+ * @brief   Conditional Variables APIs.
+ * @details If enabled then the conditional variables APIs are included
+ *          in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ * @note    Requires @p CH_CFG_USE_MUTEXES.
+ */
+#if !defined(CH_CFG_USE_CONDVARS)
+#define CH_CFG_USE_CONDVARS                 FALSE
+#endif
+
+/**
+ * @brief   Conditional Variables APIs with timeout.
+ * @details If enabled then the conditional variables APIs with timeout
+ *          specification are included in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ * @note    Requires @p CH_CFG_USE_CONDVARS.
+ */
+#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
+#define CH_CFG_USE_CONDVARS_TIMEOUT         FALSE
+#endif
+
+/**
+ * @brief   Events Flags APIs.
+ * @details If enabled then the event flags APIs are included in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_EVENTS)
+#define CH_CFG_USE_EVENTS                   TRUE
+#endif
+
+/**
+ * @brief   Events Flags APIs with timeout.
+ * @details If enabled then the events APIs with timeout specification
+ *          are included in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ * @note    Requires @p CH_CFG_USE_EVENTS.
+ */
+#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
+#define CH_CFG_USE_EVENTS_TIMEOUT           TRUE
+#endif
+
+/**
+ * @brief   Synchronous Messages APIs.
+ * @details If enabled then the synchronous messages APIs are included
+ *          in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MESSAGES)
+#define CH_CFG_USE_MESSAGES                 FALSE
+#endif
+
+/**
+ * @brief   Synchronous Messages queuing mode.
+ * @details If enabled then messages are served by priority rather than in
+ *          FIFO order.
+ *
+ * @note    The default is @p FALSE. Enable this if you have special
+ *          requirements.
+ * @note    Requires @p CH_CFG_USE_MESSAGES.
+ */
+#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
+#define CH_CFG_USE_MESSAGES_PRIORITY        FALSE
+#endif
+
+/**
+ * @brief   Mailboxes APIs.
+ * @details If enabled then the asynchronous messages (mailboxes) APIs are
+ *          included in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ * @note    Requires @p CH_CFG_USE_SEMAPHORES.
+ */
+#if !defined(CH_CFG_USE_MAILBOXES)
+#define CH_CFG_USE_MAILBOXES                FALSE
+#endif
+
+/**
+ * @brief   Core Memory Manager APIs.
+ * @details If enabled then the core memory manager APIs are included
+ *          in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MEMCORE)
+#define CH_CFG_USE_MEMCORE                  FALSE
+#endif
+
+/**
+ * @brief   Heap Allocator APIs.
+ * @details If enabled then the memory heap allocator APIs are included
+ *          in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ * @note    Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
+ *          @p CH_CFG_USE_SEMAPHORES.
+ * @note    Mutexes are recommended.
+ */
+#if !defined(CH_CFG_USE_HEAP)
+#define CH_CFG_USE_HEAP                     FALSE
+#endif
+
+/**
+ * @brief   Memory Pools Allocator APIs.
+ * @details If enabled then the memory pools allocator APIs are included
+ *          in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MEMPOOLS)
+#define CH_CFG_USE_MEMPOOLS                 FALSE
+#endif
+
+/**
+ * @brief  Objects FIFOs APIs.
+ * @details If enabled then the objects FIFOs APIs are included
+ *          in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_OBJ_FIFOS)
+#define CH_CFG_USE_OBJ_FIFOS                FALSE
+#endif
+
+/**
+ * @brief   Dynamic Threads APIs.
+ * @details If enabled then the dynamic threads creation APIs are included
+ *          in the kernel.
+ *
+ * @note    The default is @p TRUE.
+ * @note    Requires @p CH_CFG_USE_WAITEXIT.
+ * @note    Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
+ */
+#if !defined(CH_CFG_USE_DYNAMIC)
+#define CH_CFG_USE_DYNAMIC                  FALSE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Objects factory options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief   Objects Factory APIs.
+ * @details If enabled then the objects factory APIs are included in the
+ *          kernel.
+ *
+ * @note    The default is @p FALSE.
+ */
+#if !defined(CH_CFG_USE_FACTORY)
+#define CH_CFG_USE_FACTORY                  FALSE
+#endif
+
+/**
+ * @brief   Maximum length for object names.
+ * @details If the specified length is zero then the name is stored by
+ *          pointer but this could have unintended side effects.
+ */
+#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH)
+#define CH_CFG_FACTORY_MAX_NAMES_LENGTH     8
+#endif
+
+/**
+ * @brief   Enables the registry of generic objects.
+ */
+#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY)
+#define CH_CFG_FACTORY_OBJECTS_REGISTRY     TRUE
+#endif
+
+/**
+ * @brief   Enables factory for generic buffers.
+ */
+#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
+#define CH_CFG_FACTORY_GENERIC_BUFFERS      TRUE
+#endif
+
+/**
+ * @brief   Enables factory for semaphores.
+ */
+#if !defined(CH_CFG_FACTORY_SEMAPHORES)
+#define CH_CFG_FACTORY_SEMAPHORES           TRUE
+#endif
+
+/**
+ * @brief   Enables factory for mailboxes.
+ */
+#if !defined(CH_CFG_FACTORY_MAILBOXES)
+#define CH_CFG_FACTORY_MAILBOXES            TRUE
+#endif
+
+/**
+ * @brief   Enables factory for objects FIFOs.
+ */
+#if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
+#define CH_CFG_FACTORY_OBJ_FIFOS            TRUE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Debug options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief   Debug option, kernel statistics.
+ *
+ * @note    The default is @p FALSE.
+ */
+#if !defined(CH_DBG_STATISTICS)
+#define CH_DBG_STATISTICS                   FALSE
+#endif
+
+/**
+ * @brief   Debug option, system state check.
+ * @details If enabled the correct call protocol for system APIs is checked
+ *          at runtime.
+ *
+ * @note    The default is @p FALSE.
+ */
+#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
+#define CH_DBG_SYSTEM_STATE_CHECK           FALSE
+#endif
+
+/**
+ * @brief   Debug option, parameters checks.
+ * @details If enabled then the checks on the API functions input
+ *          parameters are activated.
+ *
+ * @note    The default is @p FALSE.
+ */
+#if !defined(CH_DBG_ENABLE_CHECKS)
+#define CH_DBG_ENABLE_CHECKS                FALSE
+#endif
+
+/**
+ * @brief   Debug option, consistency checks.
+ * @details If enabled then all the assertions in the kernel code are
+ *          activated. This includes consistency checks inside the kernel,
+ *          runtime anomalies and port-defined checks.
+ *
+ * @note    The default is @p FALSE.
+ */
+#if !defined(CH_DBG_ENABLE_ASSERTS)
+#define CH_DBG_ENABLE_ASSERTS               TRUE
+#endif
+
+/**
+ * @brief   Debug option, trace buffer.
+ * @details If enabled then the trace buffer is activated.
+ *
+ * @note    The default is @p CH_DBG_TRACE_MASK_DISABLED.
+ */
+#if !defined(CH_DBG_TRACE_MASK)
+#define CH_DBG_TRACE_MASK                   CH_DBG_TRACE_MASK_DISABLED
+#endif
+
+/**
+ * @brief   Trace buffer entries.
+ * @note    The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
+ *          different from @p CH_DBG_TRACE_MASK_DISABLED.
+ */
+#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
+#define CH_DBG_TRACE_BUFFER_SIZE            128
+#endif
+
+/**
+ * @brief   Debug option, stack checks.
+ * @details If enabled then a runtime stack check is performed.
+ *
+ * @note    The default is @p FALSE.
+ * @note    The stack check is performed in a architecture/port dependent way.
+ *          It may not be implemented or some ports.
+ * @note    The default failure mode is to halt the system with the global
+ *          @p panic_msg variable set to @p NULL.
+ */
+#if !defined(CH_DBG_ENABLE_STACK_CHECK)
+#define CH_DBG_ENABLE_STACK_CHECK           TRUE
+#endif
+
+/**
+ * @brief   Debug option, stacks initialization.
+ * @details If enabled then the threads working area is filled with a byte
+ *          value when a thread is created. This can be useful for the
+ *          runtime measurement of the used stack.
+ *
+ * @note    The default is @p FALSE.
+ */
+#if !defined(CH_DBG_FILL_THREADS)
+#define CH_DBG_FILL_THREADS                 TRUE
+#endif
+
+/**
+ * @brief   Debug option, threads profiling.
+ * @details If enabled then a field is added to the @p thread_t structure that
+ *          counts the system ticks occurred while executing the thread.
+ *
+ * @note    The default is @p FALSE.
+ * @note    This debug option is not currently compatible with the
+ *          tickless mode.
+ */
+#if !defined(CH_DBG_THREADS_PROFILING)
+#define CH_DBG_THREADS_PROFILING            FALSE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Kernel hooks
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief   System structure extension.
+ * @details User fields added to the end of the @p ch_system_t structure.
+ */
+#define CH_CFG_SYSTEM_EXTRA_FIELDS                                          \
+  /* Add threads custom fields here.*/
+
+/**
+ * @brief   System initialization hook.
+ * @details User initialization code added to the @p chSysInit() function
+ *          just before interrupts are enabled globally.
+ */
+#define CH_CFG_SYSTEM_INIT_HOOK(tp) {                                       \
+  /* Add threads initialization code here.*/                                \
+}
+
+/**
+ * @brief   Threads descriptor structure extension.
+ * @details User fields added to the end of the @p thread_t structure.
+ */
+#define CH_CFG_THREAD_EXTRA_FIELDS                                          \
+  /* Add threads custom fields here.*/
+
+/**
+ * @brief   Threads initialization hook.
+ * @details User initialization code added to the @p _thread_init() function.
+ *
+ * @note    It is invoked from within @p _thread_init() and implicitly from all
+ *          the threads creation APIs.
+ */
+#define CH_CFG_THREAD_INIT_HOOK(tp) {                                       \
+  /* Add threads initialization code here.*/                                \
+}
+
+/**
+ * @brief   Threads finalization hook.
+ * @details User finalization code added to the @p chThdExit() API.
+ */
+#define CH_CFG_THREAD_EXIT_HOOK(tp) {                                       \
+  /* Add threads finalization code here.*/                                  \
+}
+
+/**
+ * @brief   Context switch hook.
+ * @details This hook is invoked just before switching between threads.
+ */
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) {                              \
+  /* Context switch code here.*/                                            \
+}
+
+/**
+ * @brief   ISR enter hook.
+ */
+#define CH_CFG_IRQ_PROLOGUE_HOOK() {                                        \
+  /* IRQ prologue code here.*/                                              \
+}
+
+/**
+ * @brief   ISR exit hook.
+ */
+#define CH_CFG_IRQ_EPILOGUE_HOOK() {                                        \
+  /* IRQ epilogue code here.*/                                              \
+}
+
+/**
+ * @brief   Idle thread enter hook.
+ * @note    This hook is invoked within a critical zone, no OS functions
+ *          should be invoked from here.
+ * @note    This macro can be used to activate a power saving mode.
+ */
+#define CH_CFG_IDLE_ENTER_HOOK() {                                          \
+  /* Idle-enter code here.*/                                                \
+}
+
+/**
+ * @brief   Idle thread leave hook.
+ * @note    This hook is invoked within a critical zone, no OS functions
+ *          should be invoked from here.
+ * @note    This macro can be used to deactivate a power saving mode.
+ */
+#define CH_CFG_IDLE_LEAVE_HOOK() {                                          \
+  /* Idle-leave code here.*/                                                \
+}
+
+/**
+ * @brief   Idle Loop hook.
+ * @details This hook is continuously invoked by the idle thread loop.
+ */
+#define CH_CFG_IDLE_LOOP_HOOK() {                                           \
+  /* Idle loop code here.*/                                                 \
+}
+
+/**
+ * @brief   System tick event hook.
+ * @details This hook is invoked in the system tick handler immediately
+ *          after processing the virtual timers queue.
+ */
+#define CH_CFG_SYSTEM_TICK_HOOK() {                                         \
+  /* System tick event code here.*/                                         \
+}
+
+/**
+ * @brief   System halt hook.
+ * @details This hook is invoked in case to a system halting error before
+ *          the system is halted.
+ */
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) {                                   \
+  /* System halt code here.*/                                               \
+}
+
+/**
+ * @brief   Trace hook.
+ * @details This hook is invoked each time a new record is written in the
+ *          trace buffer.
+ */
+#define CH_CFG_TRACE_HOOK(tep) {                                            \
+  /* Trace code here.*/                                                     \
+}
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Port specific settings
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief   NVIC VTOR initialization offset.
+ * @details On initialization, the code at this address in the flash memory will be executed.
+ */
+#define CORTEX_VTOR_INIT 0x00008000U
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name other
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief   Flag to enable/disable floating point support in chprinf()
+ */
+#define CHPRINTF_USE_FLOAT                  TRUE
+
+/** @} */
+
+#endif  /* CHCONF_H */
+
+/** @} */
diff --git a/modules/PowerManagement_1-1/halconf.h b/modules/PowerManagement_1-1/halconf.h
index b97e72b..ed81a78 100644
--- a/modules/PowerManagement_1-1/halconf.h
+++ b/modules/PowerManagement_1-1/halconf.h
@@ -62,7 +62,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
  * @brief   Enables the EXT subsystem.
  */
 #if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
-#define HAL_USE_EXT                 TRUE
+#define HAL_USE_EXT                 FALSE
 #endif
 
 /**
diff --git a/modules/PowerManagement_1-1/module.c b/modules/PowerManagement_1-1/module.c
index eae82ee..2c0146b 100644
--- a/modules/PowerManagement_1-1/module.c
+++ b/modules/PowerManagement_1-1/module.c
@@ -29,14 +29,11 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 /**
  * @brief   Interrupt service routine callback for I/O interrupt signals.
  *
- * @param   extp      EXT driver to handle the ISR.
- * @param   channel   Channel on which the interrupt was encountered.
+ * @param   args      Channel on which the interrupt was encountered.
  */
-static void _moduleIsrCallback(EXTDriver* extp, expchannel_t channel) {
-  (void)extp;
-
+static void _modulePalIsrCallback(void *args) {
   chSysLockFromISR();
-  chEvtBroadcastFlagsI(&aos.events.io, (1 << channel));
+  chEvtBroadcastFlagsI(&aos.events.io, (1 << (*(uint16_t*)args)));
   chSysUnlockFromISR();
 
   return;
@@ -72,101 +69,124 @@ CANConfig moduleHalCanConfig = {
   /* btr  */ CAN_BTR_SJW(1) | CAN_BTR_TS2(3) | CAN_BTR_TS1(15) | CAN_BTR_BRP(1),
 };
 
-EXTConfig moduleHalExtConfig = {
-  /* channel configrations */ {
-    /* channel  0 */ { // IR_INT1_N: must be enabled explicitely
-      /* mode     */ EXT_MODE_GPIOB | APAL2CH_EDGE(VCNL4020_LLD_INT_EDGE),
-      /* callback */ _moduleIsrCallback,
-    },
-    /* channel  1 */ { // GAUGE_BATLOW1: must be enabled explicitely
-      /* mode     */ EXT_MODE_GPIOC | EXT_CH_MODE_RISING_EDGE,
-      /* callback */ _moduleIsrCallback,
-    },
-    /* channel  2 */ { // GAUGE_BATDG1_N: must be enabled expliciety
-      /* mode     */ EXT_MODE_GPIOC | EXT_CH_MODE_RISING_EDGE,
-      /* callback */ _moduleIsrCallback,
-    },
-    /* channel  3 */ { // SYS_UART_DN: automatic interrupt on event
-      /* mode     */ EXT_MODE_GPIOB | EXT_CH_MODE_BOTH_EDGES | EXT_CH_MODE_AUTOSTART,
-      /* callback */ _moduleIsrCallback,
-    },
-    /* channel  4 */ { // IR_INT2_N: must be enabled explicitely
-      /* mode     */ EXT_MODE_GPIOC | APAL2CH_EDGE(VCNL4020_LLD_INT_EDGE),
-      /* callback */ _moduleIsrCallback,
-    },
-    /* channel  5 */ { // TOUCH_INT: must be enabled explicitely
-      /* mode     */ EXT_MODE_GPIOC | APAL2CH_EDGE(MPR121_LLD_INT_EDGE),
-      /* callback */ _moduleIsrCallback,
-    },
-    /* channel  6 */ { // GAUGE_BATLOW2: must be enabled explicitely
-      /* mode     */ EXT_MODE_GPIOB | EXT_CH_MODE_RISING_EDGE,
-      /* callback */ _moduleIsrCallback,
+aos_interrupt_cfg_t moduleIntConfig[14] = {
+    /* channel  1 */ { // IR_INT1_N: must be enabled explicitely
+      /* port     */ GPIOB,
+      /* pad      */ GPIOB_IR_INT1_N,
+      /* flags    */ 0,
+      /* mode     */ APAL2CH_EDGE(VCNL4020_LLD_INT_EDGE),
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 1,
     },
-    /* channel  7 */ { // GAUGE_BATDG2_N: must be enabled expliciety
-      /* mode     */ EXT_MODE_GPIOB | EXT_CH_MODE_RISING_EDGE,
-      /* callback */ _moduleIsrCallback,
+    /* channel  2 */ { // GAUGE_BATLOW1: must be enabled explicitely
+      /* port     */ GPIOC,
+      /* pad      */ GPIOC_GAUGE_BATLOW1,
+      /* flags    */ 0,
+      /* mode     */ PAL_EVENT_MODE_RISING_EDGE,
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 2,
     },
-    /* channel  8 */ { // PATH_DC: must be enabled explicitely
-      /* mode     */ EXT_MODE_GPIOC | EXT_CH_MODE_BOTH_EDGES,
-      /* callback */ _moduleIsrCallback,
+    /* channel  3 */ { // GAUGE_BATGD1_N: must be enabled explicitely
+      /* port     */ GPIOC,
+      /* pad      */ GPIOC_GAUGE_BATGD1_N,
+      /* flags    */ 0,
+      /* mode     */ PAL_EVENT_MODE_RISING_EDGE,
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 3,
     },
-    /* channel  9 */ { // SYS_SPI_DIR: must be enabled explicitely
-      /* mode     */ EXT_MODE_GPIOC | EXT_CH_MODE_BOTH_EDGES,
-      /* callback */ _moduleIsrCallback,
+    /* channel  4 */ { // SYS_UART_DN: automatic interrupt on event
+      /* port     */ GPIOB,
+      /* pad      */ GPIOB_SYS_UART_DN,
+      /* flags    */ AOS_INTERRUPT_AUTOSTART,
+      /* mode     */ PAL_EVENT_MODE_BOTH_EDGES,
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 4,
     },
-    /* channel 10 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
+    /* channel  5 */ { // IR_INT2_N: must be enabled explicitely
+      /* port     */ GPIOC,
+      /* pad      */ GPIOC_IR_INT2_N,
+      /* flags    */ 0,
+      /* mode     */ APAL2CH_EDGE(VCNL4020_LLD_INT_EDGE),
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 5,
     },
-    /* channel 11 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
+    /* channel  6 */ { // TOUCH_INT: must be enabled explicitely
+      /* port     */ GPIOC,
+      /* pad      */ GPIOC_TOUCH_INT_N,
+      /* flags    */ 0,
+      /* mode     */ APAL2CH_EDGE(MPR121_LLD_INT_EDGE),
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 6,
     },
-    /* channel 12 */ { // SYS_SYNC_N: automatic interrupt on event
-      /* mode     */ EXT_MODE_GPIOC | EXT_CH_MODE_BOTH_EDGES | EXT_CH_MODE_AUTOSTART,
-      /* callback */ _moduleIsrCallback,
+    /* channel  7 */ { // GAUGE_BATLOW2: must be enabled explicitely
+      /* port     */ GPIOB,
+      /* pad      */ GPIOB_GAUGE_BATLOW2,
+      /* flags    */ 0,
+      /* mode     */ PAL_EVENT_MODE_RISING_EDGE,
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 7,
     },
-    /* channel 13 */ { // SYS_PD_N: automatic interrupt when activated
-      /* mode     */ EXT_MODE_GPIOC | EXT_CH_MODE_FALLING_EDGE | EXT_CH_MODE_AUTOSTART,
-      /* callback */ _moduleIsrCallback,
+    /* channel  8 */ { // GAUGE_BATGD2_N: must be enabled explicitely
+      /* port     */ GPIOB,
+      /* pad      */ GPIOB_GAUGE_BATGD2_N,
+      /* flags    */ 0,
+      /* mode     */ PAL_EVENT_MODE_RISING_EDGE,
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 8,
     },
-    /* channel 14 */ { // SYS_WARMRST_N: automatic interrupt when activated
-      /* mode     */ EXT_MODE_GPIOC | EXT_CH_MODE_FALLING_EDGE | EXT_CH_MODE_AUTOSTART,
-      /* callback */ _moduleIsrCallback,
+    /* channel  9 */ { // PATH_DC: must be enabled explicitely
+      /* port     */ GPIOC,
+      /* pad      */ GPIOC_PATH_DC,
+      /* flags    */ 0,
+      /* mode     */ PAL_EVENT_MODE_BOTH_EDGES,
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 9,
     },
-    /* channel 15 */ { // SYS_UART_UP: automatic interrupt on event
-      /* mode     */ EXT_MODE_GPIOB| EXT_CH_MODE_BOTH_EDGES | EXT_CH_MODE_AUTOSTART,
-      /* callback */ _moduleIsrCallback,
+    /* channel 10 */ { // SYS_SPI_DIR: must be enabled explicitely
+      /* port     */ GPIOC,
+      /* pad      */ GPIOC_SYS_SPI_DIR,
+      /* flags    */ 0,
+      /* mode     */ PAL_EVENT_MODE_BOTH_EDGES,
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 10,
     },
-    /* channel 16 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
+    /* channel 11 */ { // SYS_SYNC_N: must be enabled explicitely
+      /* port     */ GPIOC,
+      /* pad      */ GPIOC_SYS_INT_N, // TODO: check this
+      /* flags    */ AOS_INTERRUPT_AUTOSTART,
+      /* mode     */ PAL_EVENT_MODE_BOTH_EDGES,
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 11,
     },
-    /* channel 17 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
+    /* channel 12 */ { // SYS_PD_N: must be enabled explicitely
+      /* port     */ GPIOC,
+      /* pad      */ GPIOC_SYS_PD_N,
+      /* flags    */ AOS_INTERRUPT_AUTOSTART,
+      /* mode     */ PAL_EVENT_MODE_FALLING_EDGE,
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 12,
     },
-    /* channel 18 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
+    /* channel 13 */ { // SYS_WARMRST_N: must be enabled explicitely
+      /* port     */ GPIOC,
+      /* pad      */ GPIOC_SYS_WARMRST_N,
+      /* flags    */ AOS_INTERRUPT_AUTOSTART,
+      /* mode     */ PAL_EVENT_MODE_FALLING_EDGE,
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 13,
     },
-    /* channel 19 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
+    /* channel 14 */ { // SYS_UART_UP: must be enabled explicitely
+      /* port     */ GPIOB,
+      /* pad      */ GPIOB_SYS_UART_UP,
+      /* flags    */ AOS_INTERRUPT_AUTOSTART,
+      /* mode     */ PAL_EVENT_MODE_BOTH_EDGES,
+      /* callback */ _modulePalIsrCallback,
+      /* cb arg   */ 14,
     },
-    /* channel 20 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
-    },
-    /* channel 21 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
-    },
-    /* channel 22 */ {
-      /* mode     */ EXT_CH_MODE_DISABLED,
-      /* callback */ NULL,
-    },
-  },
+};
+
+aos_interrupt_driver_t moduleIntDriver = {
+  /* config     */ NULL,
+  /* interrupts */ 14,
 };
 
 I2CConfig moduleHalI2cProxPm18Pm33GaugeRearConfig = {
@@ -879,15 +899,16 @@ static int _utShellCmdCb_AlldMpr121(BaseSequentialStream* stream, int argc, char
 {
   (void)argc;
   (void)argv;
-  extChannelEnable(&MODULE_HAL_EXT, MODULE_GPIO_EXTCHANNEL_TOUCHINT);
+  aosIntEnable(&moduleIntDriver, MODULE_GPIO_INT_TOUCHINT);
   aosUtRun(stream, &moduleUtAlldMpr121, NULL);
+  aosIntDisable(&moduleIntDriver, MODULE_GPIO_INT_TOUCHINT);
   return AOS_OK;
 }
 static ut_mpr121data_t _utAlldMpr121Data= {
   /* MPR121 driver  */ &moduleLldTouch,
   /* timeout        */ MICROSECONDS_PER_SECOND,
   /* event source   */ &aos.events.io,
-  /* event flags    */ (1 << MODULE_GPIO_EXTCHANNEL_TOUCHINT),
+  /* event flags    */ (1 << MODULE_GPIO_INT_TOUCHINT),
 };
 aos_unittest_t moduleUtAlldMpr121 = {
   /* name           */ "MPR121",
@@ -1061,8 +1082,8 @@ static int _utShellCmdCb_AlldVcnl4020(BaseSequentialStream* stream, int argc, ch
       case WNW:
         mux = &moduleLldI2cMultiplexer1;
         ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->vcnld = &moduleLldProximity1;
-        ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->evtflags = (1 << MODULE_GPIO_EXTCHANNEL_IRINT2);
-        extChannelEnable(&MODULE_HAL_EXT, MODULE_GPIO_EXTCHANNEL_IRINT2);
+        ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->evtflags = (1 << MODULE_GPIO_INT_IRINT2);
+        aosIntEnable(&moduleIntDriver, MODULE_GPIO_INT_IRINT2);
         break;
       case NNW:
       case NNE:
@@ -1070,8 +1091,8 @@ static int _utShellCmdCb_AlldVcnl4020(BaseSequentialStream* stream, int argc, ch
       case ESE:
         mux = &moduleLldI2cMultiplexer2;
         ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->vcnld = &moduleLldProximity2;
-        ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->evtflags = (1 << MODULE_GPIO_EXTCHANNEL_IRINT1);
-        extChannelEnable(&MODULE_HAL_EXT, MODULE_GPIO_EXTCHANNEL_IRINT1);
+        ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->evtflags = (1 << MODULE_GPIO_INT_IRINT1);
+        aosIntEnable(&moduleIntDriver, MODULE_GPIO_INT_IRINT1);
         break;
       default:
         break;
@@ -1088,34 +1109,42 @@ static int _utShellCmdCb_AlldVcnl4020(BaseSequentialStream* stream, int argc, ch
       case NNE:
         pca9544a_lld_setchannel(mux, PCA9544A_LLD_CH1, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
         aosUtRun(stream, &moduleUtAlldVcnl4020, "north-northeast sensor");
+        aosIntDisable(&moduleIntDriver, MODULE_GPIO_INT_IRINT1);
         break;
       case ENE:
         pca9544a_lld_setchannel(mux, PCA9544A_LLD_CH3, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
         aosUtRun(stream, &moduleUtAlldVcnl4020, "east-northeast sensor");
+        aosIntDisable(&moduleIntDriver, MODULE_GPIO_INT_IRINT1);
         break;
       case ESE:
         pca9544a_lld_setchannel(mux, PCA9544A_LLD_CH2, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
         aosUtRun(stream, &moduleUtAlldVcnl4020, "north-southeast sensor");
+        aosIntDisable(&moduleIntDriver, MODULE_GPIO_INT_IRINT1);
         break;
       case SSE:
         pca9544a_lld_setchannel(mux, PCA9544A_LLD_CH0, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
         aosUtRun(stream, &moduleUtAlldVcnl4020, "south-southeast sensor");
+        aosIntDisable(&moduleIntDriver, MODULE_GPIO_INT_IRINT2);
         break;
       case SSW:
         pca9544a_lld_setchannel(mux, PCA9544A_LLD_CH1, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
         aosUtRun(stream, &moduleUtAlldVcnl4020, "south-southwest sensor");
+        aosIntDisable(&moduleIntDriver, MODULE_GPIO_INT_IRINT2);
         break;
       case WSW:
         pca9544a_lld_setchannel(mux, PCA9544A_LLD_CH3, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
         aosUtRun(stream, &moduleUtAlldVcnl4020, "west-southwest sensor");
+        aosIntDisable(&moduleIntDriver, MODULE_GPIO_INT_IRINT2);
         break;
       case WNW:
         pca9544a_lld_setchannel(mux, PCA9544A_LLD_CH2, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
         aosUtRun(stream, &moduleUtAlldVcnl4020, "west-northwest sensor");
+        aosIntDisable(&moduleIntDriver, MODULE_GPIO_INT_IRINT2);
         break;
       case NNW:
         pca9544a_lld_setchannel(mux, PCA9544A_LLD_CH0, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
         aosUtRun(stream, &moduleUtAlldVcnl4020, "north-northwest sensor");
+        aosIntDisable(&moduleIntDriver, MODULE_GPIO_INT_IRINT1);
         break;
       default:
         break;
diff --git a/modules/PowerManagement_1-1/module.h b/modules/PowerManagement_1-1/module.h
index 2f54e73..6716029 100644
--- a/modules/PowerManagement_1-1/module.h
+++ b/modules/PowerManagement_1-1/module.h
@@ -62,6 +62,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 /*===========================================================================*/
 #include <hal.h>
+#include <aos_interrupts.h>
 
 /**
  * @brief   ADC driver for reading the system voltage.
@@ -84,14 +85,15 @@ extern ADCConversionGroup moduleHalAdcVsysConversionGroup;
 extern CANConfig moduleHalCanConfig;
 
 /**
- * @brief   Interrupt driver to use.
+ * @brief   Interrupt driver (PAL).
  */
-#define MODULE_HAL_EXT                          EXTD1
+
+extern aos_interrupt_driver_t moduleIntDriver;
 
 /**
- * @brief   Interrupt driver configuration.
+ * @brief   Interrupt driver config.
  */
-extern EXTConfig moduleHalExtConfig;
+extern aos_interrupt_cfg_t moduleIntConfig[14];
 
 /**
  * @brief   I2C driver to access multiplexer, proximity sensors 1 to 4, power monitors for VIO1.8 and VIO 3.3, and fuel gauge (rear battery).
@@ -156,72 +158,72 @@ extern SerialConfig moduleHalProgIfConfig;
 /**
  * @brief   Interrupt channel for the IR_INT1 and CHARGE_STAT1A signals.
  */
-#define MODULE_GPIO_EXTCHANNEL_IRINT1           ((expchannel_t)0)
+#define MODULE_GPIO_INT_IRINT1           ((uint8_t)1)
 
 /**
  * @brief   Interrupt channel for the GAUGE_BATLOW1 signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_GAUGEBATLOW1     ((expchannel_t)1)
+#define MODULE_GPIO_INT_GAUGEBATLOW1     ((uint8_t)2)
 
 /**
  * @brief   Interrupt channel for the GAUGE_BATGD1 signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_GAUGEBATGD1      ((expchannel_t)2)
+#define MODULE_GPIO_INT_GAUGEBATGD1      ((uint8_t)3)
 
 /**
  * @brief   Interrupt channel for the SYS_UART_DN signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_SYSUARTDN        ((expchannel_t)3)
+#define MODULE_GPIO_INT_SYSUARTDN        ((uint8_t)4)
 
 /**
  * @brief   Interrupt channel for the IR_INT2 and CHARGE_STAT2A signals.
  */
-#define MODULE_GPIO_EXTCHANNEL_IRINT2           ((expchannel_t)4)
+#define MODULE_GPIO_INT_IRINT2           ((uint8_t)5)
 
 /**
  * @brief   Interrupt channel for the TOUCH_INT signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_TOUCHINT         ((expchannel_t)5)
+#define MODULE_GPIO_INT_TOUCHINT         ((uint8_t)6)
 
 /**
  * @brief   Interrupt channel for the GAUGE_BATLOW2 signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_GAUGEBATLOW2     ((expchannel_t)6)
+#define MODULE_GPIO_INT_GAUGEBATLOW2     ((uint8_t)7)
 
 /**
  * @brief   Interrupt channel for the GAUGE_BATGD2 signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_GAUGEBATGD2      ((expchannel_t)7)
+#define MODULE_GPIO_INT_GAUGEBATGD2      ((uint8_t)8)
 
 /**
  * @brief   Interrupt channel for the PATH_DC signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_PATHDC           ((expchannel_t)8)
+#define MODULE_GPIO_INT_PATHDC           ((uint8_t)9)
 
 /**
  * @brief   Interrupt channel for the SYS_SPI_DIR signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_SYSSPIDIR        ((expchannel_t)9)
+#define MODULE_GPIO_INT_SYSSPIDIR        ((uint8_t)10)
 
 /**
  * @brief   Interrupt channel for the SYS_SYNC signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_SYSSYNC          ((expchannel_t)12)
+#define MODULE_GPIO_INT_SYSSYNC          ((uint8_t)11)
 
 /**
  * @brief   Interrupt channel for the SYS_PD signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_SYSPD            ((expchannel_t)13)
+#define MODULE_GPIO_INT_SYSPD            ((uint8_t)12)
 
 /**
  * @brief   Interrupt channel for the SYS_WARMRST signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_SYSWARMRST       ((expchannel_t)14)
+#define MODULE_GPIO_INT_SYSWARMRST       ((uint8_t)13)
 
 /**
  * @brief   Interrupt channel for the SYS_UART_UP signal.
  */
-#define MODULE_GPIO_EXTCHANNEL_SYSUARTUP        ((expchannel_t)15)
+#define MODULE_GPIO_INT_SYSUARTUP        ((uint8_t)14)
 
 /**
  * @brief   SYS_REG_EN output signal GPIO.
@@ -355,72 +357,72 @@ extern apalGpio_t moduleGpioChargeEn2;
 /**
  * @brief   Event flag to be set on a IR_INT1 / CHARGE_STAT1A interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_IRINT1           ((eventflags_t)1 << MODULE_GPIO_EXTCHANNEL_IRINT1)
+#define MODULE_OS_IOEVENTFLAGS_IRINT1           ((eventflags_t)1 << MODULE_GPIO_INT_IRINT1)
 
 /**
  * @brief   Event flag to be set on a GAUGE_BATLOW1 interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_GAUGEBATLOW1     ((eventflags_t)1 << MODULE_GPIO_EXTCHANNEL_GAUGEBATLOW1)
+#define MODULE_OS_IOEVENTFLAGS_GAUGEBATLOW1     ((eventflags_t)1 << MODULE_GPIO_INT_GAUGEBATLOW1)
 
 /**
  * @brief   Event flag to be set on a GAUGE_BATGD1 interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_GAUGEBATGD1      ((eventflags_t)1 << MODULE_GPIO_EXTCHANNEL_GAUGEBATGD1)
+#define MODULE_OS_IOEVENTFLAGS_GAUGEBATGD1      ((eventflags_t)1 << MODULE_GPIO_INT_GAUGEBATGD1)
 
 /**
  * @brief   Event flag to be set on a SYS_UART_DN interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSUARTDN        ((eventflags_t)1 << MODULE_GPIO_EXTCHANNEL_SYSUARTDN)
+#define MODULE_OS_IOEVENTFLAGS_SYSUARTDN        ((eventflags_t)1 << MODULE_GPIO_INT_SYSUARTDN)
 
 /**
  * @brief   Event flag to be set on a IR_INT2 / CHARGE_STAT2A interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_IRINT2           ((eventflags_t)1 << MODULE_GPIO_EXTCHANNEL_IRINT2)
+#define MODULE_OS_IOEVENTFLAGS_IRINT2           ((eventflags_t)1 << MODULE_GPIO_INT_IRINT2)
 
 /**
  * @brief   Event flag to be set on a TOUCH_INT interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_TOUCHINT         ((eventflags_t)1 << MODULE_GPIO_EXTCHANNEL_TOUCHINT)
+#define MODULE_OS_IOEVENTFLAGS_TOUCHINT         ((eventflags_t)1 << MODULE_GPIO_INT_TOUCHINT)
 
 /**
  * @brief   Event flag to be set on a GAUGE_BATLOW2 interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_GAUGEBATLOW2     ((eventflags_t)1 << MODULE_GPIO_EXTCHANNEL_GAUGEBATLOW2)
+#define MODULE_OS_IOEVENTFLAGS_GAUGEBATLOW2     ((eventflags_t)1 << MODULE_GPIO_INT_GAUGEBATLOW2)
 
 /**
  * @brief   Event flag to be set on a GAUGE_BATGD2 interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_GAUGEBATGD2      ((eventflags_t)1 << MODULE_GPIO_EXTCHANNEL_GAUGEBATGD2)
+#define MODULE_OS_IOEVENTFLAGS_GAUGEBATGD2      ((eventflags_t)1 << MODULE_GPIO_INT_GAUGEBATGD2)
 
 /**
  * @brief   Event flag to be set on a PATH_DC interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_PATHDC           ((eventflags_t)1 << MODULE_GPIO_EXTCHANNEL_PATHDC)
+#define MODULE_OS_IOEVENTFLAGS_PATHDC           ((eventflags_t)1 << MODULE_GPIO_INT_PATHDC)
 
 /**
  * @brief   Event flag to be set on a SYS_SPI_DIR interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSSPIDIR        ((eventflags_t)1 << MODULE_GPIO_EXTCHANNEL_SYSSPIDIR)
+#define MODULE_OS_IOEVENTFLAGS_SYSSPIDIR        ((eventflags_t)1 << MODULE_GPIO_INT_SYSSPIDIR)
 
 /**
  * @brief   Event flag to be set on a SYS_SYNC interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSSYNC          ((eventflags_t)1 << MODULE_GPIO_EXTCHANNEL_SYSSYNC)
+#define MODULE_OS_IOEVENTFLAGS_SYSSYNC          ((eventflags_t)1 << MODULE_GPIO_INT_SYSSYNC)
 
 /**
  * @brief   Event flag to be set on a SYS_PD interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSPD            ((eventflags_t)1 << MODULE_GPIO_EXTCHANNEL_SYSPD)
+#define MODULE_OS_IOEVENTFLAGS_SYSPD            ((eventflags_t)1 << MODULE_GPIO_INT_SYSPD)
 
 /**
  * @brief   Event flag to be set on a SYS_WARMRST interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSWARMRST       ((eventflags_t)1 << MODULE_GPIO_EXTCHANNEL_SYSWARMRST)
+#define MODULE_OS_IOEVENTFLAGS_SYSWARMRST       ((eventflags_t)1 << MODULE_GPIO_INT_SYSWARMRST)
 
 /**
  * @brief   Event flag to be set on a SYS_UART_UP interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSUARTUP        ((eventflags_t)1 << MODULE_GPIO_EXTCHANNEL_SYSUARTUP)
+#define MODULE_OS_IOEVENTFLAGS_SYSUARTUP        ((eventflags_t)1 << MODULE_GPIO_INT_SYSUARTUP)
 
 #if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__)
 /**
diff --git a/os/core/core.mk b/os/core/core.mk
index 9bc01a8..ea94bd8 100644
--- a/os/core/core.mk
+++ b/os/core/core.mk
@@ -37,7 +37,8 @@ AMIROOSCORECSRC = $(AMIROOS_CORE_DIR)src/aos_debug.c \
                   $(AMIROOS_CORE_DIR)src/aos_thread.c \
                   $(AMIROOS_CORE_DIR)src/aos_time.c \
                   $(AMIROOS_CORE_DIR)src/aos_timer.c \
-                  $(AMIROOS_CORE_DIR)src/aos_unittest.c
+                  $(AMIROOS_CORE_DIR)src/aos_unittest.c \
+                  $(AMIROOS_CORE_DIR)src/aos_interrupts.c \
 
 # C++ source files
 AMIROOSCORECPPSRC = $(AMIROOS_CORE_DIR)src/aos_main.cpp
diff --git a/os/core/inc/aos_interrupts.h b/os/core/inc/aos_interrupts.h
new file mode 100644
index 0000000..cd5075c
--- /dev/null
+++ b/os/core/inc/aos_interrupts.h
@@ -0,0 +1,61 @@
+/*
+AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
+Copyright (C) 2016..2018  Thomas Schöpping et al.
+
+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, either version 3 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
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/.
+*/
+
+#ifndef _AMIROOS_INTERRUPTS_H_
+#define _AMIROOS_INTERRUPTS_H_
+
+#include <hal.h>
+
+/**
+ * @brief   Interrupt configuration flag to autostart the interrupt when the interrupt system is started.
+ */
+#define AOS_INTERRUPT_AUTOSTART 0x1u
+
+/**
+ * @brief   Interrupt configuration structure.
+ */
+typedef struct {
+  ioportid_t    port;      /**< Gpio port id. */
+  uint8_t       pad;       /**< Gpio pad.     */
+  uint8_t       flags;     /**< Interrupt configuration flags. */
+  uint8_t       eventmode; /**< Pal event mode. */
+  palcallback_t cb;        /**< Pal callback function. */
+  uint8_t       cb_arg;    /**< Argument for the callback function. */
+} aos_interrupt_cfg_t;
+
+/**
+ * @brief   Interrupt driver structure.
+ */
+typedef struct {
+  aos_interrupt_cfg_t *interrupts; /**< Array of interrupt configurations. */
+  uint8_t len;                     /**< Length of the interrupt configuration array. */
+} aos_interrupt_driver_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+  void aosIntDriverInit(aos_interrupt_driver_t *intd, aos_interrupt_cfg_t *interrupt_cfg);
+  void aosIntDriverStart(aos_interrupt_driver_t *intd);
+  void aosIntDriverStop(aos_interrupt_driver_t *intd);
+  void aosIntEnable(aos_interrupt_driver_t *intd, uint8_t channel);
+  void aosIntDisable(aos_interrupt_driver_t *intd, uint8_t channel);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _AMIROOS_INTERRUPTS_H_ */
diff --git a/os/core/inc/aos_system.h b/os/core/inc/aos_system.h
index bfb4806..f229939 100644
--- a/os/core/inc/aos_system.h
+++ b/os/core/inc/aos_system.h
@@ -23,6 +23,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include <amiro-lld.h>
 #include <aos_shell.h>
 #include <aos_time.h>
+#include <aos_interrupts.h>
 #include <chprintf.h>
 
 /**
@@ -190,7 +191,7 @@ extern "C" {
   void aosSysShutdownInit(aos_shutdown_t shutdown);
   void aosSysStop(void);
   void aosSysDeinit(void);
-  void aosSysShutdownFinal(EXTDriver* extDrv, aos_shutdown_t shutdown);
+  void aosSysShutdownFinal(aos_interrupt_driver_t* intDrv, aos_shutdown_t shutdown);
 #ifdef __cplusplus
 }
 #endif
diff --git a/os/core/inc/aos_thread.h b/os/core/inc/aos_thread.h
index 3ecf8f4..1f369c8 100644
--- a/os/core/inc/aos_thread.h
+++ b/os/core/inc/aos_thread.h
@@ -70,22 +70,22 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 /**
  * @brief   Maximum timeframe that can be slept in system ticks.
  */
-#define AOS_THD_MAX_SLEEP_ST    TIME_MAXIMUM
+#define AOS_THD_MAX_SLEEP_ST    TIME_MAX_INTERVAL
 
 /**
  * @brief   Maximum timeframe that can be slept in seconds.
  */
-#define AOS_THD_MAX_SLEEP_S     (ST2S(AOS_THD_MAX_SLEEP_ST) - 1)
+#define AOS_THD_MAX_SLEEP_S     (TIME_I2S(AOS_THD_MAX_SLEEP_ST) - 1)
 
 /**
  * @brief   Maximum timeframe that can be slept in milliseconds.
  */
-#define AOS_THD_MAX_SLEEP_MS    (ST2MS(AOS_THD_MAX_SLEEP_ST) - 1)
+#define AOS_THD_MAX_SLEEP_MS    (TIME_I2MS(AOS_THD_MAX_SLEEP_ST) - 1)
 
 /**
  * @brief   Maximum timeframe that can be slept in microseconds.
  */
-#define AOS_THD_MAX_SLEEP_US    (ST2US(AOS_THD_MAX_SLEEP_ST) - 1)
+#define AOS_THD_MAX_SLEEP_US    (TIME_I2US(AOS_THD_MAX_SLEEP_ST) - 1)
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/os/core/inc/aos_timer.h b/os/core/inc/aos_timer.h
index 12a49e1..d784b34 100644
--- a/os/core/inc/aos_timer.h
+++ b/os/core/inc/aos_timer.h
@@ -25,22 +25,22 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 /**
  * @brief   Maximum timer interval that can be set in system ticks.
  */
-#define AOS_TIMER_MAX_INTERVAL_ST     TIME_MAXIMUM
+#define AOS_TIMER_MAX_INTERVAL_ST     TIME_MAX_INTERVAL
 
 /**
  * @brief   Maximum timer interval that can be set in seconds.
  */
-#define AOS_TIMER_MAX_INTERVAL_S      (ST2S(AOS_TIMER_MAX_INTERVAL_ST) - 1)
+#define AOS_TIMER_MAX_INTERVAL_S      (TIME_I2S(AOS_TIMER_MAX_INTERVAL_ST) - 1)
 
 /**
  * @brief   Maximum timer interval that can be set in milliseconds.
  */
-#define AOS_TIMER_MAX_INTERVAL_MS     (ST2MS(AOS_TIMER_MAX_INTERVAL_ST) - 1)
+#define AOS_TIMER_MAX_INTERVAL_MS     (TIME_I2MS(AOS_TIMER_MAX_INTERVAL_ST) - 1)
 
 /**
  * @brief   Maximum timer interval that can be set in microseconds.
  */
-#define AOS_TIMER_MAX_INTERVAL_US     (ST2US(AOS_TIMER_MAX_INTERVAL_ST) - 1)
+#define AOS_TIMER_MAX_INTERVAL_US     (TIME_I2US(AOS_TIMER_MAX_INTERVAL_ST) - 1)
 
 /**
  * @brief   Timer stucture.
diff --git a/os/core/src/aos_interrupts.c b/os/core/src/aos_interrupts.c
new file mode 100644
index 0000000..d5ee819
--- /dev/null
+++ b/os/core/src/aos_interrupts.c
@@ -0,0 +1,80 @@
+/*
+AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
+Copyright (C) 2016..2018  Thomas Schöpping et al.
+
+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, either version 3 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
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <aos_interrupts.h>
+
+/**
+ * @brief   Initializes the interrupt driver.
+ *
+ * @param[out]  intd            Interrupt driver object.
+ * @param[in]   interrupt_cfg   Interrupt configuration to be used to initialize the driver.
+ */
+void aosIntDriverInit(aos_interrupt_driver_t *intd, aos_interrupt_cfg_t *interrupt_cfg) {
+  intd->interrupts = interrupt_cfg;
+}
+
+/**
+ * @brief   Starts the interrupt system by setting the pad callbacks and starting the pad events.
+ *
+ * @param[in]   intd    Interrupt driver with an interrupt configuration that specifies which interrupts to start.
+ */
+void aosIntDriverStart(aos_interrupt_driver_t *intd) {
+  irqInit();
+  for (uint8_t i = 0; i < intd->len; i++) {
+    chSysLock();
+    palSetPadCallbackI(intd->interrupts[i].port, intd->interrupts[i].pad, intd->interrupts[i].cb, &intd->interrupts[i].cb_arg);
+    if (intd->interrupts[i].flags & AOS_INTERRUPT_AUTOSTART) {
+      palEnablePadEventI(intd->interrupts[i].port, intd->interrupts[i].pad, intd->interrupts[i].eventmode);
+    }
+    chSysUnlock();
+  }
+}
+
+/**
+ * @brief   Stops the interrupt system.
+ *
+ * @param[in]   intd   All events associated with this driver will be disabled.
+ */
+void aosIntDriverStop(aos_interrupt_driver_t *intd) {
+  for (uint8_t i = 0; i < intd->len; i++) {
+    palDisablePadEvent(intd->interrupts[i].port, intd->interrupts[i].pad);
+  }
+  irqDeinit();
+}
+
+/**
+ * @brief   Enables the events on a specified channel.
+ *
+ * @param[in]   intd    Interrupt driver object.
+ * @param[in]   channel Channel of the interrupt to enable.
+ */
+void aosIntEnable(aos_interrupt_driver_t *intd, uint8_t channel) {
+  channel -= 1;
+  palEnablePadEvent(intd->interrupts[channel].port, intd->interrupts[channel].pad, intd->interrupts[channel].eventmode);
+}
+
+/**
+ * @brief   Disables the events on a specified channel.
+ *
+ * @param[in]   intd    Interrupt driver object.
+ * @param[in]   channel Channel of the interrupt to disable.
+ */
+void aosIntDisable(aos_interrupt_driver_t *intd, uint8_t channel) {
+  channel -= 1;
+  palDisablePadEvent(intd->interrupts[channel].port, intd->interrupts[channel].pad);
+}
diff --git a/os/core/src/aos_iostream.c b/os/core/src/aos_iostream.c
index 8cc5b8f..dfbbd18 100644
--- a/os/core/src/aos_iostream.c
+++ b/os/core/src/aos_iostream.c
@@ -121,6 +121,7 @@ static size_t _channelreadt(void *instance, uint8_t *bp, size_t n, systime_t tim
  * @brief   Virtual methods table for all AosIOChannel objects.
  */
 static const struct AosIOChannelVMT _channelvmt = {
+  (size_t) 0,
   _channelwrite,
   _channelread,
   _channelput,
@@ -200,6 +201,7 @@ static msg_t _streamget(void *instance)
  * @brief   Virtual methods table for all AosIOStream objects.
  */
 static const struct AosIOStreamVMT _streamvmt = {
+  (size_t) 0,
   _streamwrite,
   _stremread,
   _streamput,
diff --git a/os/core/src/aos_main.cpp b/os/core/src/aos_main.cpp
index fa8f5d6..9141f09 100644
--- a/os/core/src/aos_main.cpp
+++ b/os/core/src/aos_main.cpp
@@ -366,7 +366,7 @@ aos_shutdown_t _ssspModuleStackInitialization(void)
     if (flags.wfe) {
       // wait for any event to occur
       aosDbgPrintf("WFE...");
-      eventmask = chEvtWaitAnyTimeout(ALL_EVENTS, LL_US2ST(AOS_SYSTEM_SSSP_TIMEOUT));
+      eventmask = chEvtWaitAnyTimeout(ALL_EVENTS, TIME_US2I(AOS_SYSTEM_SSSP_TIMEOUT));
       aosDbgPrintf("\t0x%08X", eventmask);
     } else {
       aosDbgPrintf("WFE skipped");
@@ -483,13 +483,13 @@ aos_shutdown_t _ssspModuleStackInitialization(void)
           flags.wfe_next = false;
 #else
           // set the timeout timer
-          chVTSet(&timerTimeout, LL_US2ST(AOS_SYSTEM_SSSP_TIMEOUT), _ssspTimerCallback, &eventSourceTimeout);
+          chVTSet(&timerTimeout, TIME_US2I(AOS_SYSTEM_SSSP_TIMEOUT), _ssspTimerCallback, &eventSourceTimeout);
           // proceed
           stage = STAGE_3_3_WAITFORFIRSTID;
 #endif
 #else
           // set the timeout timer
-          chVTSet(&timerTimeout, LL_US2ST(AOS_SYSTEM_SSSP_TIMEOUT), _ssspTimerCallback, &eventSourceTimeout);
+          chVTSet(&timerTimeout, TIME_US2I(AOS_SYSTEM_SSSP_TIMEOUT), _ssspTimerCallback, &eventSourceTimeout);
 #endif
         }
 
@@ -515,7 +515,7 @@ aos_shutdown_t _ssspModuleStackInitialization(void)
             flags.wfe_next = false;
 #else
             // set the timeout timer
-            chVTSet(&timerTimeout, LL_US2ST(AOS_SYSTEM_SSSP_TIMEOUT), _ssspTimerCallback, &eventSourceTimeout);
+            chVTSet(&timerTimeout, TIME_US2I(AOS_SYSTEM_SSSP_TIMEOUT), _ssspTimerCallback, &eventSourceTimeout);
             // proceed
             stage = STAGE_3_3_WAITFORFIRSTID;
 #endif
@@ -556,7 +556,7 @@ aos_shutdown_t _ssspModuleStackInitialization(void)
           stage = STAGE_3_3_WAITFORID;
 #else
           // set the delay timer so the UP signal is activated later
-          chVTSet(&timerDelay, LL_US2ST(AMIROOS_CFG_SSSP_SIGNALDELAY), _ssspTimerCallback, &eventSourceDelay);
+          chVTSet(&timerDelay, TIME_US2I(AMIROOS_CFG_SSSP_SIGNALDELAY), _ssspTimerCallback, &eventSourceDelay);
 #endif
         }
 
@@ -597,7 +597,7 @@ aos_shutdown_t _ssspModuleStackInitialization(void)
               // store received ID
               lastid = _deserialize(canRxFrame.data8, 4);
               // restart timeout timer
-              chVTSet(&timerTimeout, LL_US2ST(AOS_SYSTEM_SSSP_TIMEOUT), _ssspTimerCallback, &eventSourceTimeout);
+              chVTSet(&timerTimeout, TIME_US2I(AOS_SYSTEM_SSSP_TIMEOUT), _ssspTimerCallback, &eventSourceTimeout);
               // proceed
               stage = STAGE_3_3_WAITFORIDORSIG;
             } else {
@@ -633,7 +633,7 @@ aos_shutdown_t _ssspModuleStackInitialization(void)
               // store received ID
               lastid = _deserialize(canRxFrame.data8, 4);
               // restart timeout timer
-              chVTSet(&timerTimeout, LL_US2ST(AOS_SYSTEM_SSSP_TIMEOUT), _ssspTimerCallback, &eventSourceTimeout);
+              chVTSet(&timerTimeout, TIME_US2I(AOS_SYSTEM_SSSP_TIMEOUT), _ssspTimerCallback, &eventSourceTimeout);
             } else {
               aosDbgPrintf("ERR: invalid ID\n");
               // abort
@@ -664,7 +664,7 @@ aos_shutdown_t _ssspModuleStackInitialization(void)
             break;
           }
           // set delay timer
-          chVTSet(&timerDelay, LL_US2ST(AMIROOS_CFG_SSSP_SIGNALDELAY), _ssspTimerCallback, &eventSourceDelay);
+          chVTSet(&timerDelay, TIME_US2I(AMIROOS_CFG_SSSP_SIGNALDELAY), _ssspTimerCallback, &eventSourceDelay);
         }
 
         // if a delay event occurred
@@ -678,7 +678,7 @@ aos_shutdown_t _ssspModuleStackInitialization(void)
           aosDbgPrintf("S-\n");
           apalControlGpioSet(&moduleSsspGpioSync, APAL_GPIO_OFF);
           // reset the timeout timer
-          chVTSet(&timerTimeout, LL_US2ST(AOS_SYSTEM_SSSP_TIMEOUT), _ssspTimerCallback, &eventSourceTimeout);
+          chVTSet(&timerTimeout, TIME_US2I(AOS_SYSTEM_SSSP_TIMEOUT), _ssspTimerCallback, &eventSourceTimeout);
           chEvtWaitAnyTimeout(eventListenerTimeout.events, TIME_IMMEDIATE);
           eventmask &= ~(eventListenerTimeout.events);
           // proceed
@@ -707,7 +707,7 @@ aos_shutdown_t _ssspModuleStackInitialization(void)
             aosDbgPrintf("ID (%u)\n", lastid);
 #endif
             // restart timeout timer
-            chVTSet(&timerTimeout, LL_US2ST(AOS_SYSTEM_SSSP_TIMEOUT), _ssspTimerCallback, &eventSourceTimeout);
+            chVTSet(&timerTimeout, TIME_US2I(AOS_SYSTEM_SSSP_TIMEOUT), _ssspTimerCallback, &eventSourceTimeout);
             chEvtWaitAnyTimeout(eventListenerTimeout.events, TIME_IMMEDIATE);
             eventmask &= ~(eventListenerTimeout.events);
           }
@@ -728,7 +728,7 @@ aos_shutdown_t _ssspModuleStackInitialization(void)
           chEvtWaitAnyTimeout(eventListenerTimeout.events, TIME_IMMEDIATE);
           eventmask &= ~(eventListenerTimeout.events);
           //set the delay timer
-          chVTSet(&timerDelay, LL_US2ST(AOS_SYSTEM_SSSP_TIMEOUT), _ssspTimerCallback, &eventSourceDelay);
+          chVTSet(&timerDelay, TIME_US2I(AOS_SYSTEM_SSSP_TIMEOUT), _ssspTimerCallback, &eventSourceDelay);
         }
 
         // if a CAN event was received
@@ -1057,7 +1057,7 @@ int main(void)
 
     aosDbgPrintf("receiving current date/time...\t");
     // receive message
-    if (canReceiveTimeout(&MODULE_HAL_CAN, CAN_ANY_MAILBOX, &frame, LL_US2ST(AOS_SYSTEM_SSSP_TIMEOUT)) == MSG_OK) {
+    if (canReceiveTimeout(&MODULE_HAL_CAN, CAN_ANY_MAILBOX, &frame, TIME_US2I(AOS_SYSTEM_SSSP_TIMEOUT)) == MSG_OK) {
       // validate message
       if (frame.DLC == 8 &&
           frame.RTR == CAN_RTR_DATA &&
@@ -1111,7 +1111,7 @@ int main(void)
   while (shutdown == AOS_SHUTDOWN_NONE) {
     // wait for an event
 #if (AMIROOS_CFG_MAIN_LOOP_TIMEOUT != 0)
-    eventmask = chEvtWaitOneTimeout(ALL_EVENTS, LL_US2ST(AMIROOS_CFG_MAIN_LOOP_TIMEOUT));
+    eventmask = chEvtWaitOneTimeout(ALL_EVENTS, TIME_US2I(AMIROOS_CFG_MAIN_LOOP_TIMEOUT));
 #else
     eventmask = chEvtWaitOne(ALL_EVENTS);
 #endif
@@ -1243,7 +1243,7 @@ int main(void)
 #endif
 
   // finally hand over to bootloader
-  aosSysShutdownFinal(&MODULE_HAL_EXT, shutdown);
+  aosSysShutdownFinal(&moduleIntDriver, shutdown);
 
   /*
    * ##########################################################################
diff --git a/os/core/src/aos_shell.c b/os/core/src/aos_shell.c
index 1ab39cd..75e48d8 100644
--- a/os/core/src/aos_shell.c
+++ b/os/core/src/aos_shell.c
@@ -131,6 +131,7 @@ static size_t _channelreadt(void *instance, uint8_t *bp, size_t n, systime_t tim
 }
 
 static const struct AosShellChannelVMT _channelvmt = {
+  (size_t) 0,
   _channelwrite,
   _channelread,
   _channelput,
@@ -195,6 +196,7 @@ static msg_t _streamget(void *instance)
 }
 
 static const struct AosShellStreamVMT _streamvmt = {
+  (size_t) 0,
   _streamwrite,
   _stremread,
   _streamput,
diff --git a/os/core/src/aos_system.c b/os/core/src/aos_system.c
index dc92f6b..3e370d8 100644
--- a/os/core/src/aos_system.c
+++ b/os/core/src/aos_system.c
@@ -25,12 +25,13 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include <stdlib.h>
 #if (AMIROOS_CFG_TESTS_ENABLE == true)
 #include <ch_test.h>
+#include <rt_test_root.h>
 #endif
 
 /**
  * @brief   Period of the system timer.
  */
-#define SYSTIMER_PERIOD               (TIME_MAXIMUM - CH_CFG_ST_TIMEDELTA)
+#define SYSTIMER_PERIOD               (TIME_MAX_INTERVAL - CH_CFG_ST_TIMEDELTA)
 
 /**
  * @brief   Width of the printable system info text.
@@ -577,7 +578,7 @@ static int _shellcmd_kerneltestcb(BaseSequentialStream* stream, int argc, char*
 
   tprio_t prio = chThdGetPriorityX();
   chThdSetPriority(HIGHPRIO - 5); // some tests increase priorirty by 5, so this is the maximum priority permitted
-  msg_t retval = test_execute(stream);
+  msg_t retval = test_execute(stream, &rt_test_suite);
   chThdSetPriority(prio);
 
   return retval;
@@ -590,12 +591,12 @@ static int _shellcmd_kerneltestcb(BaseSequentialStream* stream, int argc, char*
  * @param[in] extp      Pointer to the interrupt driver object.
  * @param[in] channel   Interrupt channel identifier.
  */
-static void _signalPdCallback(EXTDriver* extp, expchannel_t channel)
+static void _signalPdCallback(void *args)
 {
-  (void)extp;
+  (void)args;
 
   chSysLockFromISR();
-  chEvtBroadcastFlagsI(&aos.events.io, (1 << channel));
+  chEvtBroadcastFlagsI(&aos.events.io, 0);
   chSysUnlockFromISR();
 
   return;
@@ -607,13 +608,13 @@ static void _signalPdCallback(EXTDriver* extp, expchannel_t channel)
  * @param[in] extp      Pointer to the interrupt driver object.
  * @param[in] channel   Interrupt channel identifier.
  */
-static void _signalSyncCallback(EXTDriver* extp, expchannel_t channel)
+static void _signalSyncCallback(void *args)
 {
-  (void)extp;
+  (void)args;
 
 #if (AMIROOS_CFG_SSSP_MASTER == true)
   chSysLockFromISR();
-  chEvtBroadcastFlagsI(&aos.events.io, (1 << channel));
+  chEvtBroadcastFlagsI(&aos.events.io, 0);
   chSysUnlockFromISR();
 #else
   apalControlGpioState_t s_state;
@@ -643,7 +644,7 @@ static void _signalSyncCallback(EXTDriver* extp, expchannel_t channel)
     }
   }
   // broadcast event
-  chEvtBroadcastFlagsI(&aos.events.io, (1 << channel));
+  chEvtBroadcastFlagsI(&aos.events.io, 0);
   chSysUnlockFromISR();
 #endif
 
@@ -663,7 +664,7 @@ static void _uptimeCallback(void* par)
   // read current time in system ticks
   register const systime_t st = chVTGetSystemTimeX();
   // update the uptime variables
-  _uptime += LL_ST2US(st - _synctime);
+  _uptime += TIME_I2US(st - _synctime);
   _synctime = st;
   // enable the timer again
   chVTSetI(&_systimer, SYSTIMER_PERIOD, &_uptimeCallback, NULL);
@@ -695,12 +696,12 @@ static void _sysSyncTimerCallback(void* par)
     // reconfigure the timer precisely, because the logically falling edge (next interrupt) snychronizes the system time
     _syssynctime += AMIROOS_CFG_SSSP_SYSSYNCPERIOD;
     aosSysGetUptimeX(&uptime);
-    chVTSetI(&_syssynctimer, LL_US2ST(_syssynctime - uptime), _sysSyncTimerCallback, NULL);
+    chVTSetI(&_syssynctimer, TIME_US2I(_syssynctime - uptime), _sysSyncTimerCallback, NULL);
   }
   // if S was toggled from on to off
   else /* if (s_state == APAL_GPIO_OFF) */ {
     // reconfigure the timer (lazy)
-    chVTSetI(&_syssynctimer, LL_US2ST(AMIROOS_CFG_SSSP_SYSSYNCPERIOD / 2), _sysSyncTimerCallback, NULL);
+    chVTSetI(&_syssynctimer, TIME_US2I(AMIROOS_CFG_SSSP_SYSSYNCPERIOD / 2), _sysSyncTimerCallback, NULL);
   }
   chSysUnlockFromISR();
 
@@ -743,9 +744,12 @@ void aosSysInit(void)
   chEvtObjectInit(&aos.events.os);
 
   // setup external interrupt system
-  moduleHalExtConfig.channels[moduleSsspGpioPd.gpio->pad].cb = _signalPdCallback;
-  moduleHalExtConfig.channels[moduleSsspGpioSync.gpio->pad].cb = _signalSyncCallback;
-  extStart(&MODULE_HAL_EXT, &moduleHalExtConfig);
+  aosIntDriverInit(&moduleIntDriver, moduleIntConfig);
+  chSysLock();
+  palSetPadCallbackI(moduleGpioSysPd.port, moduleGpioSysPd.pad, _signalPdCallback, NULL);
+  palSetPadCallbackI(moduleGpioSysSync.port, moduleGpioSysSync.pad, _signalSyncCallback, NULL);
+  chSysUnlock();
+  aosIntDriverStart(&moduleIntDriver);
 
 #if (AMIROOS_CFG_SHELL_ENABLE == true)
   // init shell
@@ -784,7 +788,7 @@ inline void aosSysStart(void)
     aos_timestamp_t t;
     aosSysGetUptimeX(&t);
     t = AMIROOS_CFG_SSSP_SYSSYNCPERIOD - (t % AMIROOS_CFG_SSSP_SYSSYNCPERIOD);
-    chVTSetI(&_syssynctimer, LL_US2ST((t > (AMIROOS_CFG_SSSP_SYSSYNCPERIOD / 2)) ? (t - (AMIROOS_CFG_SSSP_SYSSYNCPERIOD / 2)) : (t + (AMIROOS_CFG_SSSP_SYSSYNCPERIOD / 2))), _sysSyncTimerCallback, NULL);
+    chVTSetI(&_syssynctimer, TIME_US2I((t > (AMIROOS_CFG_SSSP_SYSSYNCPERIOD / 2)) ? (t - (AMIROOS_CFG_SSSP_SYSSYNCPERIOD / 2)) : (t + (AMIROOS_CFG_SSSP_SYSSYNCPERIOD / 2))), _sysSyncTimerCallback, NULL);
     chSysUnlock();
   }
 #endif
@@ -861,7 +865,7 @@ inline void aosSysGetUptimeX(aos_timestamp_t* ut)
 {
   aosDbgCheck(ut != NULL);
 
-  *ut = _uptime + LL_ST2US(chVTGetSystemTimeX() - _synctime);
+  *ut = _uptime + TIME_I2US(chVTGetSystemTimeX() - _synctime);
 
   return;
 }
@@ -986,14 +990,14 @@ void aosSysDeinit(void)
  * @param[in] extDrv      Pointer to the interrupt driver.
  * @param[in] shutdown    Type of shutdown.
  */
-void aosSysShutdownFinal(EXTDriver* extDrv, aos_shutdown_t shutdown)
+void aosSysShutdownFinal(aos_interrupt_driver_t* intDrv, aos_shutdown_t shutdown)
 {
   // check arguments
-  aosDbgCheck(extDrv != NULL);
+  aosDbgCheck(intDrv != NULL);
   aosDbgCheck(shutdown != AOS_SHUTDOWN_NONE);
 
   // stop external interrupt system
-  extStop(extDrv);
+  aosIntDriverStop(intDrv);
 
   // update the system SSSP stage
   aos.sssp.stage = AOS_SSSP_SHUTDOWN_1_3;
diff --git a/os/core/src/aos_thread.c b/os/core/src/aos_thread.c
index 63d0823..768854b 100644
--- a/os/core/src/aos_thread.c
+++ b/os/core/src/aos_thread.c
@@ -34,13 +34,13 @@ void aosThdSleepUntilS(const aos_timestamp_t* t)
 
   // while the remaining time is too long, it must be split into multiple sleeps
   while ( (*t > uptime) && ((*t - uptime) > AOS_THD_MAX_SLEEP_US) ) {
-    chThdSleepS(US2ST(AOS_THD_MAX_SLEEP_US));
+    chThdSleepS(TIME_US2I(AOS_THD_MAX_SLEEP_US));
     aosSysGetUptimeX(&uptime);
   }
 
   // sleep the remaining time
   if (*t > uptime) {
-    systime_t rest = US2ST(*t - uptime);
+    systime_t rest = TIME_US2I(*t - uptime);
     if (rest > TIME_IMMEDIATE) {
       chThdSleepS(rest);
     }
diff --git a/os/core/src/aos_timer.c b/os/core/src/aos_timer.c
index 4351dea..531ec13 100644
--- a/os/core/src/aos_timer.c
+++ b/os/core/src/aos_timer.c
@@ -45,9 +45,9 @@ static inline void _setupTimer(aos_timer_t* timer)
   if ( (timer->wkuptime > uptime) && ((timer->wkuptime - uptime) > TIME_IMMEDIATE) ) {
     // split the time delta if necessary
     if ((timer->wkuptime - uptime) > AOS_TIMER_MAX_INTERVAL_US) {
-      chVTSetI(&(timer->vt), US2ST(AOS_TIMER_MAX_INTERVAL_US), _intermediateCb, timer);
+      chVTSetI(&(timer->vt), TIME_US2I(AOS_TIMER_MAX_INTERVAL_US), _intermediateCb, timer);
     } else {
-      chVTSetI(&(timer->vt), US2ST(timer->wkuptime - uptime), _fireCb, timer);
+      chVTSetI(&(timer->vt), TIME_US2I(timer->wkuptime - uptime), _fireCb, timer);
     }
   } else {
     vtfunc_t fn = timer->callback;
diff --git a/os/hal/ports/STM32/LLD/QEIv1/hal_qei_lld.c b/os/hal/ports/STM32/LLD/QEIv1/hal_qei_lld.c
index 0d0f739..700704a 100644
--- a/os/hal/ports/STM32/LLD/QEIv1/hal_qei_lld.c
+++ b/os/hal/ports/STM32/LLD/QEIv1/hal_qei_lld.c
@@ -156,38 +156,38 @@ void qei_lld_start(QEIDriver *qeip) {
     /* Clock activation and timer reset.*/
 #if STM32_QEI_USE_TIM1
     if (&QEID1 == qeip) {
-      rccEnableTIM1(FALSE);
+      rccEnableTIM1();
       rccResetTIM1();
     }
 #endif
 #if STM32_QEI_USE_TIM2
     if (&QEID2 == qeip) {
-      rccEnableTIM2(FALSE);
+      rccEnableTIM2();
       rccResetTIM2();
     }
 #endif
 #if STM32_QEI_USE_TIM3
     if (&QEID3 == qeip) {
-      rccEnableTIM3(FALSE);
+      rccEnableTIM3();
       rccResetTIM3();
     }
 #endif
 #if STM32_QEI_USE_TIM4
     if (&QEID4 == qeip) {
-      rccEnableTIM4(FALSE);
+      rccEnableTIM4();
       rccResetTIM4();
     }
 #endif
 
 #if STM32_QEI_USE_TIM5
     if (&QEID5 == qeip) {
-      rccEnableTIM5(FALSE);
+      rccEnableTIM5();
       rccResetTIM5();
     }
 #endif
 #if STM32_QEI_USE_TIM8
     if (&QEID8 == qeip) {
-      rccEnableTIM8(FALSE);
+      rccEnableTIM8();
       rccResetTIM8();
     }
 #endif
@@ -242,33 +242,33 @@ void qei_lld_stop(QEIDriver *qeip) {
 
 #if STM32_QEI_USE_TIM1
     if (&QEID1 == qeip) {
-      rccDisableTIM1(FALSE);
+      rccDisableTIM1();
     }
 #endif
 #if STM32_QEI_USE_TIM2
     if (&QEID2 == qeip) {
-      rccDisableTIM2(FALSE);
+      rccDisableTIM2();
     }
 #endif
 #if STM32_QEI_USE_TIM3
     if (&QEID3 == qeip) {
-      rccDisableTIM3(FALSE);
+      rccDisableTIM3();
     }
 #endif
 #if STM32_QEI_USE_TIM4
     if (&QEID4 == qeip) {
-      rccDisableTIM4(FALSE);
+      rccDisableTIM4();
     }
 #endif
 #if STM32_QEI_USE_TIM5
     if (&QEID5 == qeip) {
-      rccDisableTIM5(FALSE);
+      rccDisableTIM5();
     }
 #endif
   }
 #if STM32_QEI_USE_TIM8
     if (&QEID8 == qeip) {
-      rccDisableTIM8(FALSE);
+      rccDisableTIM8();
     }
 #endif
 }
diff --git a/os/unittests/lld/src/ut_lld_adc.c b/os/unittests/lld/src/ut_lld_adc.c
index 0d859ca..dc5923f 100644
--- a/os/unittests/lld/src/ut_lld_adc.c
+++ b/os/unittests/lld/src/ut_lld_adc.c
@@ -115,7 +115,7 @@ aos_utresult_t utAdcFunc(BaseSequentialStream* stream, aos_unittest_t* ut)
   conversionGroup.ltr = _adcWdgThreshold;
   _listener = chThdGetSelfX();
   adcStartConversion(((ut_adcdata_t*)(ut->data))->driver, &conversionGroup, buffer, 1);
-  eventmask = chEvtWaitOneTimeout(_adcWdgEventmask, LL_S2ST(5));
+  eventmask = chEvtWaitOneTimeout(_adcWdgEventmask, TIME_S2I(5));
   if (eventmask == _adcWdgEventmask) {
     aosUtPassedMsg(stream, &result, "%fV %c 9V\n", _adc2volt(buffer[0]), (buffer[0] > _adcWdgThreshold) ? '>' : '<');
     wdgpassed = true;
@@ -139,7 +139,7 @@ aos_utresult_t utAdcFunc(BaseSequentialStream* stream, aos_unittest_t* ut)
       aosThdMSleep(100); // wait some time so the ADC wil trigger again immediately due to noise
       _listener = chThdGetSelfX();
       adcStartConversion(((ut_adcdata_t*)(ut->data))->driver, &conversionGroup, buffer, 1);
-      eventmask = chEvtWaitOneTimeout(_adcWdgEventmask, LL_S2ST(10));
+      eventmask = chEvtWaitOneTimeout(_adcWdgEventmask, TIME_S2I(10));
       if (eventmask == _adcWdgEventmask) {
         aosUtPassedMsg(stream, &result, "%fV %c 9V\n", _adc2volt(buffer[0]), (buffer[0] > _adcWdgThreshold) ? '>' : '<');
       } else {
diff --git a/os/unittests/periphery-lld/src/ut_alld_hmc5883l.c b/os/unittests/periphery-lld/src/ut_alld_hmc5883l.c
index df013ea..17e1c34 100644
--- a/os/unittests/periphery-lld/src/ut_alld_hmc5883l.c
+++ b/os/unittests/periphery-lld/src/ut_alld_hmc5883l.c
@@ -159,7 +159,7 @@ aos_utresult_t utAlldHmc5883lFunc(BaseSequentialStream* stream, aos_unittest_t*
 
   chprintf(stream, "interrupt (full data read)...\n");
   status |= hmc5883l_lld_read_data(((ut_hmc5883ldata_t*)ut->data)->driver, mdata, ((ut_hmc5883ldata_t*)ut->data)->timeout);
-  event_mask = chEvtWaitOneTimeout(EVENT_MASK(0), LL_US2ST(100 * MICROSECONDS_PER_MILLISECOND));
+  event_mask = chEvtWaitOneTimeout(EVENT_MASK(0), TIME_US2I(100 * MICROSECONDS_PER_MILLISECOND));
   chprintf(stream, "\t\teventmask = 0x%08X (should be 1)\n", event_mask);
   if (event_mask == EVENT_MASK(0)) {
     aosUtPassed(stream, &result);
@@ -176,7 +176,7 @@ aos_utresult_t utAlldHmc5883lFunc(BaseSequentialStream* stream, aos_unittest_t*
   aosSysGetUptime(&t);
   status |= hmc5883l_lld_read_data(((ut_hmc5883ldata_t*)ut->data)->driver, mdata, ((ut_hmc5883ldata_t*)ut->data)->timeout);
   while (t - start < MICROSECONDS_PER_SECOND) {
-    event_mask = chEvtWaitOneTimeout(EVENT_MASK(0), US2ST(1000));
+    event_mask = chEvtWaitOneTimeout(EVENT_MASK(0), TIME_US2I(1000));
     if (event_mask == EVENT_MASK(0)) {
       status |= hmc5883l_lld_read_data(((ut_hmc5883ldata_t*)ut->data)->driver, mdata, ((ut_hmc5883ldata_t*)ut->data)->timeout);
       data_reads++;
diff --git a/os/unittests/periphery-lld/src/ut_alld_mpr121.c b/os/unittests/periphery-lld/src/ut_alld_mpr121.c
index e7baa3e..b8fdf11 100644
--- a/os/unittests/periphery-lld/src/ut_alld_mpr121.c
+++ b/os/unittests/periphery-lld/src/ut_alld_mpr121.c
@@ -135,7 +135,7 @@ aos_utresult_t utAlldMpr121Func(BaseSequentialStream* stream, aos_unittest_t* ut
   do {
     aosSysGetUptime(&tcurrent);
     const aos_timestamp_t ttimeout = MICROSECONDS_PER_SECOND - ((tcurrent - tstart) % MICROSECONDS_PER_SECOND);
-    const eventmask_t emask = chEvtWaitOneTimeout(EVENT_MASK(INTERRUPT_EVENT_ID), LL_US2ST(ttimeout));
+    const eventmask_t emask = chEvtWaitOneTimeout(EVENT_MASK(INTERRUPT_EVENT_ID), TIME_US2I(ttimeout));
     const eventflags_t eflags = chEvtGetAndClearFlags(&event_listener);
     if (emask == EVENT_MASK(INTERRUPT_EVENT_ID) && eflags == ((ut_mpr121data_t*)ut->data)->evtflags) {
       // interrupt detected
diff --git a/os/unittests/periphery-lld/src/ut_alld_vcnl4020.c b/os/unittests/periphery-lld/src/ut_alld_vcnl4020.c
index a5fa4f7..b33d967 100644
--- a/os/unittests/periphery-lld/src/ut_alld_vcnl4020.c
+++ b/os/unittests/periphery-lld/src/ut_alld_vcnl4020.c
@@ -169,7 +169,7 @@ aos_utresult_t utAlldVcnl4020Func(BaseSequentialStream* stream, aos_unittest_t*
   status |= vcnl4020_lld_writereg(((ut_vcnl4020data_t*)(ut->data))->vcnld, VCNL4020_LLD_REGADDR_INTCTRL, VCNL4020_LLD_INTCTRLREG_THRES_EN, ((ut_vcnl4020data_t*)(ut->data))->timeout);
   do {
     // read proximity data, interrupt event information and interrupt status
-    const eventmask_t emask = chEvtWaitOneTimeout(EVENT_MASK(INTERRUPT_EVENT_ID), LL_US2ST(10*MICROSECONDS_PER_MILLISECOND));
+    const eventmask_t emask = chEvtWaitOneTimeout(EVENT_MASK(INTERRUPT_EVENT_ID), TIME_US2I(10*MICROSECONDS_PER_MILLISECOND));
     const eventflags_t eflags = chEvtGetAndClearFlags(&event_listener);
     status |= vcnl4020_lld_readprox(((ut_vcnl4020data_t*)(ut->data))->vcnld, &reg_16[0], ((ut_vcnl4020data_t*)(ut->data))->timeout);
     status |= vcnl4020_lld_readreg(((ut_vcnl4020data_t*)(ut->data))->vcnld, VCNL4020_LLD_REGADDR_INTSTATUS, &reg_8[2], ((ut_vcnl4020data_t*)(ut->data))->timeout);
diff --git a/periphery-lld/AMiRo-LLD b/periphery-lld/AMiRo-LLD
index 616f358..59c2837 160000
--- a/periphery-lld/AMiRo-LLD
+++ b/periphery-lld/AMiRo-LLD
@@ -1 +1 @@
-Subproject commit 616f3584eb15138e5cc926c59ade38798b1ccaa2
+Subproject commit 59c2837266778acf1974df72318852ccb9d5e8bb
diff --git a/periphery-lld/periphAL.h b/periphery-lld/periphAL.h
index 43d4706..e00b0b3 100644
--- a/periphery-lld/periphAL.h
+++ b/periphery-lld/periphAL.h
@@ -56,9 +56,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 static inline void usleep(apalTime_t us)
 {
   // check if the specified time can be represented by the system
-  aosDbgCheck(us <= LL_ST2US(TIME_INFINITE));
+  aosDbgCheck(us <= TIME_I2US(TIME_INFINITE));
 
-  const systime_t st = LL_US2ST(us);
+  const systime_t st = TIME_US2I(us);
   // TIME_IMMEDIATE makes no sense and would even cause system halt
   if (st != TIME_IMMEDIATE) {
     chThdSleep(st);
@@ -185,15 +185,15 @@ static inline apalExitStatus_t apalControlGpioSet(const apalControlGpio_t* const
 
 #endif
 
-#if HAL_USE_EXT || defined(__DOXYGEN__)
+#if HAL_USE_PAL || defined(__DOXYGEN__)
 
 /**
  * @brief   Converts an apalGpioEdge_t to an ChibiOS EXT edge.
  */
 #define APAL2CH_EDGE(edge)                                        \
-  ((edge == APAL_GPIO_EDGE_RISING) ? EXT_CH_MODE_RISING_EDGE :    \
-    (edge == APAL_GPIO_EDGE_FALLING) ? EXT_CH_MODE_FALLING_EDGE : \
-     (edge == APAL_GPIO_EDGE_BOTH) ? EXT_CH_MODE_BOTH_EDGES : 0)
+  ((edge == APAL_GPIO_EDGE_RISING) ? PAL_EVENT_MODE_RISING_EDGE :    \
+    (edge == APAL_GPIO_EDGE_FALLING) ? PAL_EVENT_MODE_FALLING_EDGE : \
+     (edge == APAL_GPIO_EDGE_BOTH) ? PAL_EVENT_MODE_BOTH_EDGES : 0)
 
 #endif
 
@@ -365,13 +365,13 @@ static inline apalExitStatus_t apalI2CMasterTransmit(apalI2CDriver_t* i2cd, cons
   msg_t status = MSG_OK;
   if (rxbytes == 1) {
     uint8_t buffer[2];
-    status = i2cMasterTransmitTimeout(i2cd, addr, txbuf, txbytes, buffer, 2, ((timeout >= TIME_INFINITE) ? TIME_INFINITE : LL_US2ST(timeout)) );
+    status = i2cMasterTransmitTimeout(i2cd, addr, txbuf, txbytes, buffer, 2, ((timeout >= TIME_INFINITE) ? TIME_INFINITE : TIME_US2I(timeout)) );
     rxbuf[0] = buffer[0];
   } else {
-    status = i2cMasterTransmitTimeout(i2cd, addr, txbuf, txbytes, rxbuf, rxbytes, ((timeout >= TIME_INFINITE) ? TIME_INFINITE : LL_US2ST(timeout)) );
+    status = i2cMasterTransmitTimeout(i2cd, addr, txbuf, txbytes, rxbuf, rxbytes, ((timeout >= TIME_INFINITE) ? TIME_INFINITE : TIME_US2I(timeout)) );
   }
 #else
-  const msg_t status = i2cMasterTransmitTimeout(i2cd, addr, txbuf, txbytes, rxbuf, rxbytes, ((timeout >= TIME_INFINITE) ? TIME_INFINITE : LL_US2ST(timeout)) );
+  const msg_t status = i2cMasterTransmitTimeout(i2cd, addr, txbuf, txbytes, rxbuf, rxbytes, ((timeout >= TIME_INFINITE) ? TIME_INFINITE : TIME_US2I(timeout)) );
 #endif
 
 #if (I2C_USE_MUTUAL_EXCLUSION == TRUE)
@@ -418,13 +418,13 @@ static inline apalExitStatus_t apalI2CMasterReceive(apalI2CDriver_t* i2cd, const
   msg_t status = MSG_OK;
   if (rxbytes == 1) {
     uint8_t buffer[2];
-    status = i2cMasterReceiveTimeout(i2cd, addr, buffer, 2, ((timeout >= TIME_INFINITE) ? TIME_INFINITE : LL_US2ST(timeout)) );
+    status = i2cMasterReceiveTimeout(i2cd, addr, buffer, 2, ((timeout >= TIME_INFINITE) ? TIME_INFINITE : TIME_US2I(timeout)) );
     rxbuf[0] = buffer[0];
   } else {
-    status = i2cMasterReceiveTimeout(i2cd, addr, rxbuf, rxbytes, ((timeout >= TIME_INFINITE) ? TIME_INFINITE : LL_US2ST(timeout)) );
+    status = i2cMasterReceiveTimeout(i2cd, addr, rxbuf, rxbytes, ((timeout >= TIME_INFINITE) ? TIME_INFINITE : TIME_US2I(timeout)) );
   }
 #else
-  const msg_t status = i2cMasterReceiveTimeout(i2cd, addr, rxbuf, rxbytes, ((timeout >= TIME_INFINITE) ? TIME_INFINITE : LL_US2ST(timeout)) );
+  const msg_t status = i2cMasterReceiveTimeout(i2cd, addr, rxbuf, rxbytes, ((timeout >= TIME_INFINITE) ? TIME_INFINITE : TIME_US2I(timeout)) );
 #endif
 
 #if (I2C_USE_MUTUAL_EXCLUSION == TRUE)
