Ultra-Low Power Data Acquisition Subsystem Function Documentation

 

Sys_Sensor_SARConfig

void Sys_Sensor_SARConfig(uint32_t sar_cfg, uint32_t sar_ctrl, uint32_t clk_cfg)

 

Configure the SAR-ADC interface.

 

Location: sensor.h:52

 

Parameters

Direction Name Description

in

sar_cfg

SAR-ADC configuration; use SAR_PRE_SEL_GPIO_*, SAR_IN_*_SRC_*, SAR_DATA_OUT_RX_DMA_[ENABLED | DISABLED], SAR_DATA_OUT_UPDATE_[AUTO | ENABLE], SAR_SUPPLY_[AUTO | ENABLE], and SAR_SUPPLY_BY_[VBAT | VDDA]

in

sar_ctrl

SAR-ADC control configuration; use SAR_SEL_*, SAR_NSAMPLING_CYCLE_*, SAR_[CONV_12BIT | CONV_14BIT | CAL_WEIGHT | AUTO_ZERO], SAR_[START_SINGLE | START_CONTINUOUS | STOP_CONTINUOUS)

in

clk_cfg

select interface clock source; use SENSOR_CLK_[STANDBY | SYSCLK_DIV]_BYTE

 

 

Example Code for Sys_Sensor_SARConfig

    // Configure the SAR to measure on GPIO0 and GPIO1. 

    //   - Define positive input and negative input signal as supply voltage/2

    //   - Do not use DMA

    //   - Data buffer updated on finished conversion

    //   - SAR supply is only on when used

    //   - SAR supply is VBAT

    //   - Gated 2's complement offset compensated output (gated means output is 

    //       zero until valid data becomes available)

    //   - Data sampling lasts 1 cycle

    //   - Create 12 bit samples

    //   - Stop continuous conversions

    //   - Use standby clock as the sensor clock source

    Sys_Sensor_SARConfig(SAR_PRE_SEL_GPIO_1               |

                         SAR_PRE_SEL_GPIO_0               |

                         SAR_IN_P_SRC_SAR_SUPPLY_DIV2     |

                         SAR_IN_N_SRC_SAR_SUPPLY_DIV2     |

                         SAR_DATA_OUT_RX_DMA_DISABLED     |

                         SAR_DATA_OUT_UPDATE_AUTO         |

                         SAR_SUPPLY_AUTO                  |

                         SAR_SUPPLY_BY_VBAT,

                         SAR_SEL_GATED_SIGNED_COMPENSATED |

                         SAR_NSAMPLING_CYCLE_1            |

                         SAR_CONV_12BIT                   |

                         SAR_STOP_CONTINUOUS,

                         SENSOR_CLK_STANDBY_BYTE);

 

Sys_Sensor_PulseCountConfig

void Sys_Sensor_PulseCountConfig(uint32_t pc_cfg, uint32_t clk_cfg)

 

Configure sensor pulse count state.

 

Location: sensor.h:73

 

Parameters

Direction Name Description

in

pc_cfg

Pulse-counter configuration; use COUNT_INT_*, PC_SRC_*, PC_COUNT_ON_[HIGH_LEVEL | RISING_EDGE]

in

clk_cfg

select interface clock source; use SENSOR_CLK_[STANDBY | SYSCLK_DIV]_BYTE

 

 

Example Code for Sys_Sensor_PulseCountConfig

    //   - Set pulse count source to constant high

    //   - Set total count state to be 4 periods of sensor clock

    //   - Select standby clock as sensor clock source

    Sys_Sensor_PulseCountConfig(PC_SRC_CONST_HIGH | COUNT_INT_4, SENSOR_CLK_STANDBY_BYTE)

 

Sys_Sensor_StorageConfig

void Sys_Sensor_StorageConfig(uint32_t sum_en, uint32_t nbr_samples, uint32_t threshold_min, uint32_t threshold_max, uint32_t store_en, uint32_t fifo_size, uint32_t fifo_cfg)

 

Configure data storage settings.

 

Location: sensor.h:107

 

Parameters

Direction Name Description

in

sum_en

Enable summation mode; use SENSOR_SUMMATION_[ENABLED | DISABLED]

in

nbr_samples

Number of samples to store before wakeup in sensor detect mode or for impedance measurement; use SENSOR_NBR_SAMPLES_*

in

threshold_min

