Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
hal_adc_sd24b.h File Reference

Detailed Description

Hardware Abstraction Layer for Sigma-Delta 24 (SD24_B)

Group: MSP Software Development

#include "sd24_b.h"
#include <stdint.h>
#include <stdbool.h>
Include dependency graph for hal_adc_sd24b.h:

Go to the source code of this file.

Data Structures

struct  _HAL_ADC_SD24_B_Channel_
 Contains the SD24 Channel Configuration. More...
 
struct  _HAL_ADC_SD24_B_Configuration_
 Contains the SD24 Configuration. More...
 

Macros

#define HAL_ADC_CONV_INVALID_INDEX   0xFF
 Invalid Index for Converter Number. More...
 
#define HAL_ADC_MAX_MOD_FREQ   2097152L
 Maximum modulation frequency is 2MHz. More...
 
#define HAL_ADC_V_ARRAY_LENGTH   4
 Size of voltage array (it must be a multiple of 2) More...
 
#define HAL_ADC_I_ARRAY_LENGTH   4
 Size of voltage array (it must be a multiple of 2) More...
 
#define HAL_ADC_V_MASK   (HAL_ADC_V_ARRAY_LENGTH-1)
 Voltage Mask used for circular buffer. More...
 
#define HAL_ADC_I_MASK   (HAL_ADC_I_ARRAY_LENGTH-1)
 Current Mask used for circular buffer. More...
 
#define HAL_ADC_CH0_READ   (BIT0)
 
#define HAL_ADC_CH1_READ   (BIT1)
 
#define HAL_ADC_CH2_READ   (BIT2)
 
#define HAL_ADC_CH3_READ   (BIT3)
 
#define HAL_ADC_CH4_READ   (BIT4)
 
#define HAL_ADC_CH5_READ   (BIT5)
 
#define HAL_ADC_CH6_READ   (BIT6)
 
#define HAL_ADC_CH7_READ   (BIT7)
 
#define HAL_ADC_CLOCK_MULT_4   4
 
#define HAL_ADC_CLOCK_MULT_8   8
 
#define HAL_ADC_CLOCK_MULT_12   12
 
#define HAL_ADC_CLOCK_MULT_16   16
 
#define HAL_ADC_CLOCK_MULT_24   24
 
#define HAL_ADC_CLOCK_MULT_32   32
 
#define HAL_ADC_CLOCK_MULT_64   64
 
#define HAL_ADC_CLOCK_MULT_96   96
 
#define HAL_ADC_CLOCK_MULT_128   128
 
#define HAL_ADC_CLOCK_MULT_192   192
 
#define HAL_ADC_CLOCK_MULT_384   384
 
#define HAL_ADC_SD24PDIV_MULT_4   (SD24_B_PRECLOCKDIVIDER_4)
 
#define HAL_ADC_SD24PDIV_MULT_8   (SD24_B_PRECLOCKDIVIDER_4)
 
#define HAL_ADC_SD24PDIV_MULT_12   (SD24_B_PRECLOCKDIVIDER_4)
 
#define HAL_ADC_SD24PDIV_MULT_16   (SD24_B_PRECLOCKDIVIDER_4)
 
#define HAL_ADC_SD24PDIV_MULT_24   (SD24_B_PRECLOCKDIVIDER_4)
 
#define HAL_ADC_SD24PDIV_MULT_32   (SD24_B_PRECLOCKDIVIDER_4)
 
#define HAL_ADC_SD24PDIV_MULT_48   (SD24_B_PRECLOCKDIVIDER_4)
 
#define HAL_ADC_SD24PDIV_MULT_64   (SD24_B_PRECLOCKDIVIDER_4)
 
#define HAL_ADC_SD24PDIV_MULT_96   (SD24_B_PRECLOCKDIVIDER_4)
 
#define HAL_ADC_SD24PDIV_MULT_128   (SD24_B_PRECLOCKDIVIDER_4)
 
#define HAL_ADC_SD24PDIV_MULT_192   (SD24_B_PRECLOCKDIVIDER_8)
 
#define HAL_ADC_SD24PDIV_MULT_384   (SD24_B_PRECLOCKDIVIDER_128)
 
#define HAL_ADC_SD24DIV_MULT_4   (SD24_B_CLOCKDIVIDER_1)
 
#define HAL_ADC_SD24DIV_MULT_8   (SD24_B_CLOCKDIVIDER_2)
 
#define HAL_ADC_SD24DIV_MULT_12   (SD24_B_CLOCKDIVIDER_3)
 
#define HAL_ADC_SD24DIV_MULT_16   (SD24_B_CLOCKDIVIDER_4)
 
#define HAL_ADC_SD24DIV_MULT_24   (SD24_B_CLOCKDIVIDER_6)
 
