diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-11-28 19:41:16 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-11-28 19:41:16 +0000 |
| commit | 2a2911221dc257e45049c8ceea93a981240f91b0 (patch) | |
| tree | 09058f76689d339fbcf89ec6b612cc3b5a37a3a4 | |
| parent | 543cc65e569d24d07c90e97752b4cfc995d33dc0 (diff) | |
| parent | 25b49a8a2ad151dbf827785c793f7d0bef8af489 (diff) | |
Merge #506
506: Clock cleaning r=Dirbaio a=lulf
Different STM32 RCC peripherals have different capabilities and register values. Define types for each RCC types inside each module to ensure full range of capabilities for each family can be used
Co-authored-by: Ulf Lilleengen <[email protected]>
| -rwxr-xr-x | ci.sh | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/g0/mod.rs | 25 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/g4/mod.rs | 25 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/l0/mod.rs | 82 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/l1/mod.rs | 53 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/mod.rs | 1 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/types.rs | 94 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/wb/mod.rs | 35 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/wl5x/mod.rs | 35 |
9 files changed, 250 insertions, 102 deletions
| @@ -5,7 +5,7 @@ set -euo pipefail | |||
| 5 | export CARGO_TARGET_DIR=$PWD/target_ci | 5 | export CARGO_TARGET_DIR=$PWD/target_ci |
| 6 | export RUSTFLAGS=-Dwarnings | 6 | export RUSTFLAGS=-Dwarnings |
| 7 | 7 | ||
| 8 | find -name '*.rs' -not -path '*target*' -not -path '*stm32-metapac-gen/out/*' | xargs rustfmt --check --skip-children --unstable-features --edition 2018 | 8 | find . -name '*.rs' -not -path '*target*' -not -path '*stm32-metapac-gen/out/*' | xargs rustfmt --check --skip-children --unstable-features --edition 2018 |
| 9 | 9 | ||
| 10 | # Generate stm32-metapac | 10 | # Generate stm32-metapac |
| 11 | # for some reason Cargo stomps the cache if we don't specify --target. | 11 | # for some reason Cargo stomps the cache if we don't specify --target. |
diff --git a/embassy-stm32/src/rcc/g0/mod.rs b/embassy-stm32/src/rcc/g0/mod.rs index c0b5b14e3..103d9a840 100644 --- a/embassy-stm32/src/rcc/g0/mod.rs +++ b/embassy-stm32/src/rcc/g0/mod.rs | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | pub use super::types::*; | ||
| 2 | use crate::pac; | 1 | use crate::pac; |
| 3 | use crate::peripherals::{self, RCC}; | 2 | use crate::peripherals::{self, RCC}; |
| 4 | use crate::rcc::{get_freqs, set_freqs, Clocks}; | 3 | use crate::rcc::{get_freqs, set_freqs, Clocks}; |
| @@ -49,6 +48,30 @@ impl Into<u8> for HSI16Prescaler { | |||
| 49 | } | 48 | } |
| 50 | } | 49 | } |
| 51 | 50 | ||
| 51 | /// AHB prescaler | ||
| 52 | #[derive(Clone, Copy, PartialEq)] | ||
| 53 | pub enum AHBPrescaler { | ||
| 54 | NotDivided, | ||
| 55 | Div2, | ||
| 56 | Div4, | ||
| 57 | Div8, | ||
| 58 | Div16, | ||
| 59 | Div64, | ||
| 60 | Div128, | ||
| 61 | Div256, | ||
| 62 | Div512, | ||
| 63 | } | ||
| 64 | |||
| 65 | /// APB prescaler | ||
| 66 | #[derive(Clone, Copy)] | ||
| 67 | pub enum APBPrescaler { | ||
| 68 | NotDivided, | ||
| 69 | Div2, | ||
| 70 | Div4, | ||
| 71 | Div8, | ||
| 72 | Div16, | ||
| 73 | } | ||
| 74 | |||
| 52 | impl Into<u8> for APBPrescaler { | 75 | impl Into<u8> for APBPrescaler { |
| 53 | fn into(self) -> u8 { | 76 | fn into(self) -> u8 { |
| 54 | match self { | 77 | match self { |
diff --git a/embassy-stm32/src/rcc/g4/mod.rs b/embassy-stm32/src/rcc/g4/mod.rs index b0338e725..8dd37af8e 100644 --- a/embassy-stm32/src/rcc/g4/mod.rs +++ b/embassy-stm32/src/rcc/g4/mod.rs | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | pub use super::types::*; | ||
| 2 | use crate::pac; | 1 | use crate::pac; |
| 3 | use crate::peripherals::{self, RCC}; | 2 | use crate::peripherals::{self, RCC}; |
| 4 | use crate::rcc::{get_freqs, set_freqs, Clocks}; | 3 | use crate::rcc::{get_freqs, set_freqs, Clocks}; |
| @@ -21,6 +20,30 @@ pub enum ClockSrc { | |||
| 21 | HSI16, | 20 | HSI16, |
| 22 | } | 21 | } |
| 23 | 22 | ||
| 23 | /// AHB prescaler | ||
| 24 | #[derive(Clone, Copy, PartialEq)] | ||
| 25 | pub enum AHBPrescaler { | ||
| 26 | NotDivided, | ||
| 27 | Div2, | ||
| 28 | Div4, | ||
| 29 | Div8, | ||
| 30 | Div16, | ||
| 31 | Div64, | ||
| 32 | Div128, | ||
| 33 | Div256, | ||
| 34 | Div512, | ||
| 35 | } | ||
| 36 | |||
| 37 | /// APB prescaler | ||
| 38 | #[derive(Clone, Copy)] | ||
| 39 | pub enum APBPrescaler { | ||
| 40 | NotDivided, | ||
| 41 | Div2, | ||
| 42 | Div4, | ||
| 43 | Div8, | ||
| 44 | Div16, | ||
| 45 | } | ||
| 46 | |||
| 24 | impl Into<u8> for APBPrescaler { | 47 | impl Into<u8> for APBPrescaler { |
| 25 | fn into(self) -> u8 { | 48 | fn into(self) -> u8 { |
| 26 | match self { | 49 | match self { |
diff --git a/embassy-stm32/src/rcc/l0/mod.rs b/embassy-stm32/src/rcc/l0/mod.rs index e65faaa2c..8af4eca08 100644 --- a/embassy-stm32/src/rcc/l0/mod.rs +++ b/embassy-stm32/src/rcc/l0/mod.rs | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | pub use super::types::*; | ||
| 2 | use crate::pac; | 1 | use crate::pac; |
| 3 | use crate::peripherals::{self, CRS, RCC, SYSCFG}; | 2 | use crate::peripherals::{self, CRS, RCC, SYSCFG}; |
| 4 | use crate::rcc::{get_freqs, set_freqs, Clocks}; | 3 | use crate::rcc::{get_freqs, set_freqs, Clocks}; |
| @@ -24,6 +23,87 @@ pub enum ClockSrc { | |||
| 24 | HSI16, | 23 | HSI16, |
| 25 | } | 24 | } |
| 26 | 25 | ||
| 26 | /// MSI Clock Range | ||
| 27 | /// | ||
| 28 | /// These ranges control the frequency of the MSI. Internally, these ranges map | ||
| 29 | /// to the `MSIRANGE` bits in the `RCC_ICSCR` register. | ||
| 30 | #[derive(Clone, Copy)] | ||
| 31 | pub enum MSIRange { | ||
| 32 | /// Around 65.536 kHz | ||
| 33 | Range0, | ||
| 34 | /// Around 131.072 kHz | ||
| 35 | Range1, | ||
| 36 | /// Around 262.144 kHz | ||
| 37 | Range2, | ||
| 38 | /// Around 524.288 kHz | ||
| 39 | Range3, | ||
| 40 | /// Around 1.048 MHz | ||
| 41 | Range4, | ||
| 42 | /// Around 2.097 MHz (reset value) | ||
| 43 | Range5, | ||
| 44 | /// Around 4.194 MHz | ||
| 45 | Range6, | ||
| 46 | } | ||
| 47 | |||
| 48 | impl Default for MSIRange { | ||
| 49 | fn default() -> MSIRange { | ||
| 50 | MSIRange::Range5 | ||
| 51 | } | ||
| 52 | } | ||
| 53 | |||
| 54 | /// PLL divider | ||
| 55 | #[derive(Clone, Copy)] | ||
| 56 | pub enum PLLDiv { | ||
| 57 | Div2, | ||
| 58 | Div3, | ||
| 59 | Div4, | ||
| 60 | } | ||
| 61 | |||
| 62 | /// PLL multiplier | ||
| 63 | #[derive(Clone, Copy)] | ||
| 64 | pub enum PLLMul { | ||
| 65 | Mul3, | ||
| 66 | Mul4, | ||
| 67 | Mul6, | ||
| 68 | Mul8, | ||
| 69 | Mul12, | ||
| 70 | Mul16, | ||
| 71 | Mul24, | ||
| 72 | Mul32, | ||
| 73 | Mul48, | ||
| 74 | } | ||
| 75 | |||
| 76 | /// AHB prescaler | ||
| 77 | #[derive(Clone, Copy, PartialEq)] | ||
| 78 | pub enum AHBPrescaler { | ||
| 79 | NotDivided, | ||
| 80 | Div2, | ||
| 81 | Div4, | ||
| 82 | Div8, | ||
| 83 | Div16, | ||
| 84 | Div64, | ||
| 85 | Div128, | ||
| 86 | Div256, | ||
| 87 | Div512, | ||
| 88 | } | ||
| 89 | |||
| 90 | /// APB prescaler | ||
| 91 | #[derive(Clone, Copy)] | ||
| 92 | pub enum APBPrescaler { | ||
| 93 | NotDivided, | ||
| 94 | Div2, | ||
| 95 | Div4, | ||
| 96 | Div8, | ||
| 97 | Div16, | ||
| 98 | } | ||
| 99 | |||
| 100 | /// PLL clock input source | ||
| 101 | #[derive(Clone, Copy)] | ||
| 102 | pub enum PLLSource { | ||
| 103 | HSI16, | ||
| 104 | HSE(Hertz), | ||
| 105 | } | ||
| 106 | |||
| 27 | impl Into<Pllmul> for PLLMul { | 107 | impl Into<Pllmul> for PLLMul { |
| 28 | fn into(self) -> Pllmul { | 108 | fn into(self) -> Pllmul { |
| 29 | match self { | 109 | match self { |
diff --git a/embassy-stm32/src/rcc/l1/mod.rs b/embassy-stm32/src/rcc/l1/mod.rs index f6edd4e4f..d0b52d2f4 100644 --- a/embassy-stm32/src/rcc/l1/mod.rs +++ b/embassy-stm32/src/rcc/l1/mod.rs | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | pub use super::types::*; | ||
| 2 | use crate::pac; | 1 | use crate::pac; |
| 3 | use crate::peripherals::{self, RCC}; | 2 | use crate::peripherals::{self, RCC}; |
| 4 | use crate::rcc::{get_freqs, set_freqs, Clocks}; | 3 | use crate::rcc::{get_freqs, set_freqs, Clocks}; |
| @@ -21,6 +20,58 @@ pub enum ClockSrc { | |||
| 21 | HSI, | 20 | HSI, |
| 22 | } | 21 | } |
| 23 | 22 | ||
| 23 | /// MSI Clock Range | ||
| 24 | /// | ||
| 25 | /// These ranges control the frequency of the MSI. Internally, these ranges map | ||
| 26 | /// to the `MSIRANGE` bits in the `RCC_ICSCR` register. | ||
| 27 | #[derive(Clone, Copy)] | ||
| 28 | pub enum MSIRange { | ||
| 29 | /// Around 65.536 kHz | ||
| 30 | Range0, | ||
| 31 | /// Around 131.072 kHz | ||
| 32 | Range1, | ||
| 33 | /// Around 262.144 kHz | ||
| 34 | Range2, | ||
| 35 | /// Around 524.288 kHz | ||
| 36 | Range3, | ||
| 37 | /// Around 1.048 MHz | ||
| 38 | Range4, | ||
| 39 | /// Around 2.097 MHz (reset value) | ||
| 40 | Range5, | ||
| 41 | /// Around 4.194 MHz | ||
| 42 | Range6, | ||
| 43 | } | ||
| 44 | |||
| 45 | impl Default for MSIRange { | ||
| 46 | fn default() -> MSIRange { | ||
| 47 | MSIRange::Range5 | ||
| 48 | } | ||
| 49 | } | ||
| 50 | |||
| 51 | /// AHB prescaler | ||
| 52 | #[derive(Clone, Copy, PartialEq)] | ||
| 53 | pub enum AHBPrescaler { | ||
| 54 | NotDivided, | ||
| 55 | Div2, | ||
| 56 | Div4, | ||
| 57 | Div8, | ||
| 58 | Div16, | ||
| 59 | Div64, | ||
| 60 | Div128, | ||
| 61 | Div256, | ||
| 62 | Div512, | ||
| 63 | } | ||
| 64 | |||
| 65 | /// APB prescaler | ||
| 66 | #[derive(Clone, Copy)] | ||
| 67 | pub enum APBPrescaler { | ||
| 68 | NotDivided, | ||
| 69 | Div2, | ||
| 70 | Div4, | ||
| 71 | Div8, | ||
| 72 | Div16, | ||
| 73 | } | ||
| 74 | |||
| 24 | type Ppre = u8; | 75 | type Ppre = u8; |
| 25 | impl Into<Ppre> for APBPrescaler { | 76 | impl Into<Ppre> for APBPrescaler { |
| 26 | fn into(self) -> Ppre { | 77 | fn into(self) -> Ppre { |
diff --git a/embassy-stm32/src/rcc/mod.rs b/embassy-stm32/src/rcc/mod.rs index cdcbd2afc..b926eb8ce 100644 --- a/embassy-stm32/src/rcc/mod.rs +++ b/embassy-stm32/src/rcc/mod.rs | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | use crate::peripherals; | 3 | use crate::peripherals; |
| 4 | use crate::time::Hertz; | 4 | use crate::time::Hertz; |
| 5 | use core::mem::MaybeUninit; | 5 | use core::mem::MaybeUninit; |
| 6 | mod types; | ||
| 7 | 6 | ||
| 8 | #[derive(Clone, Copy)] | 7 | #[derive(Clone, Copy)] |
| 9 | pub struct Clocks { | 8 | pub struct Clocks { |
diff --git a/embassy-stm32/src/rcc/types.rs b/embassy-stm32/src/rcc/types.rs deleted file mode 100644 index 1fcaa27e9..000000000 --- a/embassy-stm32/src/rcc/types.rs +++ /dev/null | |||
| @@ -1,94 +0,0 @@ | |||
| 1 | #![allow(dead_code)] | ||
| 2 | /// Most of clock setup is copied from stm32l0xx-hal, and adopted to the generated PAC, | ||
| 3 | /// and with the addition of the init function to configure a system clock. | ||
| 4 | use crate::time::Hertz; | ||
| 5 | |||
| 6 | /// System clock mux source | ||
| 7 | #[derive(Clone, Copy)] | ||
| 8 | pub enum ClockSrc { | ||
| 9 | MSI(MSIRange), | ||
| 10 | PLL(PLLSource, PLLMul, PLLDiv), | ||
| 11 | HSE(Hertz), | ||
| 12 | HSI16, | ||
| 13 | } | ||
| 14 | |||
| 15 | /// MSI Clock Range | ||
| 16 | /// | ||
| 17 | /// These ranges control the frequency of the MSI. Internally, these ranges map | ||
| 18 | /// to the `MSIRANGE` bits in the `RCC_ICSCR` register. | ||
| 19 | #[derive(Clone, Copy)] | ||
| 20 | pub enum MSIRange { | ||
| 21 | /// Around 65.536 kHz | ||
| 22 | Range0, | ||
| 23 | /// Around 131.072 kHz | ||
| 24 | Range1, | ||
| 25 | /// Around 262.144 kHz | ||
| 26 | Range2, | ||
| 27 | /// Around 524.288 kHz | ||
| 28 | Range3, | ||
| 29 | /// Around 1.048 MHz | ||
| 30 | Range4, | ||
| 31 | /// Around 2.097 MHz (reset value) | ||
| 32 | Range5, | ||
| 33 | /// Around 4.194 MHz | ||
| 34 | Range6, | ||
| 35 | } | ||
| 36 | |||
| 37 | impl Default for MSIRange { | ||
| 38 | fn default() -> MSIRange { | ||
| 39 | MSIRange::Range5 | ||
| 40 | } | ||
| 41 | } | ||
| 42 | |||
| 43 | /// PLL divider | ||
| 44 | #[derive(Clone, Copy)] | ||
| 45 | pub enum PLLDiv { | ||
| 46 | Div2, | ||
| 47 | Div3, | ||
| 48 | Div4, | ||
| 49 | } | ||
| 50 | |||
| 51 | /// PLL multiplier | ||
| 52 | #[derive(Clone, Copy)] | ||
| 53 | pub enum PLLMul { | ||
| 54 | Mul3, | ||
| 55 | Mul4, | ||
| 56 | Mul6, | ||
| 57 | Mul8, | ||
| 58 | Mul12, | ||
| 59 | Mul16, | ||
| 60 | Mul24, | ||
| 61 | Mul32, | ||
| 62 | Mul48, | ||
| 63 | } | ||
| 64 | |||
| 65 | /// AHB prescaler | ||
| 66 | #[derive(Clone, Copy, PartialEq)] | ||
| 67 | pub enum AHBPrescaler { | ||
| 68 | NotDivided, | ||
| 69 | Div2, | ||
| 70 | Div4, | ||
| 71 | Div8, | ||
| 72 | Div16, | ||
| 73 | Div64, | ||
| 74 | Div128, | ||
| 75 | Div256, | ||
| 76 | Div512, | ||
| 77 | } | ||
| 78 | |||
| 79 | /// APB prescaler | ||
| 80 | #[derive(Clone, Copy)] | ||
| 81 | pub enum APBPrescaler { | ||
| 82 | NotDivided, | ||
| 83 | Div2, | ||
| 84 | Div4, | ||
| 85 | Div8, | ||
| 86 | Div16, | ||
| 87 | } | ||
| 88 | |||
| 89 | /// PLL clock input source | ||
| 90 | #[derive(Clone, Copy)] | ||
| 91 | pub enum PLLSource { | ||
| 92 | HSI16, | ||
| 93 | HSE(Hertz), | ||
| 94 | } | ||
diff --git a/embassy-stm32/src/rcc/wb/mod.rs b/embassy-stm32/src/rcc/wb/mod.rs index 4247d8ffb..435357418 100644 --- a/embassy-stm32/src/rcc/wb/mod.rs +++ b/embassy-stm32/src/rcc/wb/mod.rs | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | pub use super::types::*; | ||
| 2 | use crate::pac; | 1 | use crate::pac; |
| 3 | use crate::peripherals::{self, RCC}; | 2 | use crate::peripherals::{self, RCC}; |
| 4 | use crate::rcc::{get_freqs, set_freqs, Clocks}; | 3 | use crate::rcc::{get_freqs, set_freqs, Clocks}; |
| @@ -23,6 +22,35 @@ pub enum ClockSrc { | |||
| 23 | HSI16, | 22 | HSI16, |
| 24 | } | 23 | } |
| 25 | 24 | ||
| 25 | /// AHB prescaler | ||
| 26 | #[derive(Clone, Copy, PartialEq)] | ||
| 27 | pub enum AHBPrescaler { | ||
| 28 | NotDivided, | ||
| 29 | Div2, | ||
| 30 | Div3, | ||
| 31 | Div4, | ||
| 32 | Div5, | ||
| 33 | Div6, | ||
| 34 | Div8, | ||
| 35 | Div10, | ||
| 36 | Div16, | ||
| 37 | Div32, | ||
| 38 | Div64, | ||
| 39 | Div128, | ||
| 40 | Div256, | ||
| 41 | Div512, | ||
| 42 | } | ||
| 43 | |||
| 44 | /// APB prescaler | ||
| 45 | #[derive(Clone, Copy)] | ||
| 46 | pub enum APBPrescaler { | ||
| 47 | NotDivided, | ||
| 48 | Div2, | ||
| 49 | Div4, | ||
| 50 | Div8, | ||
| 51 | Div16, | ||
| 52 | } | ||
| 53 | |||
| 26 | impl Into<u8> for APBPrescaler { | 54 | impl Into<u8> for APBPrescaler { |
| 27 | fn into(self) -> u8 { | 55 | fn into(self) -> u8 { |
| 28 | match self { | 56 | match self { |
| @@ -40,9 +68,14 @@ impl Into<u8> for AHBPrescaler { | |||
| 40 | match self { | 68 | match self { |
| 41 | AHBPrescaler::NotDivided => 1, | 69 | AHBPrescaler::NotDivided => 1, |
| 42 | AHBPrescaler::Div2 => 0x08, | 70 | AHBPrescaler::Div2 => 0x08, |
| 71 | AHBPrescaler::Div3 => 0x01, | ||
| 43 | AHBPrescaler::Div4 => 0x09, | 72 | AHBPrescaler::Div4 => 0x09, |
| 73 | AHBPrescaler::Div5 => 0x02, | ||
| 74 | AHBPrescaler::Div6 => 0x05, | ||
| 44 | AHBPrescaler::Div8 => 0x0a, | 75 | AHBPrescaler::Div8 => 0x0a, |
| 76 | AHBPrescaler::Div10 => 0x06, | ||
| 45 | AHBPrescaler::Div16 => 0x0b, | 77 | AHBPrescaler::Div16 => 0x0b, |
| 78 | AHBPrescaler::Div32 => 0x07, | ||
| 46 | AHBPrescaler::Div64 => 0x0c, | 79 | AHBPrescaler::Div64 => 0x0c, |
| 47 | AHBPrescaler::Div128 => 0x0d, | 80 | AHBPrescaler::Div128 => 0x0d, |
| 48 | AHBPrescaler::Div256 => 0x0e, | 81 | AHBPrescaler::Div256 => 0x0e, |
diff --git a/embassy-stm32/src/rcc/wl5x/mod.rs b/embassy-stm32/src/rcc/wl5x/mod.rs index 86fb3f586..aa49c99c9 100644 --- a/embassy-stm32/src/rcc/wl5x/mod.rs +++ b/embassy-stm32/src/rcc/wl5x/mod.rs | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | pub use super::types::*; | ||
| 2 | use crate::pac; | 1 | use crate::pac; |
| 3 | use crate::peripherals::{self, RCC}; | 2 | use crate::peripherals::{self, RCC}; |
| 4 | use crate::rcc::{get_freqs, set_freqs, Clocks}; | 3 | use crate::rcc::{get_freqs, set_freqs, Clocks}; |
| @@ -24,6 +23,35 @@ pub enum ClockSrc { | |||
| 24 | HSI16, | 23 | HSI16, |
| 25 | } | 24 | } |
| 26 | 25 | ||
| 26 | /// AHB prescaler | ||
| 27 | #[derive(Clone, Copy, PartialEq)] | ||
| 28 | pub enum AHBPrescaler { | ||
| 29 | NotDivided, | ||
| 30 | Div2, | ||
| 31 | Div3, | ||
| 32 | Div4, | ||
| 33 | Div5, | ||
| 34 | Div6, | ||
| 35 | Div8, | ||
| 36 | Div10, | ||
| 37 | Div16, | ||
| 38 | Div32, | ||
| 39 | Div64, | ||
| 40 | Div128, | ||
| 41 | Div256, | ||
| 42 | Div512, | ||
| 43 | } | ||
| 44 | |||
| 45 | /// APB prescaler | ||
| 46 | #[derive(Clone, Copy)] | ||
| 47 | pub enum APBPrescaler { | ||
| 48 | NotDivided, | ||
| 49 | Div2, | ||
| 50 | Div4, | ||
| 51 | Div8, | ||
| 52 | Div16, | ||
| 53 | } | ||
| 54 | |||
| 27 | impl Into<u8> for APBPrescaler { | 55 | impl Into<u8> for APBPrescaler { |
| 28 | fn into(self) -> u8 { | 56 | fn into(self) -> u8 { |
| 29 | match self { | 57 | match self { |
| @@ -41,9 +69,14 @@ impl Into<u8> for AHBPrescaler { | |||
| 41 | match self { | 69 | match self { |
| 42 | AHBPrescaler::NotDivided => 1, | 70 | AHBPrescaler::NotDivided => 1, |
| 43 | AHBPrescaler::Div2 => 0x08, | 71 | AHBPrescaler::Div2 => 0x08, |
| 72 | AHBPrescaler::Div3 => 0x01, | ||
| 44 | AHBPrescaler::Div4 => 0x09, | 73 | AHBPrescaler::Div4 => 0x09, |
| 74 | AHBPrescaler::Div5 => 0x02, | ||
| 75 | AHBPrescaler::Div6 => 0x05, | ||
| 45 | AHBPrescaler::Div8 => 0x0a, | 76 | AHBPrescaler::Div8 => 0x0a, |
| 77 | AHBPrescaler::Div10 => 0x06, | ||
| 46 | AHBPrescaler::Div16 => 0x0b, | 78 | AHBPrescaler::Div16 => 0x0b, |
| 79 | AHBPrescaler::Div32 => 0x07, | ||
| 47 | AHBPrescaler::Div64 => 0x0c, | 80 | AHBPrescaler::Div64 => 0x0c, |
| 48 | AHBPrescaler::Div128 => 0x0d, | 81 | AHBPrescaler::Div128 => 0x0d, |
| 49 | AHBPrescaler::Div256 => 0x0e, | 82 | AHBPrescaler::Div256 => 0x0e, |
