SmartSnippets DA1459x SDK
Data Structures | Macros | Typedefs | Enumerations | Functions

Definition of API for the SDADC Low Level Driver. More...

#include <stdbool.h>
#include <stdint.h>
#include "sdk_defs.h"
#include "hw_dma.h"

Go to the source code of this file.

Data Structures

struct  hw_sdadc_dma_cfg_t
 Cut-down to necessary DMA configuration. More...
 
struct  hw_sdadc_config_t
 SDADC configuration. More...
 

Macros

#define HW_SDADC_DMA_SUPPORT   dg_configSDADC_DMA_SUPPORT
 DMA support for SDADC.
 
#define HW_SDADC_VREF_VOLTAGE_INTERNAL   ( 900 )
 SDADC Reference Voltage level in milliVolt. More...
 
#define HW_SDADC_VREF_VOLTAGE_MAX   HW_SDADC_VREF_VOLTAGE_INTERNAL
 Macro giving the maximum allowed reference voltage level in millivolt. More...
 

Typedefs

typedef void(* hw_sdadc_read_cb) (void *user_data, uint32_t conv_to_go)
 ADC callback for read function. More...
 
typedef void(* hw_sdadc_interrupt_cb) (void)
 SDADC interrupt handler. More...
 

Enumerations

enum  HW_SDADC_INPUT_MODE { HW_SDADC_INPUT_MODE_DIFFERENTIAL = 0, HW_SDADC_INPUT_MODE_SINGLE_ENDED = 1 }
 SDADC input mode. More...
 
enum  HW_SDADC_VREF_SEL { HW_SDADC_VREF_INTERNAL = 0, HW_SDADC_VREFN_INTERNAL_VREFP_EXTERNAL = 1, HW_SDADC_VREFN_EXTERNAL_VREFP_INTERNAL = 2, HW_SDADC_VREF_EXTERNAL = 3 }
 SDADC VREF selection. More...
 
enum  HW_SDADC_INPUT_CHANNEL {
  HW_SDADC_IN_ADC0_P1_00 = 0, HW_SDADC_IN_ADC1_P1_01 = 1, HW_SDADC_IN_ADC2_P1_02 = 2, HW_SDADC_IN_ADC3_P0_10 = 3,
  HW_SDADC_IN_ADC4_P1_05 = 4, HW_SDADC_IN_ADC5_P1_06 = 5, HW_SDADC_IN_ADC6_P1_09 = 6, HW_SDADC_IN_ADC7_P1_11 = 7,
  HW_SDADC_IN_VBAT = 8
}
 SDADC Input Channel. More...
 
enum  HW_SDADC_MODE { HW_SDADC_MODE_SENSOR = 0, HW_SDADC_MODE_AUDIO = 1 }
 SDADC mode (sensor/audio) More...
 
enum  HW_SDADC_INPUT
 SDADC input selection. Generic names mapping to specific GPIO pins for both positive and negative channels. More...
 
enum  HW_SDADC_OSR { HW_SDADC_OSR_256, HW_SDADC_OSR_512, HW_SDADC_OSR_1024, HW_SDADC_OSR_2048 }
 SDADC oversampling rate. More...
 
enum  HW_SDADC_PGA_GAIN {
  HW_SDADC_PGA_GAIN_MINUS_12dB = 0, HW_SDADC_PGA_GAIN_MINUS_6dB = 1, HW_SDADC_PGA_GAIN_MINUS_0dB = 2, HW_SDADC_PGA_GAIN_6dB = 3,
  HW_SDADC_PGA_GAIN_12dB = 4, HW_SDADC_PGA_GAIN_18dB = 5, HW_SDADC_PGA_GAIN_24dB = 6, HW_SDADC_PGA_GAIN_30dB = 7
}
 PGA gain selection. More...
 
enum  HW_SDADC_PGA_MODE { HW_SDADC_PGA_MODE_DIFF = 0, HW_SDADC_PGA_MODE_SE_N = 1, HW_SDADC_PGA_MODE_SE_P = 2, HW_SDADC_PGA_MODE_RESERVED = 3 }
 PGA mode selection. More...
 