Sensor data level threshold (min) for wakeup; use SENSOR_THRESHOLD_MIN_*, SENSOR_THRESHOLD_MIN_[DISABLED | ENABLED]

in

threshold_max

Sensor data level threshold (max) for wakeup; use SENSOR_THRESHOLD_MAX_*, SENSOR_THRESHOLD_MAX_[DISABLED | ENABLED]

in

store_en

Enable storing samples in FIFO

in

fifo_size

Number of samples to store in FIFO before wakeup of core.

in

fifo_cfg

Enable FIFO interrupts and/or DMA triggers; use FIFO_RX_DMA_[ENABLED | DISABLED], and FIFO_RX_INT_[ENABLED | DISABLED]

 

 

Example Code for Sys_Sensor_StorageConfig

    //   - Disable summing of sequential samples

    //   - Number of data samples to generate before wakeup generated

    //   - Enable sensor threshold and set it to a value of 1

    //   - Enable storing of sensor data samples in the sensor FIFO

    //   - Set sensor FIFO size to 1 sample

    //   - Disable interrupts and dma transfer of data from FIFO

    Sys_Sensor_StorageConfig(SENSOR_SUMMATION_DISABLED, SENSOR_NBR_SAMPLES_1,

                             SENSOR_THRESHOLD_MIN_ENABLED | SENSOR_THRESHOLD_MIN_1,

                             SENSOR_THRESHOLD_MAX_ENABLED | SENSOR_THRESHOLD_MAX_1,

                             SENSOR_FIFO_STORE_ENABLED, SENSOR_FIFO_SIZE1, 

                             FIFO_RX_DMA_DISABLED | FIFO_RX_INT_ENABLED);

 

Sys_Sensor_DelayConfig

void Sys_Sensor_DelayConfig(uint32_t dly_cfg)

 

Configure sensor delay clocks and length.

 

Use sub-register defines.

 

Location: sensor.h:129

 

Parameters

Direction Name Description

in

dly_cfg

select interface clock source; use DLY_*_SHORT, DLY_DIV_[ENABLED | DISABLED]_SHORT, and DLY_[USED | NOT_USED]_SHORT

 

NOTE: Clock can be configured for 32 kHz (0) or 1 kHz (1-default)

 

Example Code for Sys_Sensor_DelayConfig

    //   - Enable delay state

    //   - Delay state runs at sensor clock divided by 32

    //   - Delay state is 256 sensor clock/32 periods

    Sys_Sensor_DelayConfig(DLY_USED | DLY_DIV_ENABLED | DLY_256)

 

Sys_Sensor_Enable

void Sys_Sensor_Enable()

 

Enable the sensor.

 

In secure mode, also enable power to the sensor.

 

Location: sensor.h:139

 

 

Example Code for Sys_Sensor_Enable

    // Enable the ULP power data acquisition (sensor) subsystem

    Sys_Sensor_Enable()

 

Sys_Sensor_Disable

void Sys_Sensor_Disable()

 

Disable the sensor.

 

In secure mode, also disable power to the sensor.

 

Location: sensor.h:157

 

 

Example Code for Sys_Sensor_Disable

    // Disable the ULP power data acquisition (sensor) subsystem

    Sys_Sensor_Disable()

 

Sys_Sensor_TimerReset

void Sys_Sensor_TimerReset()

 

The sensor timer counter, the sensor timer enable and the ADC counter are reset.

 

Location: sensor.h:176

 

 

Example Code for Sys_Sensor_TimerReset

    // The sensor timer counter, the sensor timer enable and the ADC counter are reset

    Sys_Sensor_TimerReset()

 

Sys_Sensor_CurrentState

uint8_t Sys_Sensor_CurrentState()

 

Read the current status and delay state of the sensor interface.

 

Location: sensor.h:188

 


Return


current state of the sensor interface.

 

 

Example Code for Sys_Sensor_CurrentState

    // Read the current state of the sensor interface

    Sys_Sensor_CurrentState()

 

Sys_Sensor_CurrentCountValue

uint32_t Sys_Sensor_CurrentCountValue()

 

Read the current value of the sensor's main counter.

 

Location: sensor.h:200

 


Return


current value of the main counter.

 

 

Example Code for Sys_Sensor_CurrentCountValue

    // Read the current value of the main sensor counter

    Sys_Sensor_CurrentCountValue()