/*******************************************************************************
 * @file	power_control.h
 * @author	CandyPops Co.
 * @version	V1.0.0
 * @date	2022-09-05
 * @brief
 *******************************************************************************
 *
 * [Header overview]
 * Public interface header for the device power sequence manager.
 *
 * [Key functions]
 *   device_activated()     : Power on -> start power_loop state machine
 *   device_sleep_mode()    : Enter sleep mode (stop processing)
 *   device_reactivated()   : Wake from sleep -> restart power sequence
 *   power_loop()           : 20ms power sequence state machine callback
 *   power_timer_start/stop : Power sequence timer control
 *   power_timer_init()     : Initialize power sequence timer (call once at startup)
 *
 ******************************************************************************/

#ifndef _POWER_CONTROL_H_
#define _POWER_CONTROL_H_

#include "main.h"

/** @brief Enter device sleep mode (clears processing flag) */
int device_sleep_mode(void);

/** @brief Power on device (start power sequence state machine) */
int device_activated(void);

/** @brief Reactivate device (re-init I2C and restart sequence on wake from sleep) */
int device_reactivated(void);

/** @brief Power sequence state machine (20ms timer callback, Step 0->1->2) */
void power_loop(void * p_context);	/* For x ms */

/** @brief Start power sequence timer (20ms single-shot) */
void power_timer_start(void);

/** @brief Stop power sequence timer */
void power_timer_stop(void);;

/** @brief Initialize power sequence timer (call once at app startup) */
void power_timer_init(void);
#endif //_POWER_CONTROL_H_

