/*******************************************************************************
 * @file	meas_pd_voltage_half.h
 * @author	CandyPops Co.
 * @version	V1.0.0
 * @date	2022-09-05
 * @brief   
 ******************************************************************************/

#ifndef _MEAS_PD_VOLTAGE_HALF_H__
#define _MEAS_PD_VOLTAGE_HALF_H__

#include "sdk_common.h"
#include "nrf_drv_saadc.h"

#ifndef ADA2200_SYNCO_PIN
#define ADA2200_SYNCO_PIN		NRF_GPIO_PIN_MAP(0,17)
#endif

#define HALF_PD_NO				6
#define HALF_LED_NO				6
#define HALF_CYCLE_CNT 			32


void half_ppi_init(void);
void half_ppi_uninit(void);
void half_sampling_event_enable(void);
void half_sampling_event_disable(void);

/**@brief Function for handling the ADC interrupt.
 *
 * @details  This function will fetch the conversion result from the ADC, convert the value into
 *           percentage and send it to peer.
 */
static void half_voltage_handler(nrf_drv_saadc_evt_t const * p_event);	/* PD Voltage reading */
void half_adc_start(void);
void half_adc_start2(void);
void half_adc_end(void);
void half_adc_init(void);
void half_adc_uninit(void);
#if !FEATURE_PRINTF
void half_irq_init(void);
void half_irq_uninit(void);
#endif

void half_send_loop(void * p_context);	/* For x ms */
void half_send_timer_start(void);
void half_send_timer_stop(void);;
void half_send_timer_init(void);

#endif /* _MEAS_PD_VOLTAGE_HALF_H__ */