#define HAL_ADC_SD24DIV_MULT_32   (SD24_B_CLOCKDIVIDER_8)
 
#define HAL_ADC_SD24DIV_MULT_48   (SD24_B_CLOCKDIVIDER_12)
 
#define HAL_ADC_SD24DIV_MULT_64   (SD24_B_CLOCKDIVIDER_16)
 
#define HAL_ADC_SD24DIV_MULT_96   (SD24_B_CLOCKDIVIDER_24)
 
#define HAL_ADC_SD24DIV_MULT_128   (SD24_B_CLOCKDIVIDER_32)
 
#define HAL_ADC_SD24DIV_MULT_192   (SD24_B_CLOCKDIVIDER_24)
 
#define HAL_ADC_SD24DIV_MULT_384   (SD24_B_CLOCKDIVIDER_3)
 
#define HAL_ADC_FREQ_2048_HZ   2048
 
#define HAL_ADC_FREQ_4096_HZ   4096
 
#define HAL_ADC_FREQ_8192_HZ   8192
 
#define HAL_ADC_FREQ_16384_HZ   16384
 
#define HAL_ADC_PHASE_NO_DATA_READY   0x00
 
#define HAL_ADC_PHASE_A_DATA_READY   0x01
 
#define HAL_ADC_PHASE_B_DATA_READY   0x02
 
#define HAL_ADC_PHASE_C_DATA_READY   0x04
 
#define HAL_ADC_PHASE_D_DATA_READY   0x08
 
#define HAL_ADC_PHASE_E_DATA_READY   0x10
 
#define HAL_ADC_PHASE_F_DATA_READY   0x20
 
#define HAL_ADC_PHASE_NEUTRAL_DATA_READY   0x40
 
#define HAL_ADC_PHASE_TOTAL_DATA_READY   0x80
 

Typedefs

typedef enum _HAL_ADC_message_code_ HAL_ADC_message_code
 The following enumeration contain all possible HAL_ADC driver return message codes. More...
 
typedef struct _HAL_ADC_SD24_B_Channel_ HAL_ADC_SD24_B_Channel
 Contains the SD24 Channel Configuration. More...
 
typedef struct _HAL_ADC_SD24_B_Configuration_ HAL_ADC_SD24_B_Configuration
 Contains the SD24 Configuration. More...
 

Enumerations

enum  _HAL_ADC_message_code_ {
  HAL_ADC_message_code_no_error =0, HAL_ADC_message_code_invalid_freq_error =1, HAL_ADC_message_code_no_error =0, HAL_ADC_message_code_invalid_mod_freq_error =1,
  HAL_ADC_message_code_invalid_clock_divider_error =2
}
 The following enumeration contain all possible HAL_ADC driver return message codes. More...
 

Functions

HAL_ADC_message_code HAL_ADC_init (HAL_ADC_SD24_B_Configuration *config)
 The following API configures SD24_B module based on user configuration files "emSwLib_userConfig.c" and "emSwLib_userConfig.h". More...
 
void HAL_ADC_startConversion (HAL_ADC_SD24_B_Configuration *config)
 The following API starts the enabled converters. More...
 
void HAL_ADC_stopConversion (HAL_ADC_SD24_B_Configuration *config)
 The following API stops the enabled converters. More...
 
void HAL_ADC_enableInterrupts (HAL_ADC_SD24_B_Configuration *config)
 The following API enables the interrupt for the master converter. More...
 
void HAL_ADC_disableInterrupts (HAL_ADC_SD24_B_Configuration *config)
 The following API disables the interrupt for all the channels initialized in adcChannelArray (located in the "emSwLib_userConfig.c") More...
 
void HAL_ADC_clearVariables (uint8_t phase)
 The following API clears all the global variables used in the ISR.) More...
 

Variables

volatile uint8_t phaseDataReady
 
HAL_ADC_SD24_B_Configuration halAdcConfig
 

Macro Definition Documentation

§ HAL_ADC_CONV_INVALID_INDEX

#define HAL_ADC_CONV_INVALID_INDEX   0xFF

Invalid Index for Converter Number.

(C) Copyright 2017, Texas Instruments, Inc.

§ HAL_ADC_MAX_MOD_FREQ

#define HAL_ADC_MAX_MOD_FREQ   2097152L

Maximum modulation frequency is 2MHz.

§ HAL_ADC_V_ARRAY_LENGTH

#define HAL_ADC_V_ARRAY_LENGTH   4

Size of voltage array (it must be a multiple of 2)

§ HAL_ADC_I_ARRAY_LENGTH

#define HAL_ADC_I_ARRAY_LENGTH   4

Size of voltage array (it must be a multiple of 2)

§ HAL_ADC_V_MASK

