34#ifndef __AFE_CONFIG_H__
35#define __AFE_CONFIG_H__
47#define BITM_WFB_CFG_BURST_ALL_CHAN 0x00000000
49#define BITM_WFB_CFG_WF_CAP_RESAMPLED_SEL 0x00000000
51#define REG_WAVEFORM_FIRST_HALF_ADDRESS 0x801
53#define REG_WAVEFORM_SECOND_HALF_ADDRESS 0xC01
55#define BITM_ACCMODE_SELFREQ_50HZ 0x0
57#define BITM_ACCMODE_SELFREQ_60HZ 0x0100
59#define BITM_FREQ_VCONSEL_ICONSEL 0xFE0F
61#define BITM_CONFIG0_PERIOD_AVG_CFG_AV8 0x00010000
63#define BITM_CONFIG0_PERIOD_AVG_CFG_AV16 0x00020000
65#define LP_SEL_APERIOD 0x0000
67#define LP_SEL_BPERIOD 0x0008
69#define LP_SEL_CPERIOD 0x0010
71#define ZX_SEL_ZXVA 0x0000
73#define ZX_SEL_ZXVB 0x0002
75#define ZX_SEL_ZXVC 0x0004
77#define SPI_TIMEOUT 100
81#define SPI_HEADER_SIZE 2
83#define MAX_SPI_DATA_SIZE 4
85#define SPI_16BIT_DATA_SIZE 2
87#define SPI_32BIT_DATA_SIZE 4
89#define MAX_SPI_BUFFER_SIZE SPI_HEADER_SIZE + MAX_SPI_DATA_SIZE
187 uint16_t angleVolCur);
Header file of ADE9430 Driver.
int afe_read_period(uint32_t *pPeriod, uint16_t numPeriods)
reads period registers.
Definition afe_config.c:298
int spi_device_init(void)
SPI Initialization Function.
Definition afe_config.c:478
int afe_set_acc_mode(uint16_t frequency, uint16_t vconsel, uint16_t iconsel)
sets ACCMODE register for nominal frequency, ICONSEL, VCONSEL.
Definition afe_config.c:521
int afe_read_32bit_buff(uint16_t addr, uint16_t numSamples, uint32_t *pData)
reads the 32bit value from the register and saves to a 32bit buffer.
Definition afe_config.c:412
int afe_read_angle(uint16_t *pAngle, uint16_t numAngles, uint16_t angleVolCur)
reads angle registers.
Definition afe_config.c:331
int afe_read_waveform(uint16_t *pData, uint16_t numSamples)
reads waveform buffer.
Definition afe_config.c:274
AFE_SPI_STATUS
Definition afe_config.h:95
@ AFE_SPI_STATUS_DMA_RUNNING
Definition afe_config.h:97
@ AFE_SPI_STATUS_DMA_COMPLETED
Definition afe_config.h:98
@ AFE_SPI_STATUS_DMA_IDLE
Definition afe_config.h:96
int afe_write_32bit_reg(uint16_t addr, uint32_t *pData)
write the 32bit value to the register
Definition afe_config.c:376
uint32_t AFE_OUTPUT_STATUS
Definition afe_config.h:79
int init_lcd(void)
Initialize LCD screen and text.
Definition afe_config.c:40
int afe_read_status_1(uint32_t *pSTATUS1)
Read STATUS1 register.
Definition afe_config.c:350
int config_afe_irq(void)
Configures IRQ flags.
Definition afe_config.c:226
void afe_wait_settling(uint32_t cycles)
Waits for passed number of cycles.
Definition afe_config.c:507
int reset_afe(void)
resets the AFE
Definition afe_config.c:452
int afe_init(void)
Initializes SPI handler, AFE register values.
Definition afe_config.c:121
int afe_read_rms_1012(uint32_t *pRMS, uint16_t numRMS)
reads rms1012value registers.
Definition afe_config.c:321
int afe_set_ref_channel(uint16_t refChannel)
sets refChannel.
Definition afe_config.c:552
int afe_read_rms_one(uint32_t *pRMS, uint16_t numRMS)
reads rmsonevalue registers.
Definition afe_config.c:311
int afe_read_version(uint32_t *pVersion)
reads AFE version.
Definition afe_config.c:366
int config_wfb(void)
configure WFB_CFB register, initialized with start filling
Definition afe_config.c:241
int afe_start(void)
Starts the AFE.
Definition afe_config.c:198
int afe_read_status0(uint32_t *pSTATUS0)
Read STATUS0 register.
Definition afe_config.c:483
int afe_read_16bit_buff(uint16_t addr, uint16_t numSamples, uint16_t *pData)
reads the 16bit value from the register and saves to a 16bitbuffer.
Definition afe_config.c:432
int afe_write_16bit_reg(uint16_t addr, uint16_t *pData)
write the 16bit value to the register
Definition afe_config.c:394
Header file of nhd_c12832a1z.
Header file of utility functions.