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

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

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

Go to the source code of this file.

Data Structures

struct  hw_gpadc_calibration_point_t
 Calibration Data - (Temperature, 16-bit ADC value) pair. More...
 

Macros

#define HW_GPADC_RESULT_NOB   (16U)
 The 16 LSBits of the 32-bit result register. More...
 
#define HW_GPADC_DEFAULT_ENOB   (10U)
 The default Effective Number Of Bits with no averaging (zero oversampling) More...
 
#define HW_GPADC_UNUSED_BITS   (HW_GPADC_RESULT_NOB - HW_GPADC_DEFAULT_ENOB)
 The excessive bits in the result register with no averaging (zero oversampling) More...
 
#define HW_GPADC_MID_SCALE_ADC   (1 << (HW_GPADC_RESULT_NOB - 1))
 A help macro to define a mid-scale measurement: 0 mVolt in Differential mode Vref/2 mVolt in Single-ended mode.
 
#define HW_GPADC_OFFSET_RESET   0x200
 Reset value for the GP_ADC_OFFP and GP_ADC_OFFN registers. The given default 0x200 is suitable for Common Mode Level = VREF/2. It should be adjusted according to paragraph Common Mode Adjustment in the DataSheet.
 
#define HW_GPADC_DMA_SUPPORT   dg_configGPADC_DMA_SUPPORT
 DMA support for GPADC.
 

Typedefs

typedef void(* hw_gpadc_interrupt_cb) (void)
 ADC interrupt handler. More...
 
typedef void(* hw_gpadc_read_cb) (void *user_data, uint32_t conv_to_go)
 ADC callback for read function. More...
 

Enumerations

enum  HW_GPADC_INPUT_MODE { HW_GPADC_INPUT_MODE_DIFFERENTIAL = 0, HW_GPADC_INPUT_MODE_SINGLE_ENDED = 1 }
 ADC input mode. More...
 
enum  HW_GPADC_OVERSAMPLING {
  HW_GPADC_OVERSAMPLING_1_SAMPLE = 0, HW_GPADC_OVERSAMPLING_2_SAMPLES = 1, HW_GPADC_OVERSAMPLING_4_SAMPLES = 2, HW_GPADC_OVERSAMPLING_8_SAMPLES = 3,
  HW_GPADC_OVERSAMPLING_16_SAMPLES = 4, HW_GPADC_OVERSAMPLING_32_SAMPLES = 5, HW_GPADC_OVERSAMPLING_64_SAMPLES = 6, HW_GPADC_OVERSAMPLING_128_SAMPLES = 7
}
 GPADC oversampling. More...
 

Functions

__STATIC_INLINE void hw_gpadc_set_continuous (bool enabled)
 Set continuous mode. More...
 
__STATIC_INLINE bool hw_gpadc_get_continuous (void)
 Get continuous mode state. More...
 
__STATIC_INLINE void hw_gpadc_set_input_mode (HW_GPADC_INPUT_MODE mode)
 Set input mode. More...
 
__STATIC_INLINE HW_GPADC_INPUT_MODE hw_gpadc_get_input_mode (void)
 Get the current input mode. More...
 
__STATIC_INLINE void hw_gpadc_set_oversampling (HW_GPADC_OVERSAMPLING n_samples)
 Set oversampling. More...
 
__STATIC_INLINE HW_GPADC_OVERSAMPLING hw_gpadc_get_oversampling (void)
 Get the current oversampling. More...
 
__STATIC_INLINE void hw_gpadc_set_mute (bool enabled)
 Set input mute state. More...
 
__STATIC_INLINE bool hw_gpadc_get_mute (void)
 Get the current input mute state. More...
 
__STATIC_INLINE void hw_gpadc_set_sign_change (bool enabled)
 Set input and output sign change. More...
 
__STATIC_INLINE bool hw_gpadc_get_sign_change (void)
 Get the current input and output sign change. More...
 
__STATIC_INLINE void hw_gpadc_set_chopping (bool enabled)
 Set chopping state. More...
 
__STATIC_INLINE bool hw_gpadc_get_chopping (void)
 Get the current chopping state. More...
 
__STATIC_INLINE void hw_gpadc_set_mint (bool enabled)
 Set masked interrupt. More...
 
__STATIC_INLINE bool hw_gpadc_get_mint (void)
 Get masked interrupt state. More...
 
__STATIC_INLINE void hw_gpadc_set_ldo_constant_current (bool enabled)
 Set state of constant 20uA load current on ADC LDO output. More...
 
__STATIC_INLINE bool hw_gpadc_get_ldo_constant_current (void)
 Get the current state of constant 20uA load current on ADC LDO output. More...
 
__STATIC_INLINE void hw_gpadc_set_interval (uint8_t mult)
 Set interval between conversions in continuous mode. More...
 
__STATIC_INLINE uint8_t hw_gpadc_get_interval (void)
 Get the current interval between conversions in continuous mode. More...
 
__STATIC_INLINE void hw_gpadc_set_dma_functionality (bool enabled)
 Set DMA functionality. More...
 
