#ifndef __SA51024_CFG_H__
#define __SA51024_CFG_H__

/***************************************************************
copyright from private LiuXiao
if you have any question,you can contact me by email 461445092@qq.com
2022-10-05 17:56:24.020233
***************************************************************/

#include "../config/mcal/peripheral/dac/plib_dac.h"
#include "../config/mcal/peripheral/port/plib_port.h"
#include "Std_Types.h"
/***************************************************************
Macro Definition and enum define
***************************************************************/

#ifndef TRUE
#define TRUE  true
#endif

#ifndef FALSE
#define FALSE false
#endif


typedef enum
{
	SA51024_IDLE = 0x00,
	SA51024_WORKING ,
	SA51024_STOP ,
}FA51024_main_e_typ;


typedef enum
{
	SA51024_STRENGTH_LEVEL0 = 0x00,
	SA51024_STRENGTH_LEVEL1 ,
	SA51024_STRENGTH_LEVEL2,
	SA51024_STRENGTH_LEVEL3
}FA51024_ctrl_e_typ;


/***************************datatype define begin************************************/
#ifndef STATE_UINT8
#define STATE_UINT8 unsigned char
#endif

#ifndef STATE_SINT8
#define STATE_SINT8 char
#endif

#ifndef STATE_UINT16
#define STATE_UINT16 unsigned short
#endif

#ifndef STATE_SINT16
#define STATE_SINT16 short
#endif

#ifndef STATE_UINT32
#define STATE_UINT32 unsigned int
#endif

#ifndef STATE_SINT32
#define STATE_SINT32 int
#endif

#define NUM_ELEMENTS 223
//#define SA51024_WAVE_MAX_ID  ((STATE_SINT16)23760)
//#define SA51024_WAVE_MAX_NUM  ((STATE_SINT16)23761)


#define SA51024_WAVE_MAX_ID  ((STATE_SINT16)(NUM_ELEMENTS - 1))
#define SA51024_WAVE_MAX_NUM  ((STATE_SINT16)(NUM_ELEMENTS))

#define SA51024_TRIG_ADC(val)   DAC_DataWrite(0,val)

typedef struct
{
	FA51024_main_e_typ *state;
	FA51024_ctrl_e_typ * strngth;
	STATE_UINT16 *wave_index;
	STATE_UINT16  * wave_tbl;
}SA51024_Cfg_Main_Str_typ;

/***************************************************************
extern  variable
***************************************************************/


extern FA51024_main_e_typ sa51024_state;
extern FA51024_ctrl_e_typ sa51024_strength;
extern STATE_UINT16 sa51024_wave_index;

extern const SA51024_Cfg_Main_Str_typ SA51024_Cfg_Main_Str ;
extern float32 Raw_data[NUM_ELEMENTS];
extern STATE_UINT16 sa51024_wave_tbl_u16_new[NUM_ELEMENTS];


#endif
