#define DEBUG_LOG_MODULE_NAME "POSAPP"
#ifdef DEBUG_POSLIB_LOG_MAX_LEVEL
#define DEBUG_LOG_MAX_LEVEL DEBUG_POSLIB_LOG_MAX_LEVEL
#else
#define DEBUG_LOG_MAX_LEVEL LVL_NOLOG
#endif
#include "posapp_settings.h"
#include "board.h"
#ifdef BUTTON_ENABLED
#endif
#ifdef CONF_USE_LED_NOTIFICATION
#endif
#ifdef MOTION_SUPPORTED
#include "motion.h"
#endif
#ifdef CONF_USE_PERSISTENT_MEMORY
#endif
#ifdef BUTTON_ENABLED
#define BUTTON_ID 0
#endif
#ifdef CONF_USE_LED_NOTIFICATION
#define LED_ON true
#define LED_OFF false
#define LED_ID 0
#endif
#ifdef BUTTON_ENABLED
static void button_pressed_cb(uint8_t button_id,
button_event_e button_event)
{
LOG(
LVL_DEBUG,
"Start oneshot. Button event %u button id %u", button_event, button_id);
#ifndef APP_PRINTING
(void) button_id;
(void) button_event;
#endif
}
static void enable_button(void)
{
{
LOG(
LVL_INFO,
"Oneshot request active on button id %u", BUTTON_ID);
}
else
{
LOG(
LVL_ERROR,
"Registration for button id: %u failed.", BUTTON_ID)
}
}
#else
static void enable_button(void) {}
#endif
#ifdef CONF_USE_PERSISTENT_MEMORY
static uint32_t App_persistent_data_write(void)
{
PosApp_Settings_store(&settings);
}
#endif
#ifdef MOTION_SUPPORTED
{
}
{
{
posapp_motion_ret_e res_mon;
posapp_motion_mon_settings_t motion_cfg = {
.cb = motion_cb
};
res_mon = PosAppMotion_startMonitoring(&motion_cfg);
if (res_mon != POSAPP_MOTION_RET_OK)
{
LOG(
LVL_ERROR,
"Cannot activate motion monitoring! res: %u", res_mon);
return false;
}
}
else
{
PosAppMotion_stopMonitoring();
}
return true;
}
#endif
{
{
#ifdef MOTION_SUPPORTED
update_motion(&settings.
motion);
#endif
#ifdef CONF_USE_PERSISTENT_MEMORY
#endif
}
}
{
(void) msg;
#ifdef CONF_USE_LED_NOTIFICATION
{
}
#endif
}
{
(void) msg;
#ifdef CONF_USE_LED_NOTIFICATION
{
}
#endif
}
{
PosApp_Settings_get(&settings);
{
return res;
}
{
LOG(
LVL_ERROR,
"PosLib cannot register event %u failed. res: %d", event, res);
return res;
}
{
LOG(
LVL_ERROR,
"PosLib cannot register event %u failed. res: %d", event, res);
return res;
}
{
LOG(
LVL_ERROR,
"PosLib cannot register event %u failed. res: %d", event, res);
return res;
}
#ifdef MOTION_SUPPORTED
update_motion(&settings.
motion);
#endif
{
LOG(
LVL_ERROR,
"PosLib start periodic failed. res: %d", res);
}
return res;
}
{
(void) functions;
PosApp_Settings_configureNode();
enable_button();
#ifdef MOTION_SUPPORTED
PosAppMotion_init();
#endif
#ifdef CONF_VOLTAGE_REPORT
#endif
lib_state->startStack();
App_start_positioning();
}
#define APP_SCHEDULER_STOP_TASK
Value to return from task to remove it.
app_scheduler_res_e App_Scheduler_addTask_execTime(task_cb_f cb, uint32_t delay_ms, uint32_t exec_time_us)
Add a task.
#define APP_SCHEDULER_SCHEDULE_ASAP
Value to return from task or as initial time to be executed ASAP.
#define LVL_DEBUG
Macros to define several log levels: Debug, Info, Warning, Error.
#define LOG(level, fmt,...)
Print a log message if its severity is lower or equal to DEBUG_LOG_MAX_LEVEL.
Board-independent LED functions.
led_res_e Led_set(uint8_t led_id, bool state)
Turn the given LED on or off.
led_res_e
List of return code.
app_lib_time_timestamp_hp_t time_hp
#define POSLIB_FLAG_EVENT_SUBSCRIBERS_MAX
poslib_ret_e PosLib_startPeriodic(void)
Start the positioning updates according to provided configuration. Calls PosLib initialization functi...
poslib_events_e
Defines the events triggered by PosLib.
@ POSLIB_FLAG_EVENT_CONFIG_CHANGE
@ POSLIB_FLAG_EVENT_LED_OFF
@ POSLIB_FLAG_EVENT_LED_ON
poslib_ret_e
Return codes of positioning functions.
poslib_motion_mode_e
defines the position motion mode.
poslib_motion_mon_settings_t motion
poslib_ret_e PosLib_startOneshot(void)
Triggers one position update. If PosLib is started the scheduled operation will continue after the on...
poslib_ret_e PosLib_motion(poslib_motion_mode_e mode)
Used to indicate that the tag is static or dynamic. The update rate used will be adjusted according t...
poslib_ret_e PosLib_eventRegister(poslib_events_e event, poslib_events_listen_info_f cb, uint8_t *id)
Register an event subscriber.
poslib_ret_e PosLib_getConfig(poslib_settings_t *settings)
Gets PosLib configuration.
poslib_ret_e PosLib_setConfig(poslib_settings_t *settings)
Sets PosLib configuration.
position library settings.
position library motion settings.
Voltage measurement examples for various processors.
void Mcu_voltageInit(void)
Initialize voltage measurement mechanisms. Need to do once before measurements.
List of global functions, passed to App_entrypoint()