Buoyancy Firmware  1.0
Buoyancy Vehicle Firmware Documentation
saadc program file

Contain SAADC module with related functions. More...

Macros

#define ANALOG_BATTERY   (2UL)
 ADC Channel 0 - Battery measurement. More...
 
#define ANALOG_PRESSURE   (3UL)
 ADC Channel 1 - PX3 Pressure measurement. More...
 
#define SAADC_CALIBRATION_INTERVAL   10
 Determines how often the SAADC should be calibrated relative to NRF_DRV_SAADC_EVT_DONE event. More...
 
#define SAADC_SAMPLES_IN_BUFFER   2
 Number of SAADC samples in RAM before returning a SAADC event. More...
 

Functions

void pwm_init (void)
 Initialize PWM module. More...
 
void updateLED (uint16_t REDduty, uint16_t GREENduty, uint16_t BLUEduty)
 
More...
 
void stopLED (void)
 
More...
 
void startLED (void)
 
More...
 
void testLED ()
 
More...
 
nrfx_saadc_event_handler_t saadc_handler (nrfx_saadc_evt_t const *p_event)
 SAADC event handler. More...
 
void saadc_init (void)
 Initialize SAADC. More...
 

Variables

int16_t REDseq_buf [] = {(1 << 15) | 0}
 Channel 0: Inverse polarity (bit 15), 500us duty cycle. More...
 
int16_t GREENseq_buf [] = {(1 << 15) | 0}
 Channel 1: Inverse polarity (bit 15), 500us duty cycle. More...
 
int16_t BLUEseq_buf [] = {(1 << 15) | 1}
 Channel 2: Inverse polarity (bit 15), 500us duty cycle. More...
 
bool SAADCdataReady
 Flag to signal SAADC is ready to be read. More...
 

Detailed Description

Contain SAADC module with related functions.

Macro Definition Documentation

◆ ANALOG_BATTERY

#define ANALOG_BATTERY   (2UL)

ADC Channel 0 - Battery measurement.

◆ ANALOG_PRESSURE

#define ANALOG_PRESSURE   (3UL)

ADC Channel 1 - PX3 Pressure measurement.

◆ SAADC_CALIBRATION_INTERVAL

#define SAADC_CALIBRATION_INTERVAL   10

Determines how often the SAADC should be calibrated relative to NRF_DRV_SAADC_EVT_DONE event.

E.g. value 10 will make the SAADC calibrate every 10th time the NRF_DRV_SAADC_EVT_DONE is triggered.

◆ SAADC_SAMPLES_IN_BUFFER

#define SAADC_SAMPLES_IN_BUFFER   2

Number of SAADC samples in RAM before returning a SAADC event.

For low power SAADC set this constant to 1. Otherwise the EasyDMA will be enabled for an extended time which consumes high current.

Function Documentation

◆ pwm_init()

void pwm_init ( void  )

Initialize PWM module.

◆ saadc_handler()

nrfx_saadc_event_handler_t saadc_handler ( nrfx_saadc_evt_t const *  p_event)

SAADC event handler.

Parameters
[in]p_eventsaadc event.

◆ saadc_init()

void saadc_init ( )

Initialize SAADC.

◆ startLED()

void startLED ( void  )

Start PWM module.

◆ stopLED()

void stopLED ( void  )

Stop PWM module.

◆ testLED()

void testLED ( void  )

PWM module test sequence.

◆ updateLED()

void updateLED ( uint16_t  REDduty,
uint16_t  GREENduty,
uint16_t  BLUEduty 
)

Set new RGB brightness and/or color.

Variable Documentation

◆ BLUEseq_buf

int16_t BLUEseq_buf[] = {(1 << 15) | 1}

Channel 2: Inverse polarity (bit 15), 500us duty cycle.

◆ GREENseq_buf

int16_t GREENseq_buf[] = {(1 << 15) | 0}

Channel 1: Inverse polarity (bit 15), 500us duty cycle.

◆ REDseq_buf

int16_t REDseq_buf[] = {(1 << 15) | 0}

Channel 0: Inverse polarity (bit 15), 500us duty cycle.

◆ SAADCdataReady

bool SAADCdataReady

Flag to signal SAADC is ready to be read.

Flag to signal SAADC is ready to be read.