/********************************************************************
  Copyright (c) 2021 Xiangyu Medical Co.，Ltd. All rights reserved.
  FileName : drv_saadc.h
  Author   : zhangdawei
  Version  : V1.0
  Date     :
  Note     :
  History  :
********************************************************************/
/* Includes ------------------------------------------------------*/
#ifndef DRV_SAADC_H__
#define DRV_SAADC_H__
#include "nrf_drv_timer.h"
#include "nrf_drv_saadc.h"
#include "IoControl.h"
/* Public define -------------------------------------------------*/ 
#define SAADC_BATTERY_CHANNEL 1          // 电池电压检测通道
#define SAADC_ELECTRODE_CHANNEL 2        // 电极片脱落电压
#define SAADC_RMS_SAMPLE_CHANNEL 0        // 肌电采样通道

#define AD_RAW_MAX  50

/* Public typedef ------------------------------------------------*/
typedef struct
{
	//float AdRaw[AD_RAW_MAX+50];//原始值数组
	float EmgValue;//计算值
	unsigned char emgCnt;
}emg_data_t;

/* Public constants ----------------------------------------------*/
/* Public variables ----------------------------------------------*/
extern uint8_t Battery_Percentage;
/* Public function prototypes ------------------------------------*/
void battery_adc_init(void);
void timer1_output_ctrl_init(void);
void rms_saadc_init(void);
void PPIEegAdcInit(void);
void timer3_rms_init(void);
void timer3_rms_stop(void);
void timer3_rms_start(void);
void CalculateBatteryPower(void);
#endif
/*************************** END OF FILE ***************************/

