/*******************************************************************************
 * @file	meas_pd_imm.h

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

#ifndef _MEAS_PD_IMM_H__
#define _MEAS_PD_IMM_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 imm_PD_NO				1/////4
#define imm_LED_NO				4////5
#define imm_CYCLE_CNT 		8	////32


void imm_ppi_init(void);
void imm_ppi_uninit(void);
void imm_sampling_event_enable(void);
void imm_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 imm_voltage_handler(nrf_drv_saadc_evt_t const * p_event);	/* PD Voltage reading */
void imm_adc_start_init(void);
void imm_adc_start(void);
void imm_adc_start2(void);
//void custom_adc_start2(void);
//void custom_adc_total_start(void);
void imm_adc_end(void);
void imm_adc_end_final(void);
void imm_adc_init(void);
void imm_adc_uninit(void);

void imm_irq_init(void);
void imm_irq_uninit(void);

//void custom_send_start(void);

//void custom_send_loop(void * p_context);	/* For x ms */
//void custom_send_timer_start(void);
//void custom_send_timer_stop(void);;
//void custom_send_timer_init(void);


void imm_check_loop(void * p_context);	
void imm_check_timer_start(void);
void imm_check_timer_stop(void);;
void imm_check_timer_init(void);

#endif /* _MEAS_PD_VOLTAGE_CUSTOM_H__ */

