Data Structures | Macros | Enumerations | Variables
ADCBufMSP432.h File Reference

Detailed Description

ADC driver implementation for a MSP432 analog-to-digital converter.

============================================================================

Refer to ADCBuf.h for a complete description of APIs & example of use

#include <stdint.h>
#include <stdbool.h>
#include <ti/devices/DeviceFamily.h>
#include <ti/devices/msp432p4xx/driverlib/sysctl_a.h>
#include <ti/drivers/ADCBuf.h>
#include <ti/drivers/dpl/HwiP.h>
#include <ti/drivers/dpl/SemaphoreP.h>
#include <ti/drivers/Power.h>
#include <ti/drivers/dma/UDMAMSP432.h>
#include <ti/devices/msp432p4xx/driverlib/adc14.h>
Include dependency graph for ADCBufMSP432.h:

Go to the source code of this file.

Data Structures

struct  ADCBufMSP432_ParamsExtension
 MSP432 specific extension to ADCBuf_Params. More...
 
struct  ADCBufMSP432_Channels
 ADCMSP432 Channel setting These fields define channel-specific settings: GPIO and reference voltage. These settings happen when ADCBuf_convert() is called. More...
 
struct  ADCBufMSP432_HWAttrs
 ADCBufMSP432 Hardware attributes These fields are populated by PinMux tool but user is allowed to change for different channels setting. More...
 
struct  ADCBufMSP432_Object
 ADCBufMSP432 Object. More...
 

Macros

#define ADCBufMSP432_CMD_ENTER_ADC_ULTRA_LOW_POWER_MODE   ADCBuf_CMD_RESERVED + 1
 This control function enters ADC in low power mode. More...
 
#define ADCBufMSP432_CMD_EXIT_ADC_ULTRA_LOW_POWER_MODE   ADCBuf_CMD_RESERVED + 2
 This control function exits ADC from low power mode. More...
 
#define ADCBufMSP432_P4_0_A13   ((13 << 10) | 0x0340) /* ch 13, port 4, pin 0 */
 
#define ADCBufMSP432_P4_1_A12   ((12 << 10) | 0x0341) /* ch 12, port 4, pin 1 */
 
#define ADCBufMSP432_P4_2_A11   ((11 << 10) | 0x0342) /* ch 11, port 4, pin 2 */
 
#define ADCBufMSP432_P4_3_A10   ((10 << 10) | 0x0343) /* ch 10, port 4, pin 3 */
 
#define ADCBufMSP432_P4_4_A9   ((9 << 10) | 0x0344) /* ch 9, port 4, pin 4 */
 
#define ADCBufMSP432_P4_5_A8   ((8 << 10) | 0x0345) /* ch 8, port 4, pin 5 */
 
#define ADCBufMSP432_P4_6_A7   ((7 << 10) | 0x0346) /* ch 7, port 4, pin 6 */
 
#define ADCBufMSP432_P4_7_A6   ((6 << 10) | 0x0347) /* ch 6, port 4, pin 7 */
 
#define ADCBufMSP432_P5_0_A5   ((5 << 10) | 0x0350) /* ch 5, port 5, pin 0 */
 
#define ADCBufMSP432_P5_1_A4   ((4 << 10) | 0x0351) /* ch 4, port 5, pin 1 */
 
#define ADCBufMSP432_P5_2_A3   ((3 << 10) | 0x0352) /* ch 3, port 5, pin 2 */
 
#define ADCBufMSP432_P5_3_A2   ((2 << 10) | 0x0353) /* ch 2, port 5, pin 3 */
 
#define ADCBufMSP432_P5_4_A1   ((1 << 10) | 0x0354) /* ch 1, port 5, pin 4 */
 
#define ADCBufMSP432_P5_5_A0   ((0 << 10) | 0x0355) /* ch 0, port 5, pin 5 */
 
#define ADCBufMSP432_P6_0_A15   ((15 << 10) | 0x0360) /* ch 15, port 6, pin 0 */
 
#define ADCBufMSP432_P6_1_A14   ((14 << 10) | 0x0361) /* ch 14, port 6, pin 1 */
 
