Remove MotorController, use nrf_gpio Motor pin, apptimer repeat (#34)

Remove the custom MotorController class and use the upstream
MotorController instead.

To enable this move add custom code in nrf_gpio to handle the Motor pin
instead of the custom motor_is_running member variable.

Also implement the repeating app_timer type used in the upstream
MotorController.
This commit is contained in:
NeroBurner
2022-06-05 22:03:53 +02:00
committed by GitHub
parent f64e1aab80
commit ce22ba29c9
7 changed files with 49 additions and 108 deletions

View File

@@ -88,6 +88,13 @@ typedef uint32_t ret_code_t;
/**@brief Application time-out handler type. */
typedef void (*app_timer_timeout_handler_t)(void * p_context);
/**@brief Timer modes. */
typedef enum
{
APP_TIMER_MODE_SINGLE_SHOT, /**< The timer will expire only once. */
APP_TIMER_MODE_REPEATED /**< The timer will restart each time it expires. */
} app_timer_mode_t;
struct app_timer_t
{
//nrf_sortlist_item_t list_item; /**< Token used by sortlist. */
@@ -96,6 +103,7 @@ struct app_timer_t
uint32_t repeat_period; /**< Repeat period (0 if single shot mode). */
app_timer_timeout_handler_t handler; /**< User handler. */
void * p_context; /**< User context. */
bool repeating;
//NRF_LOG_INSTANCE_PTR_DECLARE(p_log) /**< Pointer to instance of the logger object (Conditionally compiled). */
//volatile bool active; /**< Flag indicating that timer is active. */
};
@@ -127,13 +135,6 @@ uint32_t constexpr APP_TIMER_TICKS(uint32_t ms) {
);
}
/**@brief Timer modes. */
typedef enum
{
APP_TIMER_MODE_SINGLE_SHOT, /**< The timer will expire only once. */
APP_TIMER_MODE_REPEATED /**< The timer will restart each time it expires. */
} app_timer_mode_t;
/**@brief Function for initializing the timer module.
*
* @retval NRF_SUCCESS If the module was initialized successfully.