enum  HW_SDADC_PGA_BIAS {
  HW_SDADC_PGA_BIAS_40 = 0, HW_SDADC_PGA_BIAS_44 = 1, HW_SDADC_PGA_BIAS_50 = 2, HW_SDADC_PGA_BIAS_57 = 3,
  HW_SDADC_PGA_BIAS_66 = 4, HW_SDADC_PGA_BIAS_80 = 5, HW_SDADC_PGA_BIAS_100 = 6, HW_SDADC_PGA_BIAS_133 = 7
}
 PGA bias configuration. More...
 
enum  HW_SDADC_PGA_EN { HW_SDADC_PGA_ENABLE_NONE = 0, HW_SDADC_PGA_ENABLE_POSITIVE = 1, HW_SDADC_PGA_ENABLE_NEGATIVE = 2, HW_SDADC_PGA_ENABLE_BOTH = 3 }
 PGA enabled branch(es) More...
 

Functions

__STATIC_INLINE bool hw_sdadc_in_progress (void)
 Check if conversion is in progress. More...
 
__STATIC_INLINE void hw_sdadc_enable_interrupt (void)
 Enable SDADC interrupt. More...
 
__STATIC_INLINE void hw_sdadc_disable_interrupt (void)
 Disable SDADC interrupt. More...
 
__STATIC_INLINE bool hw_sdadc_is_interrupt_enabled (void)
 Get the status of the SDADC maskable interrupt (MINT) to the CPU. More...
 
__STATIC_INLINE void hw_sdadc_set_continuous (bool enabled)
 Set continuous mode. More...
 
__STATIC_INLINE bool hw_sdadc_get_continuous (void)
 Get continuous mode state. More...
 
__STATIC_INLINE void hw_sdadc_set_dma_functionality (bool enabled)
 Enable/Disable DMA functionality. More...
 
__STATIC_INLINE bool hw_sdadc_get_dma_functionality (void)
 Get DMA functionality state. More...
 
void hw_sdadc_set_input_mode (HW_SDADC_INPUT_MODE mode)
 Set input mode. More...
 
__STATIC_INLINE HW_SDADC_INPUT_MODE hw_sdadc_get_input_mode (void)
 Get current input mode. More...
 
__STATIC_FORCEINLINE void hw_sdadc_set_oversampling (HW_SDADC_OSR osr)
 Set oversampling. More...
 
__STATIC_INLINE HW_SDADC_OSR hw_sdadc_get_oversampling (void)
 Get current oversampling. More...
 
__STATIC_INLINE void hw_sdadc_set_vref_sel (HW_SDADC_VREF_SEL vref_sel)
 Select voltage reference source. More...
 
__STATIC_INLINE HW_SDADC_VREF_SEL hw_sdadc_get_vref_selection (void)
 Get voltage reference source. More...
 
__STATIC_INLINE uint16_t hw_sdadc_get_raw_value (void)
 Get the result register value. More...
 
__STATIC_INLINE void hw_sdadc_connect_vref_to_pad (void)
 Connect reference voltage to GPIO pad. More...
 
__STATIC_INLINE void hw_sdadc_disconnect_vref_from_pad (void)
 Disconnect reference voltage from GPIO pad. More...
 
__STATIC_FORCEINLINE void hw_sdadc_set_gain_correction (uint16_t gain)
 Set gain correction. More...
 
__STATIC_INLINE uint16_t hw_sdadc_get_gain_correction (void)
 Get current gain value. More...
 
__STATIC_INLINE void hw_sdadc_set_offset_correction (uint16_t offset)
 Set offset correction. More...
 
__STATIC_INLINE uint16_t hw_sdadc_get_offset_correction (void)
 Get current offset value. More...
 
__STATIC_INLINE void hw_sdadc_pga_set_gain (HW_SDADC_PGA_GAIN gain)
 Set the PGA gain. More...
 
__STATIC_INLINE HW_SDADC_PGA_GAIN hw_sdadc_pga_get_gain (void)
 Get the PGA gain status. More...
 
__STATIC_INLINE void hw_sdadc_pga_set_mode (HW_SDADC_PGA_MODE mode)
 Set the PGA branch mode. Use PGA in single ended/differential mode. More...
 
__STATIC_INLINE HW_SDADC_PGA_MODE hw_sdadc_pga_get_mode (void)
 Get the PGA branch mode status. More...
 