#define ADCBufMSP432_P8_2_A23   ((23 << 10) | 0x0382) /* ch 23, port 8, pin 2 */
 
#define ADCBufMSP432_P8_3_A22   ((22 << 10) | 0x0383) /* ch 22, port 8, pin 3 */
 
#define ADCBufMSP432_P8_4_A21   ((21 << 10) | 0x0384) /* ch 21, port 8, pin 4 */
 
#define ADCBufMSP432_P8_5_A20   ((20 << 10) | 0x0385) /* ch 20, port 8, pin 5 */
 
#define ADCBufMSP432_P8_6_A19   ((19 << 10) | 0x0386) /* ch 19, port 8, pin 6 */
 
#define ADCBufMSP432_P8_7_A18   ((18 << 10) | 0x0387) /* ch 18, port 8, pin 7 */
 
#define ADCBufMSP432_P9_0_A17   ((17 << 10) | 0x0390) /* ch 17, port 9, pin 0 */
 
#define ADCBufMSP432_P9_1_A16   ((16 << 10) | 0x0391) /* ch 16, port 9, pin 1 */
 
#define ADCBufMSP432_PIN_NONE   0
 
#define ADCBufMSP432_INTERNAL_SOURCE_PIN   0
 

Enumerations

enum  ADCBufMSP432_ReferenceSource { ADCBufMSP432_VREFPOS_AVCC_VREFNEG_VSS = ADC_VREFPOS_AVCC_VREFNEG_VSS, ADCBufMSP432_VREFPOS_INTBUF_VREFNEG_VSS = ADC_VREFPOS_INTBUF_VREFNEG_VSS, ADCBufMSP432_VREFPOS_EXTPOS_VREFNEG_EXTNEG = ADC_VREFPOS_EXTPOS_VREFNEG_EXTNEG, ADCBufMSP432_VREFPOS_EXTBUF_VREFNEG_EXTNEG = ADC_VREFPOS_EXTBUF_VREFNEG_EXTNEG }
 ADCMSP432 reference source These fields are used by ADCBufMSP432_HWAttrs to specify the reference voltage for each channel. More...
 
enum  ADCBufMSP432_SamplingDuration {
  ADCBufMSP432_SamplingDuration_PULSE_WIDTH_4 = ADC_PULSE_WIDTH_4, ADCBufMSP432_SamplingDuration_PULSE_WIDTH_8 = ADC_PULSE_WIDTH_8, ADCBufMSP432_SamplingDuration_PULSE_WIDTH_16 = ADC_PULSE_WIDTH_16, ADCBufMSP432_SamplingDuration_PULSE_WIDTH_32 = ADC_PULSE_WIDTH_32,
  ADCBufMSP432_SamplingDuration_PULSE_WIDTH_64 = ADC_PULSE_WIDTH_64, ADCBufMSP432_SamplingDuration_PULSE_WIDTH_96 = ADC_PULSE_WIDTH_96, ADCBufMSP432_SamplingDuration_PULSE_WIDTH_128 = ADC_PULSE_WIDTH_128, ADCBufMSP432_SamplingDuration_PULSE_WIDTH_192 = ADC_PULSE_WIDTH_192
}
 ADCMSP432 sampling duration These fields define the MSP432 ADC sampling duration (sample and hold time) in the pulse width unit. User can specify the different sampling duration in the ADCBufMSP432_ParamsExtension when opening the ADC. More...
 
enum  ADCBufMSP432_TimerReferenceSource {
  ADCBufMSP432_TIMERA0_CAPTURECOMPARE1 = 0, ADCBufMSP432_TIMERA0_CAPTURECOMPARE2 = 1, ADCBufMSP432_TIMERA1_CAPTURECOMPARE1 = 2, ADCBufMSP432_TIMERA1_CAPTURECOMPARE2 = 3,
  ADCBufMSP432_TIMERA2_CAPTURECOMPARE1 = 4, ADCBufMSP432_TIMERA2_CAPTURECOMPARE2 = 5, ADCBufMSP432_TIMERA3_CAPTURECOMPARE1 = 6
}
 ADCMSP432 timer trigger source These fields are used by ADCBufMSP432_HWAttrs to specify the Timer Capture for each channel. More...
 
