/*******************************************************************************
 * @file	meas_pd_buff.h

 ******************************************************************************/

#ifndef _MEAS_PD_BUFF_H__
#define _MEAS_PD_BUFF_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 buff_PD_NO				1/////4
#define buff_LED_NO				100////5
#define buff_CYCLE_CNT 		8	////32


void buff_ppi_init(void);
void buff_ppi_uninit(void);
void buff_sampling_event_enable(void);
void buff_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 buff_voltage_handler(nrf_drv_saadc_evt_t const * p_event);	/* PD Voltage reading */
void buff_adc_start_init(void);
void buff_adc_start(void);
void buff_adc_start2(void);
//void custom_adc_start2(void);
//void custom_adc_total_start(void);
void buff_adc_end(void);
void buff_adc_end_final(void);
void buff_adc_init(void);
void buff_adc_uninit(void);

void buff_irq_init(void);
void buff_irq_uninit(void);

void buff_send_start(void);

void buff_send_loop(void * p_context);	/* For x ms */
void buff_send_timer_start(void);
void buff_send_timer_stop(void);;
void buff_send_timer_init(void);


void buff_check_loop(void * p_context);	
void buff_check_timer_start(void);
void buff_check_timer_stop(void);;
void buff_check_timer_init(void);

#endif /* _MEAS_PD_buff_H__ */