#define HAL_ADC_V_MASK   (HAL_ADC_V_ARRAY_LENGTH-1)

Voltage Mask used for circular buffer.

§ HAL_ADC_I_MASK

#define HAL_ADC_I_MASK   (HAL_ADC_I_ARRAY_LENGTH-1)

Current Mask used for circular buffer.

§ HAL_ADC_CH0_READ

#define HAL_ADC_CH0_READ   (BIT0)

§ HAL_ADC_CH1_READ

#define HAL_ADC_CH1_READ   (BIT1)

§ HAL_ADC_CH2_READ

#define HAL_ADC_CH2_READ   (BIT2)

§ HAL_ADC_CH3_READ

#define HAL_ADC_CH3_READ   (BIT3)

§ HAL_ADC_CH4_READ

#define HAL_ADC_CH4_READ   (BIT4)

§ HAL_ADC_CH5_READ

#define HAL_ADC_CH5_READ   (BIT5)

§ HAL_ADC_CH6_READ

#define HAL_ADC_CH6_READ   (BIT6)

§ HAL_ADC_CH7_READ

#define HAL_ADC_CH7_READ   (BIT7)

§ HAL_ADC_CLOCK_MULT_4

#define HAL_ADC_CLOCK_MULT_4   4

§ HAL_ADC_CLOCK_MULT_8

#define HAL_ADC_CLOCK_MULT_8   8

§ HAL_ADC_CLOCK_MULT_12

#define HAL_ADC_CLOCK_MULT_12   12

§ HAL_ADC_CLOCK_MULT_16

#define HAL_ADC_CLOCK_MULT_16   16

§ HAL_ADC_CLOCK_MULT_24

#define HAL_ADC_CLOCK_MULT_24   24

§ HAL_ADC_CLOCK_MULT_32

#define HAL_ADC_CLOCK_MULT_32   32

§ HAL_ADC_CLOCK_MULT_64

#define HAL_ADC_CLOCK_MULT_64   64

§ HAL_ADC_CLOCK_MULT_96

#define HAL_ADC_CLOCK_MULT_96   96

§ HAL_ADC_CLOCK_MULT_128

#define HAL_ADC_CLOCK_MULT_128   128

§ HAL_ADC_CLOCK_MULT_192

#define HAL_ADC_CLOCK_MULT_192   192

§ HAL_ADC_CLOCK_MULT_384

#define HAL_ADC_CLOCK_MULT_384   384

§ HAL_ADC_SD24PDIV_MULT_4

#define HAL_ADC_SD24PDIV_MULT_4   (SD24_B_PRECLOCKDIVIDER_4)

§ HAL_ADC_SD24PDIV_MULT_8

#define HAL_ADC_SD24PDIV_MULT_8   (SD24_B_PRECLOCKDIVIDER_4)

§ HAL_ADC_SD24PDIV_MULT_12

#define HAL_ADC_SD24PDIV_MULT_12   (SD24_B_PRECLOCKDIVIDER_4)

§ HAL_ADC_SD24PDIV_MULT_16

#define HAL_ADC_SD24PDIV_MULT_16   (SD24_B_PRECLOCKDIVIDER_4)

§ HAL_ADC_SD24PDIV_MULT_24

#define HAL_ADC_SD24PDIV_MULT_24   (SD24_B_PRECLOCKDIVIDER_4)

§ HAL_ADC_SD24PDIV_MULT_32

#define HAL_ADC_SD24PDIV_MULT_32   (SD24_B_PRECLOCKDIVIDER_4)

§ HAL_ADC_SD24PDIV_MULT_48

#define HAL_ADC_SD24PDIV_MULT_48   (SD24_B_PRECLOCKDIVIDER_4)

§ HAL_ADC_SD24PDIV_MULT_64

#define HAL_ADC_SD24PDIV_MULT_64   (SD24_B_PRECLOCKDIVIDER_4)

§ HAL_ADC_SD24PDIV_MULT_96

#define HAL_ADC_SD24PDIV_MULT_96   (SD24_B_PRECLOCKDIVIDER_4)

§ HAL_ADC_SD24PDIV_MULT_128

#define HAL_ADC_SD24PDIV_MULT_128   (SD24_B_PRECLOCKDIVIDER_4)

§ HAL_ADC_SD24PDIV_MULT_192

#define HAL_ADC_SD24PDIV_MULT_192   (SD24_B_PRECLOCKDIVIDER_8)

§ HAL_ADC_SD24PDIV_MULT_384

#define HAL_ADC_SD24PDIV_MULT_384   (SD24_B_PRECLOCKDIVIDER_128)

§ HAL_ADC_SD24DIV_MULT_4

#define HAL_ADC_SD24DIV_MULT_4   (SD24_B_CLOCKDIVIDER_1)

