EBO-77/Sources/AD1.h
2024-12-23 11:04:44 +08:00

52 lines
2.5 KiB
C
Raw Blame History

#ifndef __AD1_H
#define __AD1_H
#include "derivative.h"
#define CEASE_ERROR_MASK 0xF8U /* Constant for check the error flags register of the Error type if it holds the cease flags or not */
#define ERR_FLG_CEASE_ERROR_MASK 0xF800U /* Constant for check the variable of the Error type if it holds the cease flags or not */
#define ERR_FLG_MASK 0xFE40U /* Constant for check the variable of the Error type if it holds any error flags or not */
#ifndef __BWUserType_AD1_TError
#define __BWUserType_AD1_TError
/*lint -save -esym(960,18.4) Disable MISRA rule (18.4) checking. */
typedef union {
word err;
struct {
/*lint -save -e46 Disable MISRA rule (6.4) checking. */
word : 1; /* Reserved */
word : 1; /* Reserved */
word : 1; /* Reserved */
word : 1; /* Reserved */
word : 1; /* Reserved */
word : 1; /* Reserved */
word ConversionOverrun_Error : 1; /* Overrun of the ADCxCONIF register */
word : 1; /* Reserved */
word : 1; /* Reserved */
word LDOK_Error : 1; /* Restart without Load OK */
word Restart_Error : 1; /* Restart in the wrong time */
word Trigger_Error : 1; /* Trigger in the wrong time or trigger overflow - Cease ADC operation. */
word CompareValue_Error : 1; /* Compare value not available - Cease ADC operation. */
word EOL_Error : 1; /* End of list command missing in the current CSL - Cease ADC operation. */
word CommandValue_Error : 1; /* Invalid conversion command loaded - Cease ADC operation. */
word IllegalAccess_Error : 1; /* Wrong DMA access to illegal memory area - Cease ADC operation. */
/*lint -restore Enable MISRA rule (6.4) checking. */
} errName;
} AD1_TError; /* Error flags. For languages which don't support bit access is byte access only to error flags possible. */
/*lint -restore +esym(960,18.4) Enable MISRA rule (18.4) checking. */
#endif
extern word AD1_OutV[9];
extern byte ADC_convert_over_flag;//ADת<44><D7AA><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD>־
byte AD1_Start(void);
byte AD1_GetValue(void* Values);
byte AD1_GetValue16(word *Values);
void AD1_Init(void);
//Get AD average value
word AD_Average_Calculate(word *AD_Array,byte Arrsize);
#endif