#ifndef __ANT_PULSE_SIMULATOR_H
#define __ANT_PULSE_SIMULATOR_H

/** @file
 *
 * @defgroup ant_sdk_pulse_simulator ANT pulse simulator
 * @{
 * @ingroup ant_sdk_utils
 * @brief ANT pulse simulator module.
 *
 * @details This module simulates a pulse for the ANT HRM Profile. The module calculates abstract values, which are handled by the HRM pages data model to ensure that they are compatible. It provides a handler for changing the heart rate 
 * value manually (using bsp_button actions as defined in the @ref bsp) and functionality to change the heart rate value automatically.
 *
 */

#include <stdint.h>
#include <stdbool.h>
#include "bsp.h"
#include "ant_hrm.h"

#define MIN_HEART_RATE_VALUE       10u                         ///< Minimum allowed instantaneous heart rate value.
#define MAX_HEART_RATE_VALUE       255u                        ///< Maximum allowed instantaneous heart rate value.
#define HEART_RATE_VALUE_INCREMENT 2u                          ///< Instantaneous heart rate value increment amount.
#define HEART_RATE_VALUE_DECREMENT HEART_RATE_VALUE_INCREMENT  ///< Instantaneous heart rate value decrement amount.

/** 
 * @brief Function for initializing the pulse simulator.
 *
 * @details Call this function to make the simulator use a specific instance of
 *          the ANT HRM data model.
 *
 * @param[in] p_related_profile  Pointer to the HRM data instance used for simulation.
 * @param[in] init_heart_rate    Initial value for instantaneous heart rate value. 
 * @param[in] auto_change        Enable or disable automatic changes of the heart rate.
 *
 */
void puls_simulate_init( ant_hrm_profile_t * p_related_profile, uint8_t init_heart_rate, bool auto_change);

/**@brief Function for simulating a device event. 
 * 
 * @details Based on this event, the transmitter data is simulated.
 *
 * This function should be called in the HRM TX period according to the device profile (4.06 Hz). 
 */
void pulse_simulate_one_iteration(void);

/**@brief Function for handling button events.
 * @details This function can be used as bsp_button event handler.
 *
 * @param[in]   event   Event generated by button press.
 */
void button_event_handler(bsp_event_t event);

#endif //__ANT_PULSE_SIMULATOR_H
/** @} */