§ HAL_ADC_SD24DIV_MULT_8

#define HAL_ADC_SD24DIV_MULT_8   (SD24_B_CLOCKDIVIDER_2)

§ HAL_ADC_SD24DIV_MULT_12

#define HAL_ADC_SD24DIV_MULT_12   (SD24_B_CLOCKDIVIDER_3)

§ HAL_ADC_SD24DIV_MULT_16

#define HAL_ADC_SD24DIV_MULT_16   (SD24_B_CLOCKDIVIDER_4)

§ HAL_ADC_SD24DIV_MULT_24

#define HAL_ADC_SD24DIV_MULT_24   (SD24_B_CLOCKDIVIDER_6)

§ HAL_ADC_SD24DIV_MULT_32

#define HAL_ADC_SD24DIV_MULT_32   (SD24_B_CLOCKDIVIDER_8)

§ HAL_ADC_SD24DIV_MULT_48

#define HAL_ADC_SD24DIV_MULT_48   (SD24_B_CLOCKDIVIDER_12)

§ HAL_ADC_SD24DIV_MULT_64

#define HAL_ADC_SD24DIV_MULT_64   (SD24_B_CLOCKDIVIDER_16)

§ HAL_ADC_SD24DIV_MULT_96

#define HAL_ADC_SD24DIV_MULT_96   (SD24_B_CLOCKDIVIDER_24)

§ HAL_ADC_SD24DIV_MULT_128

#define HAL_ADC_SD24DIV_MULT_128   (SD24_B_CLOCKDIVIDER_32)

§ HAL_ADC_SD24DIV_MULT_192

#define HAL_ADC_SD24DIV_MULT_192   (SD24_B_CLOCKDIVIDER_24)

§ HAL_ADC_SD24DIV_MULT_384

#define HAL_ADC_SD24DIV_MULT_384   (SD24_B_CLOCKDIVIDER_3)

§ HAL_ADC_FREQ_2048_HZ

#define HAL_ADC_FREQ_2048_HZ   2048

§ HAL_ADC_FREQ_4096_HZ

#define HAL_ADC_FREQ_4096_HZ   4096

§ HAL_ADC_FREQ_8192_HZ

#define HAL_ADC_FREQ_8192_HZ   8192

§ HAL_ADC_FREQ_16384_HZ

#define HAL_ADC_FREQ_16384_HZ   16384

§ HAL_ADC_PHASE_NO_DATA_READY

#define HAL_ADC_PHASE_NO_DATA_READY   0x00

§ HAL_ADC_PHASE_A_DATA_READY

#define HAL_ADC_PHASE_A_DATA_READY   0x01

§ HAL_ADC_PHASE_B_DATA_READY

#define HAL_ADC_PHASE_B_DATA_READY   0x02

§ HAL_ADC_PHASE_C_DATA_READY

#define HAL_ADC_PHASE_C_DATA_READY   0x04

§ HAL_ADC_PHASE_D_DATA_READY

#define HAL_ADC_PHASE_D_DATA_READY   0x08

§ HAL_ADC_PHASE_E_DATA_READY

#define HAL_ADC_PHASE_E_DATA_READY   0x10

§ HAL_ADC_PHASE_F_DATA_READY

#define HAL_ADC_PHASE_F_DATA_READY   0x20

§ HAL_ADC_PHASE_NEUTRAL_DATA_READY

#define HAL_ADC_PHASE_NEUTRAL_DATA_READY   0x40

§ HAL_ADC_PHASE_TOTAL_DATA_READY

#define HAL_ADC_PHASE_TOTAL_DATA_READY   0x80

Typedef Documentation

§ HAL_ADC_message_code

The following enumeration contain all possible HAL_ADC driver return message codes.

§ HAL_ADC_SD24_B_Channel

Contains the SD24 Channel Configuration.

§ HAL_ADC_SD24_B_Configuration

Contains the SD24 Configuration.

Enumeration Type Documentation

§ _HAL_ADC_message_code_

The following enumeration contain all possible HAL_ADC driver return message codes.

Enumerator
HAL_ADC_message_code_no_error 

This message code is returned when no error was detected while invoking the API.

HAL_ADC_message_code_invalid_freq_error 

This message code is returned when the input frequency is not supported.

HAL_ADC_message_code_no_error 

This message code is returned when no error was detected while invoking the API.

HAL_ADC_message_code_invalid_mod_freq_error 

This message code is returned when the modulation frequency (OSR*sampFreq) is greater than 2Mhz

HAL_ADC_message_code_invalid_clock_divider_error 

This message code is returned when the clock divider multiplier (SMCLK / (OSR * sampleFreq) is not supported.

© Copyright 1995-2018, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale