Merge pull request #87 from Riksu9000/remove-unused-files
Remove unused files
This commit is contained in:
		
						commit
						35aca7323d
					
				@ -80,15 +80,12 @@ add_library(sim-base STATIC
 | 
			
		||||
  sim/nrfx/hal/nrf_rtc.h
 | 
			
		||||
  sim/nrfx/hal/nrf_rtc.cpp
 | 
			
		||||
  # nrf/components/libraries/timer
 | 
			
		||||
  sim/libraries/timer/app_timer.h
 | 
			
		||||
  sim/libraries/timer/app_timer.cpp
 | 
			
		||||
  sim/libraries/gpiote/app_gpiote.h # includes hal/nrf_gpio.h
 | 
			
		||||
)
 | 
			
		||||
# include the generated lv_conf.h file before anything else
 | 
			
		||||
target_include_directories(sim-base PUBLIC "${CMAKE_CURRENT_BINARY_DIR}") # lv_conf.h
 | 
			
		||||
target_include_directories(sim-base PUBLIC "sim")
 | 
			
		||||
target_include_directories(sim-base PUBLIC "sim/libraries/log") # for nrf_log.h
 | 
			
		||||
target_include_directories(sim-base PUBLIC "sim/libraries/timer") # for app_timer.h
 | 
			
		||||
target_include_directories(sim-base PUBLIC "sim/nrfx") # for nrfx_log.h and others
 | 
			
		||||
target_include_directories(sim-base PUBLIC "sim/nrfx/hal") # for nrfx_log.h
 | 
			
		||||
 | 
			
		||||
@ -112,8 +109,6 @@ add_executable(infinisim main.cpp)
 | 
			
		||||