enum  ADCBufMSP432_ClockSource {
  ADCBufMSP432_ADC_CLOCK = ADC_CLOCKSOURCE_ADCOSC, ADCBufMSP432_SYSOSC_CLOCK = ADC_CLOCKSOURCE_SYSOSC, ADCBufMSP432_ACLK_CLOCK = ADC_CLOCKSOURCE_ACLK, ADCBufMSP432_MCLK_CLOCK = ADC_CLOCKSOURCE_MCLK,
  ADCBufMSP432_SMCLK_CLOCK = ADC_CLOCKSOURCE_SMCLK, ADCBufMSP432_HSMCLK_CLOCK = ADC_CLOCKSOURCE_HSMCLK
}
 ADCMSP432 clock source These fields are used by ADCBufMSP432_HWAttrs to specify the clock source for the ADC module. More...
 
enum  ADCBufMSP432_TriggerSource { ADCBufMSP432_TIMER_TRIGGER = ADC_MANUAL_ITERATION, ADCBufMSP432_SOFTWARE_AUTOMATIC_TRIGGER = ADC_AUTOMATIC_ITERATION }
 ADCMSP432 trigger source These fields are used by ADCBufMSP432_HWAttrs to specify the trigger source for the ADC. More...
 
enum  ADCBufMSP432_DifferentialMode { ADCBufMSP432_SINGLE_ENDED = ADC_NONDIFFERENTIAL_INPUTS, ADCBufMSP432_DIFFERENTIAL = ADC_DIFFERENTIAL_INPUTS }
 ADCMSP432 Differential Mode These fields are used by ADCBufMSP432_HWAttrs to specify if ADC differential sampling mode is selected. More...
 
enum  ADCBufMSP432_InternalSourceMode { ADCBufMSP432_INTERNAL_SOURCE_MODE_OFF = 0, ADCBufMSP432_TEMPERATURE_MODE = ADC_TEMPSENSEMAP, ADCBufMSP432_BATTERY_MONITOR_MODE = ADC_BATTMAP }
 ADCMSP432 Internal Source Mode These fields are used by ADCBufMSP432_HWAttrs to specify if a internal source mode is selected, i.e. temperature sensor or battery monitor modes. More...
 

Variables

const ADCBuf_FxnTable ADCBufMSP432_fxnTable
 

Macro Definition Documentation

§ ADCBufMSP432_CMD_ENTER_ADC_ULTRA_LOW_POWER_MODE

#define ADCBufMSP432_CMD_ENTER_ADC_ULTRA_LOW_POWER_MODE   ADCBuf_CMD_RESERVED + 1

This control function enters ADC in low power mode.

This function changes the ADC clock source to ADC Clock, enables the reference to burst mode, sets the ADC resolution to 8 bits and enables Ultra Low Power Mode of ADC.

Note
ADCBuf_convertToMicrovolts should not be used with Ultra Low Power Mode because the voltage calculations are based off of a 14 bit resolution and will return incorrect values.
This function returns an error if a conversion is in progress

§ ADCBufMSP432_CMD_EXIT_ADC_ULTRA_LOW_POWER_MODE

#define ADCBufMSP432_CMD_EXIT_ADC_ULTRA_LOW_POWER_MODE   ADCBuf_CMD_RESERVED + 2

This control function exits ADC from low power mode.

This function changes the ADC clock source to default set by hwAttrib, disables the reference burst mode, sets the ADC resolution to 14 bits and enables Unrestricted Power Mode of ADC.

Note
This function returns an error if a conversion is in progress

§ ADCBufMSP432_P4_0_A13

#define ADCBufMSP432_P4_0_A13   ((13 << 10) | 0x0340) /* ch 13, port 4, pin 0 */

§ ADCBufMSP432_P4_1_A12

#define ADCBufMSP432_P4_1_A12   ((12 << 10) | 0x0341) /* ch 12, port 4, pin 1 */

§ ADCBufMSP432_P4_2_A11