__STATIC_INLINE bool hw_gpadc_get_dma_functionality (void)
 Get current state of DMA functionality. More...
 
__STATIC_INLINE void hw_gpadc_set_offset_positive (uint16_t offset)
 Set offset adjustment for positive ADC array. This register offers a coarse offset calibration, whereas a finer calibration occurs in the hw_gpadc_apply_correction, using the device trim values (positive/negative offsets, gain correction) stored in the Configuration Script. More...
 
__STATIC_INLINE uint16_t hw_gpadc_get_offset_positive (void)
 Get the current offset adjustment for positive ADC array. More...
 
__STATIC_INLINE void hw_gpadc_set_offset_negative (uint16_t offset)
 Set offset adjustment for negative ADC array. This register offers a coarse offset calibration, whereas a finer calibration occurs in the hw_gpadc_apply_correction, using the device trim values (positive/negative offsets, gain correction) stored in the Configuration Script. More...
 
__STATIC_INLINE uint16_t hw_gpadc_get_offset_negative (void)
 Get the current offset adjustment for negative ADC array. More...
 
void hw_gpadc_store_se_gain_error (int16_t single)
 Store Single Ended ADC Gain Error. More...
 
void hw_gpadc_store_diff_gain_error (int16_t diff)
 Store Differential ADC Gain Error. More...
 
void hw_gpadc_store_se_offset_error (int16_t single)
 Store Single Ended ADC Offset Error. More...
 
void hw_gpadc_store_diff_offset_error (int16_t diff)
 Store Differential ADC Offset Error. More...
 
__STATIC_INLINE int16_t hw_gpadc_calculate_single_ended_gain_error (int16_t low, int16_t high)
 Calculate Single Ended ADC Gain Error from two points. More...
 
__STATIC_INLINE int16_t hw_gpadc_calculate_single_ended_offset_error (int16_t low, int16_t high)
 Calculate Single Ended ADC Offset Error from two points. More...
 
__STATIC_INLINE int16_t hw_gpadc_calculate_differential_gain_error (int16_t low, int16_t high)
 Calculate Differential ADC Gain Error from two points. More...
 
__STATIC_INLINE int16_t hw_gpadc_calculate_differential_offset_error (int16_t low, int16_t high)
 Calculate Differential ADC Offset Error from two points. More...
 
bool hw_gpadc_pre_check_for_gain_error (void)
 Check the availability of ADC Gain Error. More...
 
int16_t hw_gpadc_get_single_ended_gain_error (void)
 Get single ended ADC Gain Error. More...
 
void hw_gpadc_offset_calibrate (void)
 Perform coarse ADC offset calibration. More...
 
void hw_gpadc_init (const hw_gpadc_config_t *cfg, bool enable)
 Initialize ADC. More...
 
void hw_gpadc_configure (const hw_gpadc_config_t *cfg)
 Configure ADC. More...
 
void hw_gpadc_register_interrupt (hw_gpadc_interrupt_cb cb)
 Register interrupt handler. More...
 
void hw_gpadc_unregister_interrupt (void)
 Unregister interrupt handler. More...
 
void hw_gpadc_unregister_interrupt_no_clear (void)
 Unregister interrupt handler without clearing the ADC engine interrupt. Only the NVIC interrupt is disabled and cleared. More...
 
__STATIC_INLINE void hw_gpadc_clear_interrupt (void)
 Clear interrupt. More...
 
__STATIC_INLINE void hw_gpadc_enable (void)
 Enable ADC. More...
 
__STATIC_INLINE void hw_gpadc_disable (void)
 Disable ADC. More...
 
__STATIC_INLINE bool hw_gpadc_is_enabled (void)
 ADC enabled state. More...
 
__STATIC_INLINE void hw_gpadc_start (void)
 Start conversion. More...
 
__STATIC_INLINE bool hw_gpadc_in_progress (void)
 Check if conversion is in progress. More...
 
__STATIC_INLINE uint16_t hw_gpadc_get_raw_value (void)
 Get raw ADC value. More...
 
uint16_t hw_gpadc_get_value (void)
 Get conversion result value with gain compensation and over sampling. More...
 
__STATIC_INLINE void hw_gpadc_adc_measure (void)
 Start the ADC conversion engine, providing a measurement. More...
 
bool hw_gpadc_read (uint32_t nof_conv, uint16_t *out_buf, hw_gpadc_read_cb cb, void *user_data)
 Generic read function Follows. More...
 
void hw_gpadc_abort_read (void)
 Stop conversions. More...
 
uint16_t hw_gpadc_apply_correction (const hw_gpadc_config_t *cfg, uint16_t raw)
 Apply a fine trimming algorithm to the conversion result. More...
 
int16_t hw_gpadc_convert_to_millivolt (const hw_gpadc_config_t *cfg, uint16_t raw)
 Convert a GPADC raw measurement to voltage in mVolt. If no configuration is given, the current state of the GPADC control registers is used for the conversion parameters. More...
 

Detailed Description

Definition of API for the GPADC Low Level Driver.

Copyright (C) 2015-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.