target_sources(infinisim PUBLIC
 | 
			
		||||
  sim/displayapp/LittleVgl.h
 | 
			
		||||
  sim/displayapp/LittleVgl.cpp
 | 
			
		||||
  sim/displayapp/screens/Missing.h
 | 
			
		||||
  sim/displayapp/screens/Missing.cpp
 | 
			
		||||
  sim/components/battery/BatteryController.h
 | 
			
		||||
  sim/components/battery/BatteryController.cpp
 | 
			
		||||
  sim/components/ble/AlertNotificationService.h
 | 
			
		||||
 | 
			
		||||
@ -1,128 +0,0 @@
 | 
			
		||||
#include "displayapp/screens/Missing.h"
 | 
			
		||||
#include "displayapp/DisplayApp.h"
 | 
			
		||||
 | 
			
		||||
using namespace Pinetime::Applications::Screens;
 | 
			
		||||
 | 
			
		||||
Missing::Missing(Pinetime::Applications::DisplayApp* app, Pinetime::Applications::Apps app_key) : Screen(app) {
 | 
			
		||||
  const char *screen_lbl;
 | 
			
		||||
  switch (app_key) {
 | 
			
		||||
    case Pinetime::Applications::Apps::None:
 | 
			
		||||
      screen_lbl = "None";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::Launcher:
 | 
			
		||||
      screen_lbl = "Launcher";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::Clock:
 | 
			
		||||
      screen_lbl = "Clock";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::SysInfo:
 | 
			
		||||
      screen_lbl = "SysInfo";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::FirmwareUpdate:
 | 
			
		||||
      screen_lbl = "FirmwareUpdate";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::FirmwareValidation:
 | 
			
		||||
      screen_lbl = "FirmwareValidation";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::NotificationsPreview:
 | 
			
		||||
      screen_lbl = "NotificationPreview";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::Notifications:
 | 
			
		||||
      screen_lbl = "Notifications";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::Timer:
 | 
			
		||||
      screen_lbl = "Timer";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::Alarm:
 | 
			
		||||
      screen_lbl = "Alarm";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::FlashLight:
 | 
			
		||||
      screen_lbl = "FlashLight";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::BatteryInfo:
 | 
			
		||||
      screen_lbl = "BatteryInfo";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::Music:
 | 
			
		||||
      screen_lbl = "Music";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::Paint:
 | 
			
		||||
      screen_lbl = "Paint";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::Paddle:
 | 
			
		||||
      screen_lbl = "Paddle";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::Twos:
 | 
			
		||||
      screen_lbl = "Twos";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::HeartRate:
 | 
			
		||||
      screen_lbl = "HeartRate";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::Navigation:
 | 
			
		||||
      screen_lbl = "Navigation";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::StopWatch:
 | 
			
		||||
      screen_lbl = "StopWatch";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::Metronome:
 | 
			
		||||
      screen_lbl = "Metronome";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::Motion:
 | 
			
		||||
      screen_lbl = "Motion";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::Steps:
 | 
			
		||||
      screen_lbl = "Steps";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::Weather:
 | 
			
		||||
      screen_lbl = "Weather";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::PassKey:
 | 
			
		||||
      screen_lbl = "PassKey";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::QuickSettings:
 | 
			
		||||
      screen_lbl = "QuickSettings";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::Settings:
 | 
			
		||||
      screen_lbl = "Settings";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::SettingWatchFace:
 | 
			
		||||
      screen_lbl = "SettingWatchFace";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::SettingTimeFormat:
 | 
			
		||||
      screen_lbl = "SettingTimeFormat";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::SettingDisplay:
 | 
			
		||||
      screen_lbl = "SettingDisplay";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::SettingWakeUp:
 | 
			
		||||
      screen_lbl = "SettingWakeUp";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::SettingSteps:
 | 
			
		||||
      screen_lbl = "SettingSteps";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::SettingSetDateTime:
 | 
			
		||||
      screen_lbl = "SettingSetDateTime";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::SettingChimes:
 | 
			
		||||
      screen_lbl = "SettingChimes";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::SettingShakeThreshold:
 | 
			
		||||
      screen_lbl = "SettingThreshold";
 | 
			
		||||
      break;
 | 
			
		||||
    case Pinetime::Applications::Apps::Error:
 | 
			
		||||
      screen_lbl = "Error";
 | 
			
		||||
      break;
 | 
			
		||||
    //case Pinetime::Applications::Apps::Weather:
 | 
			
		||||
    //  screen_lbl = "Weather";
 | 
			
		||||
    //  break;
 | 
			
		||||
    default:
 | 
			
		||||
      screen_lbl = "unkown screen";
 | 
			
		||||
  }
 | 
			
		||||
  lv_obj_t* label = lv_label_create(lv_scr_act(), nullptr);
 | 
			
		||||
  lv_label_set_text_static(label, screen_lbl);
 | 
			
		||||
  lv_obj_align(label, nullptr, LV_ALIGN_CENTER, 0, -20);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Missing::~Missing() {
 | 
			
		||||
  lv_obj_clean(lv_scr_act());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,18 +0,0 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include "displayapp/screens/Screen.h"
 | 
			
		||||
#include "displayapp/Apps.h"
 | 
			
		||||
#include <lvgl/lvgl.h>
 | 
			
		||||
 | 
			
		||||
namespace Pinetime {
 | 
			
		||||
  namespace Applications {
 | 
			
		||||
    namespace Screens {
 | 
			
		||||
 | 
			
		||||
      class Missing : public Screen {
 | 
			
		||||
      public:
 | 
			
		||||
        Missing(DisplayApp* app, Pinetime::Applications::Apps app_key);
 | 
			
		||||
        ~Missing() override;
 | 
			
		||||
      };
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@ -1,88 +0,0 @@
 | 
			
		||||
// original files copied from nRF5_SDK_15.3.0_59ac345/components/libraries/timer/app_timer.c
 | 
			
		||||
// modified to be simulated using SDL2 Timers by NeroBurner
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright (c) 2012 - 2019, Nordic Semiconductor ASA
 | 
			
		||||
 *
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without modification,
 | 
			
		||||
 * are permitted provided that the following conditions are met:
 | 
			
		||||
 *
 | 
			
		||||
 * 1. Redistributions of source code must retain the above copyright notice, this
 | 
			
		||||
 *    list of conditions and the following disclaimer.
 | 
			
		||||
 *
 | 
			
		||||
 * 2. Redistributions in binary form, except as embedded into a Nordic
 | 
			
		||||
 *    Semiconductor ASA integrated circuit in a product or a software update for
 | 
			
		||||
 *    such product, must reproduce the above copyright notice, this list of
 | 
			
		||||
 *    conditions and the following disclaimer in the documentation and/or other
 | 
			
		||||
 *    materials provided with the distribution.
 | 
			
		||||
 *
 | 
			
		||||
 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
 | 
			
		||||
 *    contributors may be used to endorse or promote products derived from this
 | 
			
		||||
 *    software without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
 * 4. This software, with or without modification, must only be used with a
 | 
			
		||||
 *    Nordic Semiconductor ASA integrated circuit.
 | 
			
		||||
 *
 | 
			
		||||
 * 5. Any software provided in binary form under this license must not be reverse
 | 
			
		||||
 *    engineered, decompiled, modified and/or disassembled.
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
 | 
			
		||||
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 | 
			
		||||
 * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
 | 
			
		||||
 * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
 | 
			
		||||
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 | 
			
		||||
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 | 
			
		||||
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
			
		||||
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 | 
			
		||||
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 | 
			
		||||
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
#include "app_timer.h"
 | 
			
		||||
#include <stdexcept>
 | 
			
		||||
#include <cstdlib>
 | 
			
		||||
#include <cstdint>
 | 
			
		||||
 | 
			
		||||
//uint32_t constexpr APP_TIMER_TICKS(uint32_t ms) {
 | 
			
		||||
//    return static_cast<uint32_t>(
 | 
			
		||||
//        static_cast<uint64_t>(ms) * configTICK_RATE_HZ / 1000
 | 
			
		||||
//    );
 | 
			
		||||
//}
 | 
			
		||||
 | 
			
		||||
ret_code_t app_timer_init(void) {
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
ret_code_t app_timer_create(app_timer_t *p_timer_id,
 | 
			
		||||
                            app_timer_mode_t            mode,
 | 
			
		||||
                            app_timer_timeout_handler_t timeout_handler) {
 | 
			
		||||
    if (mode == APP_TIMER_MODE_SINGLE_SHOT) {
 | 
			
		||||
        p_timer_id->repeating = false;
 | 
			
		||||
    } else if (mode == APP_TIMER_MODE_REPEATED) {
 | 
			
		||||
        p_timer_id->repeating = true;
 | 
			
		||||
    } else {
 | 
			
		||||
        throw std::runtime_error("only mode 'APP_TIMER_MODE_SINGLE_SHOT' or 'APP_TIMER_MODE_REPEATED' implemented");
 | 
			
		||||
    }
 | 
			
		||||
    p_timer_id->handler = timeout_handler;
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
Uint32 timeout_callback_wrapper(Uint32 interval, void *param)
 | 
			
		||||
{
 | 
			
		||||
  auto* timer_id = static_cast<app_timer_t*>(param);
 | 
			
		||||
  timer_id->handler(timer_id->p_context);
 | 
			
		||||
  if (timer_id->repeating) {
 | 
			
		||||
    return timer_id->repeat_period;
 | 
			
		||||
  } else {
 | 
			
		||||
    return 0; // cancel timer
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
ret_code_t app_timer_start(app_timer_t &timer_id, uint32_t timeout_ticks, void * p_context) {
 | 
			
		||||
    timer_id.p_context = p_context;
 | 
			
		||||
    timer_id.repeat_period = timeout_ticks;
 | 
			
		||||
    timer_id.sdl_timer_id = SDL_AddTimer(timeout_ticks, timeout_callback_wrapper, (void*)(&timer_id));
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
ret_code_t app_timer_stop(app_timer_t &timer_id) {
 | 
			
		||||
    return (SDL_RemoveTimer(timer_id.sdl_timer_id) == SDL_TRUE);
 | 
			
		||||
}
 | 
			
		||||
@ -1,254 +0,0 @@
 | 
			
		||||
// original files copied from nRF5_SDK_15.3.0_59ac345/components/libraries/timer/app_timer.h
 | 
			
		||||
// modified to be simulated using SDL2 Timers by NeroBurner
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright (c) 2012 - 2019, Nordic Semiconductor ASA
 | 
			
		||||
 *
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without modification,
 | 
			
		||||
 * are permitted provided that the following conditions are met:
 | 
			
		||||
 *
 | 
			
		||||
 * 1. Redistributions of source code must retain the above copyright notice, this
 | 
			
		||||
 *    list of conditions and the following disclaimer.
 | 
			
		||||
 *
 | 
			
		||||
 * 2. Redistributions in binary form, except as embedded into a Nordic
 | 
			
		||||
 *    Semiconductor ASA integrated circuit in a product or a software update for
 | 
			
		||||
 *    such product, must reproduce the above copyright notice, this list of
 | 
			
		||||
 *    conditions and the following disclaimer in the documentation and/or other
 | 
			
		||||
 *    materials provided with the distribution.
 | 
			
		||||
 *
 | 
			
		||||
 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
 | 
			
		||||
 *    contributors may be used to endorse or promote products derived from this
 | 
			
		||||
 *    software without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
 * 4. This software, with or without modification, must only be used with a
 | 
			
		||||
 *    Nordic Semiconductor ASA integrated circuit.
 | 
			
		||||
 *
 | 
			
		||||
 * 5. Any software provided in binary form under this license must not be reverse
 | 
			
		||||
 *    engineered, decompiled, modified and/or disassembled.
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
 | 
			
		||||
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 | 
			
		||||
 * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
 | 
			
		||||
 * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
 | 
			
		||||
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 | 
			
		||||
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 | 
			
		||||
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
			
		||||
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 | 
			
		||||
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 | 
			
		||||
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
/** @file
 | 
			
		||||
 *
 | 
			
		||||
 * @defgroup app_timer Application Timer
 | 
			
		||||
 * @{
 | 
			
		||||
 * @ingroup app_common
 | 
			
		||||
 *
 | 
			
		||||
 * @brief Application timer functionality.
 | 
			
		||||
 *
 | 
			
		||||
 * @details This module enables the application to create multiple timer instances based on the RTC1
 | 
			
		||||
 *          peripheral. Checking for time-outs and invocation of user time-out handlers is performed
 | 
			
		||||
 *          in the RTC1 interrupt handler. List handling is done using a software interrupt (SWI0).
 | 
			
		||||
 *          Both interrupt handlers are running in APP_LOW priority level.
 | 
			
		||||
 *
 | 
			
		||||
 * @details When calling app_timer_start() or app_timer_stop(), the timer operation is just queued,
 | 
			
		||||
 *          and the software interrupt is triggered. The actual timer start/stop operation is
 | 
			
		||||
 *          executed by the SWI0 interrupt handler. Since the SWI0 interrupt is running in APP_LOW,
 | 
			
		||||
 *          if the application code calling the timer function is running in APP_LOW or APP_HIGH,
 | 
			
		||||
 *          the timer operation will not be performed until the application handler has returned.
 | 
			
		||||
 *          This will be the case, for example, when stopping a timer from a time-out handler when not using
 | 
			
		||||
 *          the scheduler.
 | 
			
		||||
 *
 | 
			
		||||
 * @details Use the USE_SCHEDULER parameter of the APP_TIMER_INIT() macro to select if the
 | 
			
		||||
 *          @ref app_scheduler should be used or not. Even if the scheduler is
 | 
			
		||||
 *          not used, app_timer.h will include app_scheduler.h, so when
 | 
			
		||||
 *          compiling, app_scheduler.h must be available in one of the compiler include paths.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef APP_TIMER_H__
 | 
			
		||||
#define APP_TIMER_H__
 | 
			
		||||
#include <SDL2/SDL.h>
 | 
			
		||||
#include "task.h" // configTICK_RATE_HZ
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include <stdbool.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
// copied from sdk_errors.h
 | 
			
		||||
typedef uint32_t ret_code_t;
 | 
			
		||||
 | 
			
		||||
/** @brief Name of the module used for logger messaging.
 | 
			
		||||
 */
 | 
			
		||||
#define APP_TIMER_LOG_NAME app_timer
 | 
			
		||||
 | 
			
		||||
//#define APP_TIMER_CLOCK_FREQ            32768                     /**< Clock frequency of the RTC timer used to implement the app timer module. */
 | 
			
		||||
//#define APP_TIMER_MIN_TIMEOUT_TICKS     5                         /**< Minimum value of the timeout_ticks parameter of app_timer_start(). */
 | 
			
		||||
 | 
			
		||||
/**@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. */
 | 
			
		||||
    //volatile uint32_t           end_val;       /**< RTC counter value when timer expires. */
 | 
			
		||||
    SDL_TimerID sdl_timer_id = 0;
 | 
			
		||||
    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. */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Create a timer identifier and statically allocate memory for the timer.
 | 
			
		||||
 *
 | 
			
		||||
 * @param timer_id Name of the timer identifier variable that will be used to control the timer.
 | 
			
		||||
 */
 | 
			
		||||
#define APP_TIMER_DEF(timer_id) static app_timer_t timer_id;
 | 
			
		||||
 | 
			
		||||
/**@brief Convert milliseconds to timer ticks.
 | 
			
		||||
 *
 | 
			
		||||
 * This macro uses 64-bit integer arithmetic, but as long as the macro parameters are
 | 
			
		||||
 *       constants (i.e. defines), the computation will be done by the preprocessor.
 | 
			
		||||
 *
 | 
			
		||||
 * @param[in]  MS          Milliseconds.
 | 
			
		||||
 *
 | 
			
		||||
 * @return     Number of timer ticks.
 | 
			
		||||
 */
 | 
			
		||||
//#define APP_TIMER_TICKS(MS)                                \
 | 
			
		||||
//            ((uint32_t)ROUNDED_DIV(                        \
 | 
			
		||||
//            (MS) * (uint64_t)APP_TIMER_CLOCK_FREQ,         \
 | 
			
		||||
//            1000 * (APP_TIMER_CONFIG_RTC_FREQUENCY + 1)))
 | 
			
		||||
uint32_t constexpr APP_TIMER_TICKS(uint32_t ms) {
 | 
			
		||||
    return static_cast<uint32_t>(
 | 
			
		||||
        static_cast<uint64_t>(ms) * configTICK_RATE_HZ / 1000
 | 
			
		||||
    );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**@brief Function for initializing the timer module.
 | 
			
		||||
 *
 | 
			
		||||
 * @retval     NRF_SUCCESS               If the module was initialized successfully.
 | 
			
		||||
 */
 | 
			
		||||
ret_code_t app_timer_init(void);
 | 
			
		||||
 | 
			
		||||
/**@brief Function for creating a timer instance.
 | 
			
		||||
 *
 | 
			
		||||
 * @param[in]  p_timer_id        Pointer to timer identifier.
 | 
			
		||||
 * @param[in]  mode              Timer mode.
 | 
			
		||||
 * @param[in]  timeout_handler   Function to be executed when the timer expires.
 | 
			
		||||
 *
 | 
			
		||||
 * @retval     NRF_SUCCESS               If the timer was successfully created.
 | 
			
		||||
 * @retval     NRF_ERROR_INVALID_PARAM   If a parameter was invalid.
 | 
			
		||||
 * @retval     NRF_ERROR_INVALID_STATE   If the application timer module has not been initialized or
 | 
			
		||||
 *                                       the timer is running.
 | 
			
		||||
 *
 | 
			
		||||
 * @note This function does the timer allocation in the caller's context. It is also not protected
 | 
			
		||||
 *       by a critical region. Therefore care must be taken not to call it from several interrupt
 | 
			
		||||
 *       levels simultaneously.
 | 
			
		||||
 * @note The function can be called again on the timer instance and will re-initialize the instance if
 | 
			
		||||
 *       the timer is not running.
 | 
			
		||||
 * @attention The FreeRTOS and RTX app_timer implementation does not allow app_timer_create to
 | 
			
		||||
 *       be called on the previously initialized instance.
 | 
			
		||||
 */
 | 
			
		||||
ret_code_t app_timer_create(app_timer_t *p_timer_id,
 | 
			
		||||
                            app_timer_mode_t            mode,
 | 
			
		||||
                            app_timer_timeout_handler_t timeout_handler);
 | 
			
		||||
 | 
			
		||||
/**@brief Function for starting a timer.
 | 
			
		||||
 *
 | 
			
		||||
 * @param[in]       timer_id      Timer identifier.
 | 
			
		||||
 * @param[in]       timeout_ticks Number of ticks (of RTC1, including prescaling) to time-out event
 | 
			
		||||
 *                                (minimum 5 ticks).
 | 
			
		||||
 * @param[in]       p_context     General purpose pointer. Will be passed to the time-out handler when
 | 
			
		||||
 *                                the timer expires.
 | 
			
		||||
 *
 | 
			
		||||
 * @retval     NRF_SUCCESS               If the timer was successfully started.
 | 
			
		||||
 * @retval     NRF_ERROR_INVALID_PARAM   If a parameter was invalid.
 | 
			
		||||
 * @retval     NRF_ERROR_INVALID_STATE   If the application timer module has not been initialized or the timer
 | 
			
		||||
 *                                       has not been created.
 | 
			
		||||
 * @retval     NRF_ERROR_NO_MEM          If the timer operations queue was full.
 | 
			
		||||
 *
 | 
			
		||||
 * @note The minimum timeout_ticks value is 5.
 | 
			
		||||
 * @note For multiple active timers, time-outs occurring in close proximity to each other (in the
 | 
			
		||||
 *       range of 1 to 3 ticks) will have a positive jitter of maximum 3 ticks.
 | 
			
		||||
 * @note When calling this method on a timer that is already running, the second start operation
 | 
			
		||||
 *       is ignored.
 | 
			
		||||
 */
 | 
			
		||||
ret_code_t app_timer_start(app_timer_t &timer_id, uint32_t timeout_ticks, void * p_context);
 | 
			
		||||
 | 
			
		||||
/**@brief Function for stopping the specified timer.
 | 
			
		||||
 *
 | 
			
		||||
 * @param[in]  timer_id                  Timer identifier.
 | 
			
		||||
 *
 | 
			
		||||
 * @retval     NRF_SUCCESS               If the timer was successfully stopped.
 | 
			
		||||
 * @retval     NRF_ERROR_INVALID_PARAM   If a parameter was invalid.
 | 
			
		||||
 * @retval     NRF_ERROR_INVALID_STATE   If the application timer module has not been initialized or the timer
 | 
			
		||||
 *                                       has not been created.
 | 
			
		||||
 * @retval     NRF_ERROR_NO_MEM          If the timer operations queue was full.
 | 
			
		||||
 */
 | 
			
		||||
ret_code_t app_timer_stop(app_timer_t &timer_id);
 | 
			
		||||
 | 
			
		||||
/**@brief Function for stopping all running timers.
 | 
			
		||||
 *
 | 
			
		||||
 * @retval     NRF_SUCCESS               If all timers were successfully stopped.
 | 
			
		||||
 * @retval     NRF_ERROR_INVALID_STATE   If the application timer module has not been initialized.
 | 
			
		||||
 * @retval     NRF_ERROR_NO_MEM          If the timer operations queue was full.
 | 
			
		||||
 */
 | 
			
		||||
//ret_code_t app_timer_stop_all(void);
 | 
			
		||||
 | 
			
		||||
/**@brief Function for returning the current value of the RTC1 counter.
 | 
			
		||||
 *
 | 
			
		||||
 * @return    Current value of the RTC1 counter.
 | 
			
		||||
 */
 | 
			
		||||
//uint32_t app_timer_cnt_get(void);
 | 
			
		||||
 | 
			
		||||
/**@brief Function for computing the difference between two RTC1 counter values.
 | 
			
		||||
 *
 | 
			
		||||
 * @param[in]  ticks_to       Value returned by app_timer_cnt_get().
 | 
			
		||||
 * @param[in]  ticks_from     Value returned by app_timer_cnt_get().
 | 
			
		||||
 *
 | 
			
		||||
 * @return    Number of ticks from ticks_from to ticks_to.
 | 
			
		||||
 */
 | 
			
		||||
//uint32_t app_timer_cnt_diff_compute(uint32_t   ticks_to,
 | 
			
		||||
//                                    uint32_t   ticks_from);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**@brief Function for getting the maximum observed operation queue utilization.
 | 
			
		||||
 *
 | 
			
		||||
 * Function for tuning the module and determining OP_QUEUE_SIZE value and thus module RAM usage.
 | 
			
		||||
 *
 | 
			
		||||
 * @note APP_TIMER_WITH_PROFILER must be enabled to use this functionality.
 | 
			
		||||
 *
 | 
			
		||||
 * @return Maximum number of events in queue observed so far.
 | 
			
		||||
 */
 | 
			
		||||
//uint8_t app_timer_op_queue_utilization_get(void);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Function for pausing RTC activity which drives app_timer.
 | 
			
		||||
 *
 | 
			
		||||
 * @note This function can be used for debugging purposes to ensure
 | 
			
		||||
 *       that application is halted when entering a breakpoint.
 | 
			
		||||
 */
 | 
			
		||||
//void app_timer_pause(void);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Function for resuming RTC activity which drives app_timer.
 | 
			
		||||
 *
 | 
			
		||||
 * @note This function can be used for debugging purposes to resume
 | 
			
		||||
 *       application activity.
 | 
			
		||||
 */
 | 
			
		||||
//void app_timer_resume(void);
 | 
			
		||||
 | 
			
		||||
#endif // APP_TIMER_H__
 | 
			
		||||
 | 
			
		||||
/** @} */
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user