#define ADCBufMSP432_P4_2_A11   ((11 << 10) | 0x0342) /* ch 11, port 4, pin 2 */

§ ADCBufMSP432_P4_3_A10

#define ADCBufMSP432_P4_3_A10   ((10 << 10) | 0x0343) /* ch 10, port 4, pin 3 */

§ ADCBufMSP432_P4_4_A9

#define ADCBufMSP432_P4_4_A9   ((9 << 10) | 0x0344) /* ch 9, port 4, pin 4 */

§ ADCBufMSP432_P4_5_A8

#define ADCBufMSP432_P4_5_A8   ((8 << 10) | 0x0345) /* ch 8, port 4, pin 5 */

§ ADCBufMSP432_P4_6_A7

#define ADCBufMSP432_P4_6_A7   ((7 << 10) | 0x0346) /* ch 7, port 4, pin 6 */

§ ADCBufMSP432_P4_7_A6

#define ADCBufMSP432_P4_7_A6   ((6 << 10) | 0x0347) /* ch 6, port 4, pin 7 */

§ ADCBufMSP432_P5_0_A5

#define ADCBufMSP432_P5_0_A5   ((5 << 10) | 0x0350) /* ch 5, port 5, pin 0 */

§ ADCBufMSP432_P5_1_A4

#define ADCBufMSP432_P5_1_A4   ((4 << 10) | 0x0351) /* ch 4, port 5, pin 1 */

§ ADCBufMSP432_P5_2_A3

#define ADCBufMSP432_P5_2_A3   ((3 << 10) | 0x0352) /* ch 3, port 5, pin 2 */

§ ADCBufMSP432_P5_3_A2

#define ADCBufMSP432_P5_3_A2   ((2 << 10) | 0x0353) /* ch 2, port 5, pin 3 */

§ ADCBufMSP432_P5_4_A1

#define ADCBufMSP432_P5_4_A1   ((1 << 10) | 0x0354) /* ch 1, port 5, pin 4 */

§ ADCBufMSP432_P5_5_A0

#define ADCBufMSP432_P5_5_A0   ((0 << 10) | 0x0355) /* ch 0, port 5, pin 5 */

§ ADCBufMSP432_P6_0_A15

#define ADCBufMSP432_P6_0_A15   ((15 << 10) | 0x0360) /* ch 15, port 6, pin 0 */

§ ADCBufMSP432_P6_1_A14

#define ADCBufMSP432_P6_1_A14   ((14 << 10) | 0x0361) /* ch 14, port 6, pin 1 */

§ ADCBufMSP432_P8_2_A23

#define ADCBufMSP432_P8_2_A23   ((23 << 10) | 0x0382) /* ch 23, port 8, pin 2 */

§ ADCBufMSP432_P8_3_A22

#define ADCBufMSP432_P8_3_A22   ((22 << 10) | 0x0383) /* ch 22, port 8, pin 3 */

§ ADCBufMSP432_P8_4_A21

#define ADCBufMSP432_P8_4_A21   ((21 << 10) | 0x0384) /* ch 21, port 8, pin 4 */

§ ADCBufMSP432_P8_5_A20

#define ADCBufMSP432_P8_5_A20   ((20 << 10) | 0x0385) /* ch 20, port 8, pin 5 */

§ ADCBufMSP432_P8_6_A19

#define ADCBufMSP432_P8_6_A19   ((19 << 10) | 0x0386) /* ch 19, port 8, pin 6 */

§ ADCBufMSP432_P8_7_A18

#define ADCBufMSP432_P8_7_A18   ((18 << 10) | 0x0387) /* ch 18, port 8, pin 7 */

§ ADCBufMSP432_P9_0_A17

#define ADCBufMSP432_P9_0_A17   ((17 << 10) | 0x0390) /* ch 17, port 9, pin 0 */

§ ADCBufMSP432_P9_1_A16

#define ADCBufMSP432_P9_1_A16   ((16 << 10) | 0x0391) /* ch 16, port 9, pin 1 */

§ ADCBufMSP432_PIN_NONE

#define ADCBufMSP432_PIN_NONE   0

