SmartSnippets DA1459x SDK
Data Structures | Macros | Enumerations | Functions
hw_gpadc_v2.h File Reference

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

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

Go to the source code of this file.

Data Structures

struct  hw_gpadc_config_t
 ADC configuration. More...
 

Macros

#define HW_GPADC_DIE_TEMP_SMPL_TIME   0x04
 Recommended sample time setting for accurate temperature measurements with DIE_TEMP. More...
 
#define HW_GPADC_DIE_TEMP_INIT_DELAY   0x68 /* 26 usec with a clock speed of (DivN_clk / 2) */
 Delay for enabling the ADC after enabling the LDO when ADC input is the temperature sensor. More...
 
#define HW_GPADC_VREF_MILLIVOLT   (900)
 GPADC Reference Voltage Level. More...
 

Enumerations

enum  HW_GPADC_MAX_INPUT_VOLTAGE { HW_GPADC_INPUT_VOLTAGE_UP_TO_0V9 = 0, HW_GPADC_INPUT_VOLTAGE_UP_TO_1V8 = 1, HW_GPADC_INPUT_VOLTAGE_UP_TO_2V7 = 2, HW_GPADC_INPUT_VOLTAGE_UP_TO_3V6 = 3 }
 GPADC input voltages. More...
 
enum  HW_GPADC_STORE_DELAY {
  HW_GPADC_STORE_DEL_0 = 0x0, HW_GPADC_STORE_DEL_2_CYCLES = 0x1, HW_GPADC_STORE_DEL_3_CYCLES = 0x2, HW_GPADC_STORE_DEL_4_CYCLES = 0x3,
  HW_GPADC_STORE_DEL_5_CYCLES = 0x4, HW_GPADC_STORE_DEL_6_CYCLES = 0x5, HW_GPADC_STORE_DEL_7_CYCLES = 0x6, HW_GPADC_STORE_DEL_8_CYCLES = 0x7
}
 Store delay. More...
 
enum  HW_GPADC_INPUT_POSITIVE {
  HW_GPADC_INP_P1_0 = HW_GPADC_INPUT_ADC0, HW_GPADC_INP_P1_1 = HW_GPADC_INPUT_ADC1, HW_GPADC_INP_P1_2 = HW_GPADC_INPUT_ADC2, HW_GPADC_INP_P0_10 = HW_GPADC_INPUT_ADC3,
  HW_GPADC_INP_DIE_TEMP = 4, HW_GPADC_INP_VDCDC = 5, HW_GPADC_INP_VBAT = 6, HW_GPADC_INP_VDDD = 7,
  HW_GPADC_INP_VSSA = 8, HW_GPADC_INP_VDDIO = 9, HW_GPADC_INP_P1_5 = HW_GPADC_INPUT_ADC4, HW_GPADC_INP_P1_6 = HW_GPADC_INPUT_ADC5,
  HW_GPADC_INP_P1_9 = HW_GPADC_INPUT_ADC6, HW_GPADC_INP_P1_11 = HW_GPADC_INPUT_ADC7
}
 ADC input - Positive side. More...
 
enum  HW_GPADC_INPUT_NEGATIVE {
  HW_GPADC_INN_P1_0 = HW_GPADC_INPUT_ADC0, HW_GPADC_INN_P1_1 = HW_GPADC_INPUT_ADC1, HW_GPADC_INN_P1_2 = HW_GPADC_INPUT_ADC2, HW_GPADC_INN_P0_10 = HW_GPADC_INPUT_ADC3,
  HW_GPADC_INN_P1_5 = HW_GPADC_INPUT_ADC4, HW_GPADC_INN_P1_6 = HW_GPADC_INPUT_ADC5, HW_GPADC_INN_P1_9 = HW_GPADC_INPUT_ADC6, HW_GPADC_INN_P1_11 = HW_GPADC_INPUT_ADC7
}
 ADC input - Negative side. More...
 

Functions

__STATIC_INLINE void hw_gpadc_set_ldo_delay (uint32_t delay)
 Set the delay required to enable the ADC_LDO. 0: Not allowed 1: 4x ADC_CLK period. n: n*4x ADC_CLK period. More...
 
__STATIC_INLINE void hw_gpadc_set_store_delay (HW_GPADC_STORE_DELAY delay)
 Set STORE_DEL field. More...
 
__STATIC_INLINE void hw_gpadc_set_positive (HW_GPADC_INPUT_POSITIVE channel)
 Set positive input channel. More...
 
__STATIC_INLINE HW_GPADC_INPUT_POSITIVE hw_gpadc_get_positive (void)
 Get the current positive input channel. More...
 
__STATIC_INLINE void hw_gpadc_set_negative (HW_GPADC_INPUT_NEGATIVE channel)
 Set negative input channel. More...
 
__STATIC_INLINE HW_GPADC_INPUT_NEGATIVE hw_gpadc_get_negative (void)
 Get the current negative input channel. More...
 
__STATIC_INLINE void hw_gpadc_set_input_attenuator_state (HW_GPADC_MAX_INPUT_VOLTAGE vmax)
 Set state of input attenuator. More...
 
__STATIC_INLINE HW_GPADC_MAX_INPUT_VOLTAGE hw_gpadc_get_input_attenuator_state (void)
 Get the current state of input attenuator. More...
 
__STATIC_INLINE void hw_gpadc_set_sample_time (uint8_t mult)
 Set sample time. More...
 
__STATIC_INLINE uint8_t hw_gpadc_get_sample_time (void)
 Get the current sample time. The sample time is calculated, based on this register field value. More...
 
__STATIC_INLINE void hw_gpadc_set_die_temp (bool enabled)
 Set DIE_TEMP_EN field. More...
 
__STATIC_INLINE bool hw_gpadc_get_die_temp (void)
 Get the current status of the die-temperature sensor. Output can be measured on GPADC input 4. More...
 
__STATIC_INLINE void hw_gpadc_set_ldo_hold (bool enabled)
 Set the mode of bandgap reference. More...
 
__STATIC_INLINE bool hw_gpadc_get_ldo_hold (void)
 Get the current mode of bandgap reference. More...
 
int16_t hw_gpadc_get_voltage (void)
 Get the measured voltage in mVolt. More...
 
int16_t hw_gpadc_convert_to_celsius_x100_util (const hw_gpadc_config_t *cfg, uint16_t raw_val)
 Convert a 16-bit, left-aligned, raw value to temperature. For accurate conversions using this function the ADC should operate in the following configuration: More...
 
uint16_t hw_gpadc_convert_celsius_x100_to_raw_val_util (const hw_gpadc_config_t *cfg, int16_t temperature)
 Convert a temperature value to raw GPADC value. More...
 
void hw_gpadc_store_ambient_calibration_point (uint16_t raw_val, int16_t temp)
 Store temperature calibration point at ambient temperature. More...
 

Detailed Description

Definition of API for the GPADC Low Level Driver.

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