__STATIC_INLINE void hw_sdadc_pga_mute (void)
 Mute the PGA. More...
 
__STATIC_INLINE void hw_sdadc_pga_unmute (void)
 Un-mute the PGA. More...
 
__STATIC_INLINE bool hw_sdadc_pga_is_mute (void)
 Get the PGA mute status. More...
 
__STATIC_INLINE void hw_sdadc_pga_set_bias (HW_SDADC_PGA_BIAS bias)
 Set the PGA bias. More...
 
__STATIC_INLINE HW_SDADC_PGA_BIAS hw_sdadc_pga_get_bias (void)
 Get the PGA bias status. More...
 
__STATIC_INLINE void hw_sdadc_pga_short_inputs (void)
 Short the PGA input channels. More...
 
__STATIC_INLINE void hw_sdadc_pga_unshort_inputs (void)
 Disconnect the short-circuited PGA input channels. More...
 
__STATIC_INLINE bool hw_sdadc_pga_inputs_are_shorted (void)
 Get the PGA short-input status. More...
 
__STATIC_INLINE void hw_sdadc_pga_select_enabled_channels (HW_SDADC_PGA_EN channels)
 Select the enabled PGA input channel(s) More...
 
__STATIC_INLINE HW_SDADC_PGA_GAIN hw_sdadc_pga_enabled_channels_status (void)
 Get the PGA enabled input-channel status. More...
 
__STATIC_INLINE void hw_sdadc_set_cic_offset (uint32_t val)
 Set the audio filter register. More...
 
__STATIC_INLINE uint32_t hw_sdadc_get_cic_offset (void)
 Get the audio filter register status. More...
 
void hw_sdadc_init (const hw_sdadc_config_t *cfg)
 Initialize SDADC. More...
 
void hw_sdadc_audio_init (hw_sdadc_interrupt_cb cb, const hw_sdadc_pga_config_t *cfg)
 Initialize the SDADC to configure the audio path. More...
 
void hw_sdadc_configure (const hw_sdadc_config_t *cfg)
 Configure SDADC. More...
 
void hw_sdadc_register_interrupt (hw_sdadc_interrupt_cb cb)
 Register interrupt handler. More...
 
void hw_sdadc_unregister_interrupt (void)
 Unregister interrupt handler. More...
 
__STATIC_INLINE void hw_sdadc_clear_interrupt (void)
 Clear interrupt. More...
 
void hw_sdadc_stop_and_wait (void)
 Stop and Wait. More...
 
__STATIC_INLINE void hw_sdadc_enable (void)
 Enable SDADC. More...
 
__STATIC_INLINE void hw_sdadc_disable (void)
 Disable SDADC. More...
 
__STATIC_INLINE bool hw_sdadc_is_enabled (void)
 Get the enable status of the SDADC. More...
 
void hw_sdadc_start (void)
 Start conversion. More...
 
__STATIC_INLINE void hw_sdadc_adc_measure (void)
 Start the ADC conversion engine, providing one measurement. More...
 
int32_t hw_sdadc_get_voltage (const hw_sdadc_config_t *cfg)
 Perform an ADC measurement and return the ADC value converted to mV. More...
 
int32_t hw_sdadc_convert_to_millivolt (const hw_sdadc_config_t *cfg, uint16_t raw)
 Convert the ADC value to mV. More...
 
bool hw_sdadc_read (uint32_t nof_conv, uint16_t *out_buf, hw_sdadc_read_cb cb, void *user_data)
 Generic read function Follows. More...
 
void hw_sdadc_abort_read (void)
 Stop conversions. More...
 
void hw_sdadc_store_ext_ref_calibration_values (int16_t gain, int16_t offset)
 Store external reference voltage calibration values. More...
 

Detailed Description

Definition of API for the SDADC Low Level Driver.

Copyright (C) 2018-2023 Renesas Electronics Corporation and/or its affiliates. All rights reserved. Confidential Information.

This software ("Software") is supplied by Renesas Electronics Corporation and/or its affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable, revocable, non-sub-licensable right and license to use the Software, solely if used in or together with Renesas products. You may make copies of this Software, provided this copyright notice and disclaimer ("Notice") is included in all such copies. Renesas reserves the right to change or discontinue the Software at any time without notice.

THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND, WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS SOFTWARE.