§ ADCBufMSP432_INTERNAL_SOURCE_PIN

#define ADCBufMSP432_INTERNAL_SOURCE_PIN   0

Enumeration Type Documentation

§ ADCBufMSP432_ReferenceSource

ADCMSP432 reference source These fields are used by ADCBufMSP432_HWAttrs to specify the reference voltage for each channel.

Enumerator
ADCBufMSP432_VREFPOS_AVCC_VREFNEG_VSS 
ADCBufMSP432_VREFPOS_INTBUF_VREFNEG_VSS 
ADCBufMSP432_VREFPOS_EXTPOS_VREFNEG_EXTNEG 
ADCBufMSP432_VREFPOS_EXTBUF_VREFNEG_EXTNEG 

§ ADCBufMSP432_SamplingDuration

ADCMSP432 sampling duration These fields define the MSP432 ADC sampling duration (sample and hold time) in the pulse width unit. User can specify the different sampling duration in the ADCBufMSP432_ParamsExtension when opening the ADC.

Enumerator
ADCBufMSP432_SamplingDuration_PULSE_WIDTH_4 
ADCBufMSP432_SamplingDuration_PULSE_WIDTH_8 
ADCBufMSP432_SamplingDuration_PULSE_WIDTH_16 
ADCBufMSP432_SamplingDuration_PULSE_WIDTH_32 
ADCBufMSP432_SamplingDuration_PULSE_WIDTH_64 
ADCBufMSP432_SamplingDuration_PULSE_WIDTH_96 
ADCBufMSP432_SamplingDuration_PULSE_WIDTH_128 
ADCBufMSP432_SamplingDuration_PULSE_WIDTH_192 

§ ADCBufMSP432_TimerReferenceSource

ADCMSP432 timer trigger source These fields are used by ADCBufMSP432_HWAttrs to specify the Timer Capture for each channel.

Enumerator
ADCBufMSP432_TIMERA0_CAPTURECOMPARE1 
ADCBufMSP432_TIMERA0_CAPTURECOMPARE2 
ADCBufMSP432_TIMERA1_CAPTURECOMPARE1 
ADCBufMSP432_TIMERA1_CAPTURECOMPARE2 
ADCBufMSP432_TIMERA2_CAPTURECOMPARE1 
ADCBufMSP432_TIMERA2_CAPTURECOMPARE2 
ADCBufMSP432_TIMERA3_CAPTURECOMPARE1 

§ ADCBufMSP432_ClockSource

ADCMSP432 clock source These fields are used by ADCBufMSP432_HWAttrs to specify the clock source for the ADC module.

Enumerator
ADCBufMSP432_ADC_CLOCK 
ADCBufMSP432_SYSOSC_CLOCK 
ADCBufMSP432_ACLK_CLOCK 
ADCBufMSP432_MCLK_CLOCK 
ADCBufMSP432_SMCLK_CLOCK 
ADCBufMSP432_HSMCLK_CLOCK 

§ ADCBufMSP432_TriggerSource

ADCMSP432 trigger source These fields are used by ADCBufMSP432_HWAttrs to specify the trigger source for the ADC.

Enumerator
ADCBufMSP432_TIMER_TRIGGER 
ADCBufMSP432_SOFTWARE_AUTOMATIC_TRIGGER 

§ ADCBufMSP432_DifferentialMode

ADCMSP432 Differential Mode These fields are used by ADCBufMSP432_HWAttrs to specify if ADC differential sampling mode is selected.

Enumerator
ADCBufMSP432_SINGLE_ENDED 
ADCBufMSP432_DIFFERENTIAL 

§ ADCBufMSP432_InternalSourceMode

ADCMSP432 Internal Source Mode These fields are used by ADCBufMSP432_HWAttrs to specify if a internal source mode is selected, i.e. temperature sensor or battery monitor modes.

Enumerator
ADCBufMSP432_INTERNAL_SOURCE_MODE_OFF 
ADCBufMSP432_TEMPERATURE_MODE 
ADCBufMSP432_BATTERY_MONITOR_MODE 

Variable Documentation

§ ADCBufMSP432_fxnTable

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