3-phase PV router
Loading...
Searching...
No Matches
AdcChain Namespace Reference

Enumerations

enum class  Channel : uint8_t {
  V1 , I1 , V2 , I2 ,
  V3 , I3
}
 

Functions

constexpr uint8_t admuxOf (const PcbVersion board, const Channel ch)
 The ADMUX value that converts a channel: reference, left-adjusted result, analog input.
 
constexpr uint8_t admuxWrittenAfter (const PcbVersion board, const Channel converted)
 The ADMUX value the interrupt writes after the conversion of a channel.
 
constexpr Channel channelAfterNext (const Channel ch)
 The channel two steps after another one in the chain V1, I1, V2, I2, V3, I3.
 
constexpr Channel channelConverted (const uint8_t round)
 The channel round round converts, once the pipeline is full.
 
constexpr uint8_t pinOf (const Channel ch)
 The analog input of a channel (A0 = 0).
 
constexpr uint8_t refBits (const PcbVersion board)
 The reference bits of ADMUX on a board.
 

Variables

constexpr uint8_t BIT_ADLAR { 5 }
 
constexpr uint8_t BIT_REFS0 { 6 }
 
constexpr uint8_t BIT_REFS1 { 7 }
 
constexpr uint8_t NO_OF_CONVERSIONS { 6 }
 

Enumeration Type Documentation

◆ Channel

enum class AdcChain::Channel : uint8_t
strong

The six conversions, in the order of the chain: a V then an I, for each phase

Enumerator
V1 

voltage of phase 1

I1 

current of phase 1

V2 

voltage of phase 2

I2 

current of phase 2

V3 

voltage of phase 3

I3 

current of phase 3

Definition at line 34 of file adc_chain.h.

Function Documentation

◆ admuxOf()

uint8_t AdcChain::admuxOf ( const PcbVersion board,
const Channel ch )
constexpr

The ADMUX value that converts a channel: reference, left-adjusted result, analog input.

Parameters
boardThe board.
chThe channel.
Returns
The ADMUX value.

Definition at line 81 of file adc_chain.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ admuxWrittenAfter()

uint8_t AdcChain::admuxWrittenAfter ( const PcbVersion board,
const Channel converted )
constexpr

The ADMUX value the interrupt writes after the conversion of a channel.

The conversion of the next channel has already started: the value written applies to the conversion after next, which is the channel after next.

Parameters
boardThe board.
convertedThe channel just converted.
Returns
The ADMUX value to write.

Definition at line 107 of file adc_chain.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ channelAfterNext()

Channel AdcChain::channelAfterNext ( const Channel ch)
constexpr

The channel two steps after another one in the chain V1, I1, V2, I2, V3, I3.

Parameters
chThe channel.
Returns
The channel after next: V1 gives V2... V3 gives V1, I3 gives I1.

Definition at line 92 of file adc_chain.h.

Here is the caller graph for this function:

◆ channelConverted()

Channel AdcChain::channelConverted ( const uint8_t round)
constexpr

The channel round round converts, once the pipeline is full.

Parameters
roundThe round (0, 1, 2...), from the first conversion of V1.
Returns
V1, I1, V2, I2, V3, I3, V1...

Definition at line 118 of file adc_chain.h.

Here is the caller graph for this function:

◆ pinOf()

uint8_t AdcChain::pinOf ( const Channel ch)
constexpr

The analog input of a channel (A0 = 0).

Parameters
chThe channel.
Returns
V1 0, I1 1, V2 2, I2 3, V3 4, I3 5: the place in the chain.

Definition at line 57 of file adc_chain.h.

Here is the caller graph for this function:

◆ refBits()

uint8_t AdcChain::refBits ( const PcbVersion board)
constexpr

The reference bits of ADMUX on a board.

Parameters
boardThe board.
Returns
AVcc (REFS0) on the old board, the internal 1.1 V (REFS1 and REFS0) on NEW.

Definition at line 68 of file adc_chain.h.

Here is the caller graph for this function:

Variable Documentation

◆ BIT_ADLAR

uint8_t AdcChain::BIT_ADLAR { 5 }
inlineconstexpr

ADLAR: left-adjusted result

Definition at line 49 of file adc_chain.h.

◆ BIT_REFS0

uint8_t AdcChain::BIT_REFS0 { 6 }
inlineconstexpr

REFS0: alone, the AVcc reference

Definition at line 48 of file adc_chain.h.

◆ BIT_REFS1

uint8_t AdcChain::BIT_REFS1 { 7 }
inlineconstexpr

REFS1: with REFS0, the internal 1.1 V reference

Definition at line 47 of file adc_chain.h.

◆ NO_OF_CONVERSIONS

uint8_t AdcChain::NO_OF_CONVERSIONS { 6 }
inlineconstexpr

conversions in the chain: a V and an I per phase

Definition at line 44 of file adc_chain.h.