The Electrostatic-Sandbox SDK Suite 0.0.0-primer
A complete WIP SDK suite written purely in C for distributed simulation systems based on IEEE-1516 and NASA DSES.
Loading...
Searching...
No Matches
adc.h File Reference
#include <avr/io.h>
#include <avr/interrupt.h>
#include <string.h>
#include <stdlib.h>
#include <electrostatic/electroio/electromio/avr/adc/control/clkprescaler.h>
#include <electrostatic/electroio/electromio/avr/adc/admux/channel.h>
#include <electrostatic/electroio/electromio/avr/adc/admux/vref.h>
Include dependency graph for adc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  adc_callbacks
 

Functions

static void adc_assign_callbacks (volatile adc_callbacks *in_callbacks)
 Assigns the callbacks for the ADC conversion.
 
void adc_start_protocol ()
 Starts the ADC protocol and enable the adc interrupt service by setting the [ADEN] and [ADIE].
 
void adc_stop_protocol ()
 Stops the ADC protocol by setting [ADEN] to 0x00 through [ADCSRA = 0x00] and formatting the output pins.
 
void adc_enable_isr ()
 Enables the adc conversion complete interrupt service routine.
 
void adc_start_conversion (const uint8_t PIN, const uint8_t V_REF, const uint8_t CONVERSION_SPEED)
 Starts the Analog to Digital conversion.
 
volatile uint16_t adc_read ()
 Combines the readings of [ADCL] and [ADCH] data registers in a 16-bit software register.
 

Variables

volatile adc_callbacksadc_internal_callbacks
 Interrupt-safe re-assignable callbacks.
 

Detailed Description

Author
pavl_g.

Operates and controls the ADC protocol through the ADC mulitplexers and status control registers.

Version
0.1
Date
2022-07-04

Definition in file adc.h.

Function Documentation

◆ adc_assign_callbacks()

static void adc_assign_callbacks ( volatile adc_callbacks * in_callbacks)
inlinestatic

Assigns the callbacks for the ADC conversion.

Parameters
in_callbacksan interrupt-safe adc callback object.
Examples
/home/runner/work/Electrostatic-Sandbox/Electrostatic-Sandbox/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/electroio/electromio/avr/adc/adc.h.

Definition at line 58 of file adc.h.

Here is the caller graph for this function:

◆ adc_enable_isr()

void adc_enable_isr ( )

Enables the adc conversion complete interrupt service routine.

Examples
/home/runner/work/Electrostatic-Sandbox/Electrostatic-Sandbox/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/electroio/electromio/avr/adc/adc.h.

Definition at line 14 of file adc_conversion_isr.c.

Here is the caller graph for this function:

◆ adc_read()

volatile uint16_t adc_read ( )

Combines the readings of [ADCL] and [ADCH] data registers in a 16-bit software register.

Note
Default value = 1023, max value = 1023, min value = 0.
Returns
uint16_t a new 16-bit register representing 10-bit decade data output from the ADC.
Examples
/home/runner/work/Electrostatic-Sandbox/Electrostatic-Sandbox/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/electroio/electromio/avr/adc/adc.h.

Definition at line 3 of file adc_read.c.

◆ adc_start_conversion()

void adc_start_conversion ( const uint8_t PIN,
const uint8_t V_REF,
const uint8_t CONVERSION_SPEED )

Starts the Analog to Digital conversion.

Note
When setting the bit [ADIE] on the [ADCSRA] register, an interrupt service is fired once the conversion is completed.
Parameters
PINthe ADC MUX pin to read from.
V_REFthe reference voltage to use for the ADC, the reference voltage represents the voltage to compare against.
CONVERSION_SPEEDthe speed of the adc conversion in relation to the crystal oscillator.
Examples
/home/runner/work/Electrostatic-Sandbox/Electrostatic-Sandbox/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/electroio/electromio/avr/adc/adc.h.

Definition at line 3 of file adc_start_conversion.c.

Here is the caller graph for this function:

◆ adc_start_protocol()

void adc_start_protocol ( )

Starts the ADC protocol and enable the adc interrupt service by setting the [ADEN] and [ADIE].

Examples
/home/runner/work/Electrostatic-Sandbox/Electrostatic-Sandbox/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/electroio/electromio/avr/adc/adc.h.

Definition at line 13 of file adc_start_protocol.c.

Here is the caller graph for this function:

◆ adc_stop_protocol()

void adc_stop_protocol ( )

Stops the ADC protocol by setting [ADEN] to 0x00 through [ADCSRA = 0x00] and formatting the output pins.

Examples
/home/runner/work/Electrostatic-Sandbox/Electrostatic-Sandbox/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/electroio/electromio/avr/adc/adc.h.

Definition at line 3 of file adc_stop_protocol.c.

Variable Documentation

◆ adc_internal_callbacks