distortos
v0.7.0
object-oriented C++ RTOS for microcontrollers
|
Chip-related code of distortos project. More...
Classes | |
class | ChipInputPin |
class | ChipOutputPin |
class | ChipSpiMasterLowLevel |
class | ChipUartLowLevel |
class | DmaChannel |
class | DmaChannelFunctor |
class | DmaChannelFunctorCommon |
class | DmaChannelHandle |
class | DmaChannelPeripheral |
DmaChannelPeripheral class is a raw DMA channel peripheral for DMAv2 in STM32. More... | |
class | DmaPeripheral |
DmaPeripheral class is a raw DMA peripheral for DMAv2 in STM32. More... | |
class | SpiMasterLowLevelDmaBased |
class | SpiMasterLowLevelInterruptBased |
class | SpiPeripheral |
SpiPeripheral class is a raw SPI peripheral for SPIv1 in STM32. More... | |
Enumerations | |
enum | Pin : uint32_t { Pin::pa0 = GPIOA_BASE | 0, Pin::pa1 = GPIOA_BASE | 1, Pin::pa2 = GPIOA_BASE | 2, Pin::pa3 = GPIOA_BASE | 3, Pin::pa4 = GPIOA_BASE | 4, Pin::pa5 = GPIOA_BASE | 5, Pin::pa6 = GPIOA_BASE | 6, Pin::pa7 = GPIOA_BASE | 7, Pin::pa8 = GPIOA_BASE | 8, Pin::pa9 = GPIOA_BASE | 9, Pin::pa10 = GPIOA_BASE | 10, Pin::pa11 = GPIOA_BASE | 11, Pin::pa12 = GPIOA_BASE | 12, Pin::pa13 = GPIOA_BASE | 13, Pin::pa14 = GPIOA_BASE | 14, Pin::pa15 = GPIOA_BASE | 15, Pin::pb0 = GPIOB_BASE | 0, Pin::pb1 = GPIOB_BASE | 1, Pin::pb2 = GPIOB_BASE | 2, Pin::pb3 = GPIOB_BASE | 3, Pin::pb4 = GPIOB_BASE | 4, Pin::pb5 = GPIOB_BASE | 5, Pin::pb6 = GPIOB_BASE | 6, Pin::pb7 = GPIOB_BASE | 7, Pin::pb8 = GPIOB_BASE | 8, Pin::pb9 = GPIOB_BASE | 9, Pin::pb10 = GPIOB_BASE | 10, Pin::pb11 = GPIOB_BASE | 11, Pin::pb12 = GPIOB_BASE | 12, Pin::pb13 = GPIOB_BASE | 13, Pin::pb14 = GPIOB_BASE | 14, Pin::pb15 = GPIOB_BASE | 15, Pin::pc0 = GPIOC_BASE | 0, Pin::pc1 = GPIOC_BASE | 1, Pin::pc2 = GPIOC_BASE | 2, Pin::pc3 = GPIOC_BASE | 3, Pin::pc4 = GPIOC_BASE | 4, Pin::pc5 = GPIOC_BASE | 5, Pin::pc6 = GPIOC_BASE | 6, Pin::pc7 = GPIOC_BASE | 7, Pin::pc8 = GPIOC_BASE | 8, Pin::pc9 = GPIOC_BASE | 9, Pin::pc10 = GPIOC_BASE | 10, Pin::pc11 = GPIOC_BASE | 11, Pin::pc12 = GPIOC_BASE | 12, Pin::pc13 = GPIOC_BASE | 13, Pin::pc14 = GPIOC_BASE | 14, Pin::pc15 = GPIOC_BASE | 15, Pin::pd0 = GPIOD_BASE | 0, Pin::pd1 = GPIOD_BASE | 1, Pin::pd2 = GPIOD_BASE | 2, Pin::pd3 = GPIOD_BASE | 3, Pin::pd4 = GPIOD_BASE | 4, Pin::pd5 = GPIOD_BASE | 5, Pin::pd6 = GPIOD_BASE | 6, Pin::pd7 = GPIOD_BASE | 7, Pin::pd8 = GPIOD_BASE | 8, Pin::pd9 = GPIOD_BASE | 9, Pin::pd10 = GPIOD_BASE | 10, Pin::pd11 = GPIOD_BASE | 11, Pin::pd12 = GPIOD_BASE | 12, Pin::pd13 = GPIOD_BASE | 13, Pin::pd14 = GPIOD_BASE | 14, Pin::pd15 = GPIOD_BASE | 15, Pin::pe0 = GPIOE_BASE | 0, Pin::pe1 = GPIOE_BASE | 1, Pin::pe2 = GPIOE_BASE | 2, Pin::pe3 = GPIOE_BASE | 3, Pin::pe4 = GPIOE_BASE | 4, Pin::pe5 = GPIOE_BASE | 5, Pin::pe6 = GPIOE_BASE | 6, Pin::pe7 = GPIOE_BASE | 7, Pin::pe8 = GPIOE_BASE | 8, Pin::pe9 = GPIOE_BASE | 9, Pin::pe10 = GPIOE_BASE | 10, Pin::pe11 = GPIOE_BASE | 11, Pin::pe12 = GPIOE_BASE | 12, Pin::pe13 = GPIOE_BASE | 13, Pin::pe14 = GPIOE_BASE | 14, Pin::pe15 = GPIOE_BASE | 15, Pin::pf0 = GPIOF_BASE | 0, Pin::pf1 = GPIOF_BASE | 1, Pin::pf2 = GPIOF_BASE | 2, Pin::pf3 = GPIOF_BASE | 3, Pin::pf4 = GPIOF_BASE | 4, Pin::pf5 = GPIOF_BASE | 5, Pin::pf6 = GPIOF_BASE | 6, Pin::pf7 = GPIOF_BASE | 7, Pin::pf8 = GPIOF_BASE | 8, Pin::pf9 = GPIOF_BASE | 9, Pin::pf10 = GPIOF_BASE | 10, Pin::pf11 = GPIOF_BASE | 11, Pin::pf12 = GPIOF_BASE | 12, Pin::pf13 = GPIOF_BASE | 13, Pin::pf14 = GPIOF_BASE | 14, Pin::pf15 = GPIOF_BASE | 15, Pin::pg0 = GPIOG_BASE | 0, Pin::pg1 = GPIOG_BASE | 1, Pin::pg2 = GPIOG_BASE | 2, Pin::pg3 = GPIOG_BASE | 3, Pin::pg4 = GPIOG_BASE | 4, Pin::pg5 = GPIOG_BASE | 5, Pin::pg6 = GPIOG_BASE | 6, Pin::pg7 = GPIOG_BASE | 7, Pin::pg8 = GPIOG_BASE | 8, Pin::pg9 = GPIOG_BASE | 9, Pin::pg10 = GPIOG_BASE | 10, Pin::pg11 = GPIOG_BASE | 11, Pin::pg12 = GPIOG_BASE | 12, Pin::pg13 = GPIOG_BASE | 13, Pin::pg14 = GPIOG_BASE | 14, Pin::pg15 = GPIOG_BASE | 15, Pin::ph0 = GPIOH_BASE | 0, Pin::ph1 = GPIOH_BASE | 1, Pin::ph2 = GPIOH_BASE | 2, Pin::ph3 = GPIOH_BASE | 3, Pin::ph4 = GPIOH_BASE | 4, Pin::ph5 = GPIOH_BASE | 5, Pin::ph6 = GPIOH_BASE | 6, Pin::ph7 = GPIOH_BASE | 7, Pin::ph8 = GPIOH_BASE | 8, Pin::ph9 = GPIOH_BASE | 9, Pin::ph10 = GPIOH_BASE | 10, Pin::ph11 = GPIOH_BASE | 11, Pin::ph12 = GPIOH_BASE | 12, Pin::ph13 = GPIOH_BASE | 13, Pin::ph14 = GPIOH_BASE | 14, Pin::ph15 = GPIOH_BASE | 15, Pin::pi0 = GPIOI_BASE | 0, Pin::pi1 = GPIOI_BASE | 1, Pin::pi2 = GPIOI_BASE | 2, Pin::pi3 = GPIOI_BASE | 3, Pin::pi4 = GPIOI_BASE | 4, Pin::pi5 = GPIOI_BASE | 5, Pin::pi6 = GPIOI_BASE | 6, Pin::pi7 = GPIOI_BASE | 7, Pin::pi8 = GPIOI_BASE | 8, Pin::pi9 = GPIOI_BASE | 9, Pin::pi10 = GPIOI_BASE | 10, Pin::pi11 = GPIOI_BASE | 11, Pin::pi12 = GPIOI_BASE | 12, Pin::pi13 = GPIOI_BASE | 13, Pin::pi14 = GPIOI_BASE | 14, Pin::pi15 = GPIOI_BASE | 15 } |
identifier of single pin - combined address of GPIO port with pin number More... | |
enum | PinAlternateFunction : uint8_t { PinAlternateFunction::af0, PinAlternateFunction::af1, PinAlternateFunction::af2, PinAlternateFunction::af3, PinAlternateFunction::af4, PinAlternateFunction::af5, PinAlternateFunction::af6, PinAlternateFunction::af7, PinAlternateFunction::af8, PinAlternateFunction::af9, PinAlternateFunction::af10, PinAlternateFunction::af11, PinAlternateFunction::af12, PinAlternateFunction::af13, PinAlternateFunction::af14, PinAlternateFunction::af15 } |
all possible alternate functions of pin More... | |
enum | PinMode : uint8_t { PinMode::input, PinMode::output, PinMode::alternateFunction, PinMode::analog } |
all possible modes of pin More... | |
enum | PinOutputSpeed : uint8_t { PinOutputSpeed::low, PinOutputSpeed::medium, PinOutputSpeed::high, PinOutputSpeed::veryHigh = 3 } |
all possible output speeds of pin More... | |
enum | PinPull : uint8_t { PinPull::none, PinPull::up, PinPull::down } |
all possible pull-up/pull-down configurations of pin More... | |
enum | DmaChannelFlags : uint32_t { DmaChannelFlags::transferCompleteInterruptDisable = 0 << 4, DmaChannelFlags::transferCompleteInterruptEnable = 1 << 4, DmaChannelFlags::dmaFlowController = 0 << 5, DmaChannelFlags::peripheralFlowController = 1 << 5, DmaChannelFlags::peripheralToMemory = 0 << 6, DmaChannelFlags::memoryToPeripheral = 1 << 6, DmaChannelFlags::peripheralFixed = 0 << 9, DmaChannelFlags::peripheralIncrement = 1 << 9, DmaChannelFlags::memoryFixed = 0 << 10, DmaChannelFlags::memoryIncrement = 1 << 10, DmaChannelFlags::peripheralDataSize1 = 0 << 11, DmaChannelFlags::peripheralDataSize2 = 1 << 11, DmaChannelFlags::peripheralDataSize4 = 2 << 11, DmaChannelFlags::memoryDataSize1 = 0 << 13, DmaChannelFlags::memoryDataSize2 = 1 << 13, DmaChannelFlags::memoryDataSize4 = 2 << 13, DmaChannelFlags::lowPriority = 0 << 16, DmaChannelFlags::mediumPriority = 1 << 16, DmaChannelFlags::highPriority = 2 << 16, DmaChannelFlags::veryHighPriority = 3 << 16, DmaChannelFlags::peripheralBurstSize1 = 0 << 21, DmaChannelFlags::peripheralBurstSize4 = 1 << 21, DmaChannelFlags::peripheralBurstSize8 = 2 << 21, DmaChannelFlags::peripheralBurstSize16 = 3 << 21, DmaChannelFlags::memoryBurstSize1 = 0 << 23, DmaChannelFlags::memoryBurstSize4 = 1 << 23, DmaChannelFlags::memoryBurstSize8 = 2 << 23, DmaChannelFlags::memoryBurstSize16 = 3 << 23, DmaChannelFlags::dataSize1 = peripheralDataSize1 | memoryDataSize1, DmaChannelFlags::dataSize2 = peripheralDataSize2 | memoryDataSize2, DmaChannelFlags::dataSize4 = peripheralDataSize4 | memoryDataSize4, DmaChannelFlags::burstSize1 = peripheralBurstSize1 | memoryBurstSize1, DmaChannelFlags::burstSize4 = peripheralBurstSize4 | memoryBurstSize4, DmaChannelFlags::burstSize8 = peripheralBurstSize8 | memoryBurstSize8, DmaChannelFlags::burstSize16 = peripheralBurstSize16 | memoryBurstSize16 } |
DMA transfer configuration flags. More... | |
enum | SystemClockSource : uint8_t { SystemClockSource::hsi, SystemClockSource::hse, SystemClockSource::pll } |
system clock source More... | |
Functions | |
void | configurePin (Pin pin, PinMode mode, bool openDrain, PinOutputSpeed outputSpeed, PinPull pull, PinAlternateFunction alternateFunction, bool initialState={}) |
Configures pin. More... | |
void | configureAlternateFunctionPin (const Pin pin, const PinAlternateFunction alternateFunction, const bool openDrain={}, const PinOutputSpeed outputSpeed={}, const PinPull pull={}) |
Configures pin for "alternate function" mode. More... | |
void | configureAnalogPin (const Pin pin) |
Configures pin for "analog" mode. More... | |
void | configureInputPin (const Pin pin, const PinPull pull={}) |
Configures pin for "input" mode. More... | |
void | configureOutputPin (const Pin pin, const bool openDrain={}, const PinOutputSpeed outputSpeed={}, const PinPull pull={}, const bool initialState={}) |
Configures pin for "output" mode. More... | |
constexpr std::pair< GPIO_TypeDef *, uint8_t > | decodePin (const Pin pin) |
Decodes pin identifier into address of associated GPIO port and its pin number. More... | |
void | configureSpi (const SpiPeripheral &spiPeripheral, devices::SpiMode mode, uint32_t clockFrequency, uint8_t wordLength, bool lsbFirst) |
Configures parameters of raw SPI peripheral. More... | |
constexpr uint32_t | getBusFrequency (const uintptr_t peripheralBase) |
Returns frequency of the bus to which given peripheral is connected. More... | |
int | configureFlashLatency (uint8_t latency) |
Configures flash latency. More... | |
void | configureInstructionPrefetch (bool enable) |
Configures instruction prefetch. More... | |
void | disableDataCache () |
Disables data cache. More... | |
void | disableInstructionCache () |
Disables instruction cache. More... | |
void | enableDataCache () |
Enables data cache. More... | |
void | enableInstructionCache () |
Enables instruction cache. More... | |
int | configureVoltageScaling (uint8_t voltageScale) |
Configures voltage scaling. More... | |
int | configureAhbClockDivider (uint16_t hpre) |
Configures divider of AHB clock (HPRE value). More... | |
int | configureApbClockDivider (bool ppre2, uint8_t ppre) |
Configures divider of APB1 or APB2 clock (PPRE1 or PPRE2 value). More... | |
void | configurePllClockSource (bool hse) |
Configures clock source of main and audio PLLs. More... | |
int | configurePllInputClockDivider (uint8_t pllm) |
Configures divider of PLL input clock (PLLM value) for main and audio PLLs. More... | |
void | disableHse () |
Disables HSE clock. More... | |
void | disablePll () |
Disables main PLL. More... | |
void | enableHse (bool bypass) |
Enables HSE clock. More... | |
int | enablePll (uint16_t plln, uint8_t pllp, uint8_t pllq) |
Enables main PLL. More... | |
void | switchSystemClock (SystemClockSource source) |
Switches system clock. More... | |
Variables | |
constexpr uint32_t | hsiFrequency {16000000} |
HSI clock frequency, Hz. More... | |
constexpr uint32_t | minVcoInFrequency {1000000} |
minimum allowed value for VCO input frequency, Hz More... | |
constexpr uint32_t | maxVcoInFrequency {2000000} |
maximum allowed value for VCO input frequency, Hz More... | |
constexpr uint32_t | minVcoOutFrequency {100000000} |
minimum allowed value for VCO output frequency, Hz More... | |
constexpr uint32_t | maxVcoOutFrequency {432000000} |
maximum allowed value for VCO output frequency, Hz More... | |
constexpr uint32_t | maxPllOutFrequencies [3][2] |
constexpr uint32_t | maxPllqOutFrequency {48000000} |
maximum allowed value for PLL "Q" output frequency, Hz More... | |
constexpr uint32_t | maxApb1Frequencies [2] {42000000, 42000000} |
constexpr uint32_t | maxApb2Frequencies [2] {84000000, 84000000} |
constexpr uint8_t | overDriveIndex {0} |
over-drive index for maxPllOutFrequencies array (maxPllOutFrequencies[voltageScaleIndex][overDriveIndex]) More... | |
constexpr uint8_t | voltageScaleIndex {DISTORTOS_CHIP_PWR_VOLTAGE_SCALE_MODE - 1} |
voltage scale index for maxPllOutFrequencies array (maxPllOutFrequencies[voltageScaleIndex][overDriveIndex]) More... | |
constexpr uint32_t | maxPllOutFrequency {maxPllOutFrequencies[voltageScaleIndex][overDriveIndex]} |
maximum allowed value for PLL output frequency, Hz More... | |
constexpr uint32_t | maxApb1Frequency {maxApb1Frequencies[overDriveIndex]} |
maximum allowed APB1 (low speed) frequency, Hz More... | |
constexpr uint32_t | maxApb2Frequency {maxApb2Frequencies[overDriveIndex]} |
maximum allowed APB2 (high speed) frequency, Hz More... | |
constexpr uint32_t | pllInFrequency {DISTORTOS_CHIP_RCC_HSE_FREQUENCY} |
PLL input frequency, Hz. More... | |
constexpr uint32_t | vcoInFrequency {pllInFrequency / DISTORTOS_CHIP_RCC_PLLM} |
VCO input frequency, Hz. More... | |
constexpr uint32_t | vcoOutFrequency {vcoInFrequency * DISTORTOS_CHIP_RCC_PLLN} |
VCO output frequency, Hz. More... | |
constexpr uint32_t | pllOutFrequency {vcoOutFrequency / DISTORTOS_CHIP_RCC_PLLP} |
PLL output frequency, Hz. More... | |
constexpr uint32_t | pllqOutFrequency {vcoOutFrequency / DISTORTOS_CHIP_RCC_PLLQ} |
PLL "Q" output frequency, Hz. More... | |
constexpr uint32_t | sysclkFrequency {pllOutFrequency} |
SYSCLK frequency, Hz. More... | |
constexpr uint32_t | ahbFrequency {sysclkFrequency / DISTORTOS_CHIP_RCC_HPRE} |
AHB frequency, Hz. More... | |
constexpr uint32_t | apb1Frequency {ahbFrequency / DISTORTOS_CHIP_RCC_PPRE1} |
APB1 frequency, Hz. More... | |
constexpr uint32_t | apb2Frequency {ahbFrequency / DISTORTOS_CHIP_RCC_PPRE2} |
APB2 frequency, Hz. More... | |
constexpr uint8_t | maxFlashLatency {7} |
maximum allowed value of flash latency More... | |
constexpr uint8_t | minVoltageScale {1} |
minimum allowed value of voltage scale mode More... | |
constexpr uint8_t | maxVoltageScale {2} |
maximum allowed value of voltage scale mode More... | |
constexpr uint8_t | defaultVoltageScale {1} |
default voltage scale mode after reset More... | |
constexpr uint8_t | minPllm {2} |
minimum allowed value for PLLM More... | |
constexpr uint8_t | maxPllm {63} |
maximum allowed value for PLLM More... | |
constexpr uint16_t | minPlln {50} |
minimum allowed value for PLLN More... | |
constexpr uint16_t | maxPlln {432} |
maximum allowed value for PLLN More... | |
constexpr uint8_t | minPllq {2} |
minimum allowed value for PLLQ More... | |
constexpr uint8_t | maxPllq {15} |
maximum allowed value for PLLQ More... | |
constexpr uint8_t | pllpDiv2 {2} |
first allowed value for PLLP - 2 More... | |
constexpr uint8_t | pllpDiv4 {4} |
second allowed value for PLLP - 4 More... | |
constexpr uint8_t | pllpDiv6 {6} |
third allowed value for PLLP - 6 More... | |
constexpr uint8_t | pllpDiv8 {8} |
fourth allowed value for PLLP - 8 More... | |
constexpr uint16_t | hpreDiv1 {1} |
first allowed value for AHB divider - 1 More... | |
constexpr uint16_t | hpreDiv2 {2} |
second allowed value for AHB divider - 2 More... | |
constexpr uint16_t | hpreDiv4 {4} |
third allowed value for AHB divider - 4 More... | |
constexpr uint16_t | hpreDiv8 {8} |
fourth allowed value for AHB divider - 8 More... | |
constexpr uint16_t | hpreDiv16 {16} |
fifth allowed value for AHB divider - 16 More... | |
constexpr uint16_t | hpreDiv64 {64} |
sixth allowed value for AHB divider - 64 More... | |
constexpr uint16_t | hpreDiv128 {128} |
seventh allowed value for AHB divider - 128 More... | |
constexpr uint16_t | hpreDiv256 {256} |
eighth allowed value for AHB divider - 256 More... | |
constexpr uint16_t | hpreDiv512 {512} |
ninth allowed value for AHB divider - 512 More... | |
constexpr uint8_t | ppreDiv1 {1} |
first allowed value for APB1 and APB2 dividers - 1 More... | |
constexpr uint8_t | ppreDiv2 {2} |
second allowed value for APB1 and APB2 dividers - 2 More... | |
constexpr uint8_t | ppreDiv4 {4} |
third allowed value for APB1 and APB2 dividers - 4 More... | |
constexpr uint8_t | ppreDiv8 {8} |
fourth allowed value for APB1 and APB2 dividers - 8 More... | |
constexpr uint8_t | ppreDiv16 {16} |
fifth allowed value for APB1 and APB2 dividers - 16 More... | |
Chip-related code of distortos project.
|
strong |
DMA transfer configuration flags.
|
strong |
identifier of single pin - combined address of GPIO port with pin number
|
strong |
all possible alternate functions of pin
|
strong |
|
strong |
|
strong |
|
strong |
int distortos::chip::configureAhbClockDivider | ( | uint16_t | hpre | ) |
Configures divider of AHB clock (HPRE value).
[in] | hpre | is the HPRE value, {1, 2, 4, 8, 16, 64, 128, 256, 512} or {hpreDiv1, hpreDiv2, hpreDiv4, hpreDiv8, hpreDiv16, hpreDiv64, hpreDiv128, hpreDiv256, hpreDiv512} |
|
inline |
Configures pin for "alternate function" mode.
[in] | pin | is the identifier of pin |
[in] | alternateFunction | is the desired alternate function of pin |
[in] | openDrain | is the desired output type of pin: push-pull (false) or open-drain (true), default - false |
[in] | outputSpeed | is the desired output speed of pin, default - PinOutputSpeed::low |
[in] | pull | is the desired pull-up/pull-down configuration of pin, default - PinPull::none |
|
inline |
Configures pin for "analog" mode.
[in] | pin | is the identifier of pin |
int distortos::chip::configureApbClockDivider | ( | bool | ppre2, |
uint8_t | ppre | ||
) |
Configures divider of APB1 or APB2 clock (PPRE1 or PPRE2 value).
[in] | ppre2 | selects whether PPRE1 (false) or PPRE2 (true) is configured |
[in] | ppre | is the PPRE value, {1, 2, 4, 8, 16} or {ppreDiv1, ppreDiv2, ppreDiv4, ppreDiv8, ppreDiv16} |
int distortos::chip::configureFlashLatency | ( | uint8_t | latency | ) |
Configures flash latency.
[in] | latency | is the new flash latency, [0; maxFlashLatency] |
Configures pin for "input" mode.
[in] | pin | is the identifier of pin |
[in] | pull | is the desired pull-up/pull-down configuration of pin, default - PinPull::none |
void distortos::chip::configureInstructionPrefetch | ( | bool | enable | ) |
Configures instruction prefetch.
[in] | enable | selects whether instruction prefetch will be disabled (false) or enabled (true) |
|
inline |
Configures pin for "output" mode.
[in] | pin | is the identifier of pin |
[in] | openDrain | is the desired output type of pin: push-pull (false) or open-drain (true), default - false |
[in] | outputSpeed | is the desired output speed of pin, default - PinOutputSpeed::low |
[in] | pull | is the desired pull-up/pull-down configuration of pin, default - PinPull::none |
[in] | initialState | is the initial state of pin, default - false |
void distortos::chip::configurePin | ( | Pin | pin, |
PinMode | mode, | ||
bool | openDrain, | ||
PinOutputSpeed | outputSpeed, | ||
PinPull | pull, | ||
PinAlternateFunction | alternateFunction, | ||
bool | initialState = {} |
||
) |
Configures pin.
[in] | pin | is the identifier of pin |
[in] | mode | is the desired mode of pin |
[in] | openDrain | is the desired output type of pin: push-pull (false) or open-drain (true) |
[in] | outputSpeed | is the desired output speed of pin |
[in] | pull | is the desired pull-up/pull-down configuration of pin |
[in] | alternateFunction | is the desired alternate function of pin |
[in] | initialState | is the initial state of pin, default - false |
void distortos::chip::configurePllClockSource | ( | bool | hse | ) |
Configures clock source of main and audio PLLs.
[in] | hse | selects whether HSI (false) or HSE (true) is used as clock source of main and audio PLLs |
int distortos::chip::configurePllInputClockDivider | ( | uint8_t | pllm | ) |
Configures divider of PLL input clock (PLLM value) for main and audio PLLs.
[in] | pllm | is the PLLM value for main and audio PLLs, [2; 63] or [minPllm; maxPllm] |
void distortos::chip::configureSpi | ( | const SpiPeripheral & | spiPeripheral, |
devices::SpiMode | mode, | ||
uint32_t | clockFrequency, | ||
uint8_t | wordLength, | ||
bool | lsbFirst | ||
) |
Configures parameters of raw SPI peripheral.
spiPeripheral.getPeripheralFrequency() / 256
. [in] | spiPeripheral | is a reference to raw SPI peripheral |
[in] | mode | is the desired SPI mode |
[in] | clockFrequency | is the desired clock frequency, Hz |
[in] | wordLength | selects word length, bits, {8, 16} |
[in] | lsbFirst | selects whether MSB (false) or LSB (true) is transmitted first |
int distortos::chip::configureVoltageScaling | ( | uint8_t | voltageScale | ) |
Configures voltage scaling.
[in] | voltageScale | is the new voltage scale mode, [minVoltageScale; maxVoltageScale] |
constexpr std::pair<GPIO_TypeDef*, uint8_t> distortos::chip::decodePin | ( | const Pin | pin | ) |
Decodes pin identifier into address of associated GPIO port and its pin number.
[in] | pin | is the identifier of pin |
void distortos::chip::disableDataCache | ( | ) |
Disables data cache.
void distortos::chip::disableHse | ( | ) |
Disables HSE clock.
void distortos::chip::disableInstructionCache | ( | ) |
Disables instruction cache.
void distortos::chip::disablePll | ( | ) |
Disables main PLL.
void distortos::chip::enableDataCache | ( | ) |
Enables data cache.
The cache is first disabled, then reset and finally enabled.
void distortos::chip::enableHse | ( | bool | bypass | ) |
Enables HSE clock.
Enables HSE clock using crystal/ceramic resonator (bypass disabled) or external user clock (bypass enabled). This function waits until the HSE oscillator is stable after enabling the clock.
[in] | bypass | selects whether crystal/ceramic resonator (false) or external user clock (true) is used |
void distortos::chip::enableInstructionCache | ( | ) |
Enables instruction cache.
The cache is first disabled, then reset and finally enabled.
int distortos::chip::enablePll | ( | uint16_t | plln, |
uint8_t | pllp, | ||
uint8_t | pllq | ||
) |
Enables main PLL.
Enables main PLL using selected parameters and waits until it is stable.
[in] | plln | is the PLLN value for main PLL, [minPlln; maxPlln] |
[in] | pllp | is the PLLP value for main PLL, {2, 4, 6, 8} or {pllpDiv2, pllpDiv4, pllpDiv6, pllpDiv8} |
[in] | pllq | is the PLLQ value for main PLL, [2; 15] or [minPllq; maxPllq] |
constexpr uint32_t distortos::chip::getBusFrequency | ( | const uintptr_t | peripheralBase | ) |
Returns frequency of the bus to which given peripheral is connected.
[in] | peripheralBase | is the base address of peripheral |
void distortos::chip::switchSystemClock | ( | SystemClockSource | source | ) |
Switches system clock.
[in] | source | is the new source of system clock |
constexpr uint32_t distortos::chip::ahbFrequency {sysclkFrequency / DISTORTOS_CHIP_RCC_HPRE} |
AHB frequency, Hz.
constexpr uint32_t distortos::chip::apb1Frequency {ahbFrequency / DISTORTOS_CHIP_RCC_PPRE1} |
APB1 frequency, Hz.
constexpr uint32_t distortos::chip::apb2Frequency {ahbFrequency / DISTORTOS_CHIP_RCC_PPRE2} |
APB2 frequency, Hz.
constexpr uint8_t distortos::chip::defaultVoltageScale {1} |
default voltage scale mode after reset
constexpr uint16_t distortos::chip::hpreDiv1 {1} |
first allowed value for AHB divider - 1
constexpr uint16_t distortos::chip::hpreDiv128 {128} |
seventh allowed value for AHB divider - 128
constexpr uint16_t distortos::chip::hpreDiv16 {16} |
fifth allowed value for AHB divider - 16
constexpr uint16_t distortos::chip::hpreDiv2 {2} |
second allowed value for AHB divider - 2
constexpr uint16_t distortos::chip::hpreDiv256 {256} |
eighth allowed value for AHB divider - 256
constexpr uint16_t distortos::chip::hpreDiv4 {4} |
third allowed value for AHB divider - 4
constexpr uint16_t distortos::chip::hpreDiv512 {512} |
ninth allowed value for AHB divider - 512
constexpr uint16_t distortos::chip::hpreDiv64 {64} |
sixth allowed value for AHB divider - 64
constexpr uint16_t distortos::chip::hpreDiv8 {8} |
fourth allowed value for AHB divider - 8
constexpr uint32_t distortos::chip::hsiFrequency {16000000} |
HSI clock frequency, Hz.
constexpr uint32_t distortos::chip::maxApb1Frequencies[2] {42000000, 42000000} |
maximum allowed APB1 (low speed) frequencies, Hz [0] - over-drive disabled [1] - over-drive enabled
constexpr uint32_t distortos::chip::maxApb1Frequency {maxApb1Frequencies[overDriveIndex]} |
maximum allowed APB1 (low speed) frequency, Hz
constexpr uint32_t distortos::chip::maxApb2Frequencies[2] {84000000, 84000000} |
maximum allowed APB2 (high speed) frequencies, Hz [0] - over-drive disabled [1] - over-drive enabled
constexpr uint32_t distortos::chip::maxApb2Frequency {maxApb2Frequencies[overDriveIndex]} |
maximum allowed APB2 (high speed) frequency, Hz
constexpr uint8_t distortos::chip::maxFlashLatency {7} |
maximum allowed value of flash latency
constexpr uint8_t distortos::chip::maxPllm {63} |
maximum allowed value for PLLM
constexpr uint16_t distortos::chip::maxPlln {432} |
maximum allowed value for PLLN
constexpr uint32_t distortos::chip::maxPllOutFrequencies[3][2] |
maximum allowed values for PLL output frequency, Hz [...][0] - over-drive disabled [...][1] - over-drive enabled [0][...] - voltage scale 1 [1][...] - voltage scale 2 [2][...] - voltage scale 3
constexpr uint32_t distortos::chip::maxPllOutFrequency {maxPllOutFrequencies[voltageScaleIndex][overDriveIndex]} |
maximum allowed value for PLL output frequency, Hz
constexpr uint8_t distortos::chip::maxPllq {15} |
maximum allowed value for PLLQ
constexpr uint32_t distortos::chip::maxPllqOutFrequency {48000000} |
maximum allowed value for PLL "Q" output frequency, Hz
constexpr uint32_t distortos::chip::maxVcoInFrequency {2000000} |
maximum allowed value for VCO input frequency, Hz
constexpr uint32_t distortos::chip::maxVcoOutFrequency {432000000} |
maximum allowed value for VCO output frequency, Hz
constexpr uint8_t distortos::chip::maxVoltageScale {2} |
maximum allowed value of voltage scale mode
constexpr uint8_t distortos::chip::minPllm {2} |
minimum allowed value for PLLM
constexpr uint16_t distortos::chip::minPlln {50} |
minimum allowed value for PLLN
constexpr uint8_t distortos::chip::minPllq {2} |
minimum allowed value for PLLQ
constexpr uint32_t distortos::chip::minVcoInFrequency {1000000} |
minimum allowed value for VCO input frequency, Hz
constexpr uint32_t distortos::chip::minVcoOutFrequency {100000000} |
minimum allowed value for VCO output frequency, Hz
constexpr uint8_t distortos::chip::minVoltageScale {1} |
minimum allowed value of voltage scale mode
constexpr uint8_t distortos::chip::overDriveIndex {0} |
over-drive index for maxPllOutFrequencies array (maxPllOutFrequencies[voltageScaleIndex][overDriveIndex])
constexpr uint32_t distortos::chip::pllInFrequency {DISTORTOS_CHIP_RCC_HSE_FREQUENCY} |
PLL input frequency, Hz.
constexpr uint32_t distortos::chip::pllOutFrequency {vcoOutFrequency / DISTORTOS_CHIP_RCC_PLLP} |
PLL output frequency, Hz.
constexpr uint8_t distortos::chip::pllpDiv2 {2} |
first allowed value for PLLP - 2
constexpr uint8_t distortos::chip::pllpDiv4 {4} |
second allowed value for PLLP - 4
constexpr uint8_t distortos::chip::pllpDiv6 {6} |
third allowed value for PLLP - 6
constexpr uint8_t distortos::chip::pllpDiv8 {8} |
fourth allowed value for PLLP - 8
constexpr uint32_t distortos::chip::pllqOutFrequency {vcoOutFrequency / DISTORTOS_CHIP_RCC_PLLQ} |
PLL "Q" output frequency, Hz.
constexpr uint8_t distortos::chip::ppreDiv1 {1} |
first allowed value for APB1 and APB2 dividers - 1
constexpr uint8_t distortos::chip::ppreDiv16 {16} |
fifth allowed value for APB1 and APB2 dividers - 16
constexpr uint8_t distortos::chip::ppreDiv2 {2} |
second allowed value for APB1 and APB2 dividers - 2
constexpr uint8_t distortos::chip::ppreDiv4 {4} |
third allowed value for APB1 and APB2 dividers - 4
constexpr uint8_t distortos::chip::ppreDiv8 {8} |
fourth allowed value for APB1 and APB2 dividers - 8
constexpr uint32_t distortos::chip::sysclkFrequency {pllOutFrequency} |
SYSCLK frequency, Hz.
constexpr uint32_t distortos::chip::vcoInFrequency {pllInFrequency / DISTORTOS_CHIP_RCC_PLLM} |
VCO input frequency, Hz.
constexpr uint32_t distortos::chip::vcoOutFrequency {vcoInFrequency * DISTORTOS_CHIP_RCC_PLLN} |
VCO output frequency, Hz.
constexpr uint8_t distortos::chip::voltageScaleIndex {DISTORTOS_CHIP_PWR_VOLTAGE_SCALE_MODE - 1} |
voltage scale index for maxPllOutFrequencies array (maxPllOutFrequencies[voltageScaleIndex][overDriveIndex])