ADS1282 Example C Code  1.0.0
Macros | Functions
hal.h File Reference

Hardware abstraction layer (HAL) descriptor. More...

#include <stdbool.h>
#include <stdint.h>
#include "ads1282.h"
#include "ti/drivers/GPIO.h"
#include "ti/drivers/SPI.h"
#include "ti_drivers_config.h"
#include "ti/devices/msp432e4/driverlib/driverlib.h"
Include dependency graph for hal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define HIGH   ((bool) true)
 Alias used for setting GPIOs pins to the logic "high" state. More...
 
#define LOW   ((bool) false)
 Alias used for setting GPIOs pins to the logic "low" state. More...
 
#define SCLK_FREQ_HZ   ((uint32_t) 1000000)
 Sets SPI clock frequency in hal.c. More...
 
#define FCLK_FREQ_HZ   ((uint32_t) 4096000)
 

Functions

void initADCperhiperhals (void)
 
void delay_us (const uint32_t delay_time_us)
 
void delay_ms (const uint32_t delay_time_ms)
 
void setPWDN (const bool state)
 
void setRESET (const bool state)
 
void toggleRESET (void)
 
bool spiSendReceive (const uint8_t transmitBuffer[], uint8_t receiveBuffer[], const uint8_t byteLength)
 
bool waitForDRDYinterrupt (uint32_t timeout_ms)
 

Detailed Description

Hardware abstraction layer (HAL) descriptor.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Neither the name of Texas Instruments Incorporated nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Macro Definition Documentation

#define FCLK_FREQ_HZ   ((uint32_t) 4096000)

ADC system clock frequency in Hz. This value has no effect on the hardware, it is used here to scale timing delays.

#define HIGH   ((bool) true)

Alias used for setting GPIOs pins to the logic "high" state.

#define LOW   ((bool) false)

Alias used for setting GPIOs pins to the logic "low" state.

#define SCLK_FREQ_HZ   ((uint32_t) 1000000)

Sets SPI clock frequency in hal.c.

Function Documentation

void delay_ms ( const uint32_t  delay_time_ms)

Blocking delay function with approximate 'ms' resolution.

Parameters
delay_time_msis the number of milliseconds to delay.
Returns
None.
void delay_us ( const uint32_t  delay_time_us)

Blocking delay function with approximate 'us' resolution.

Parameters
delay_time_usis the number of microseconds to delay.
Returns
None.
void initADCperhiperhals ( void  )

Initializes MCU peripherals for interfacing with the ADC then calls the adcStartupRoutine() function.

Returns
None.

Here is the call graph for this function:

void setPWDN ( const bool  state)

Controls the state of the /PWDN GPIO pin.

Parameters
stateboolean indicating which state to set the /PWDN pin (0=low, 1=high).

The 'HIGH' and 'LOW' macros defined in hal.h can be use for the 'state' parameter.

Returns
None.

Here is the call graph for this function:

void setRESET ( const bool  state)

Controls the state of the /RESET GPIO pin.

Parameters
stateboolean indicating which state to set the /RESET pin (0=low, 1=high).

The 'HIGH' and 'LOW' macros defined in hal.h can be use for the 'state' parameter.

Returns
None.

Here is the call graph for this function:

bool spiSendReceive ( const uint8_t  transmitBuffer[],
uint8_t  receiveBuffer[],
const uint8_t  byteLength 
)

Sends SPI byte array on MOSI pin and captures MISO data to a byte array.

Parameters
[in]transmitBuffer[]byte array of SPI data to send on MOSI.
[out]receiveBuffer[]byte array of SPI data captured on MISO.
[in]byteLengthnumber of bytes to send & receive.

NOTE: Make sure 'dataTx[]' and 'dataRx[]' contain at least as many bytes of data, as indicated by 'byteLength'.

Returns
None.
void toggleRESET ( void  )

Toggles the /RESET pin to trigger a reset (LOW, delay 2 ms, then HIGH).

Returns
None.

Here is the call graph for this function:

bool waitForDRDYinterrupt ( const uint32_t  timeout_ms)

Waits for the /DRDY interrupt or until the specified timeout occurs.

Parameters
timeout_msNumber of milliseconds to wait before timeout event.
Returns
Returns 'true' if /DRDY interrupt occurred before the timeout.