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

#ifndef _MEAS_PD_VOLTAGE_FULL_H__
#define _MEAS_PD_VOLTAGE_FULL_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 FULL_PD_NO				1
#define FULL_LED_NO				24
#define FULL_CYCLE_CNT 			32	/* Dummy=65535/16us(Max Delay), Cycle_Max_Cnt=32*/

#if FEATURE_PRINTF
void full_timer_loop(void * p_context);
void full_timer_start(void);
void full_timer_stop(void);
void full_timer_init(void);
#endif

void full_ppi_init(void);
void full_ppi_uninit(void);
void full_sampling_event_enable(void);
void full_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 full_voltage_handler(nrf_drv_saadc_evt_t const * p_event);	/* PD Voltage reading */
void full_adc_start_first(uint8_t type,uint8_t PD_PICK ,uint8_t LED_PICK);
void full_adc_start(void);
void full_adc_start2(void);
void full_adc_end(void);
void full_adc_init(void);
void full_adc_uninit(void);
#if !FEATURE_PRINTF
void full_irq_init(void);
void full_irq_uninit(void);
#endif

void ble_Tx_process(void);
void full_send_loop(void * p_context);	/* For x ms */
void full_send_timer_start(void);
void full_send_timer_stop(void);;
void full_send_timer_init(void);


void full_check_loop(void * p_context);	
void full_check_timer_start(void);
void full_check_timer_stop(void);;
void full_check_timer_init(void);

#endif /* _MEAS_PD_VOLTAGE_FULL_H__ */

