diff options
| author | Joshua Salzedo <[email protected]> | 2021-09-26 18:39:55 -0700 |
|---|---|---|
| committer | Joshua Salzedo <[email protected]> | 2021-09-26 18:39:55 -0700 |
| commit | 8fac444c4e54cc13f514a23e36da737d70cf7eea (patch) | |
| tree | 4057a0560e76dd0c1323cb6a13c5f45afdc14118 | |
| parent | afef19d813d7301631e98f432621ceaa963d253e (diff) | |
Flesh out v2 config writes
| -rw-r--r-- | embassy-stm32/src/crc/v2.rs | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/embassy-stm32/src/crc/v2.rs b/embassy-stm32/src/crc/v2.rs index 523bad10f..db4a3699a 100644 --- a/embassy-stm32/src/crc/v2.rs +++ b/embassy-stm32/src/crc/v2.rs | |||
| @@ -55,9 +55,11 @@ impl Crc { | |||
| 55 | CRC::reset(); | 55 | CRC::reset(); |
| 56 | let mut instance = Self { | 56 | let mut instance = Self { |
| 57 | _peripheral: peripheral, | 57 | _peripheral: peripheral, |
| 58 | _config: config | ||
| 58 | }; | 59 | }; |
| 59 | instance.init(); | 60 | unimplemented!(); |
| 60 | instance | 61 | // instance.init(); |
| 62 | // instance | ||
| 61 | } | 63 | } |
| 62 | 64 | ||
| 63 | // Configure device settings | 65 | // Configure device settings |
| @@ -84,4 +86,28 @@ impl Crc { | |||
| 84 | )}) | 86 | )}) |
| 85 | } | 87 | } |
| 86 | } | 88 | } |
| 89 | |||
| 90 | fn configure_polysize(&mut self) { | ||
| 91 | unsafe { | ||
| 92 | PAC_CRC.cr().modify(|w| {w.set_polysize( | ||
| 93 | match self._config.poly_size { | ||
| 94 | PolySize::Width7 => {vals::Polysize::POLYSIZE7} | ||
| 95 | PolySize::Width8 => {vals::Polysize::POLYSIZE8} | ||
| 96 | PolySize::Width16 => {vals::Polysize::POLYSIZE16} | ||
| 97 | PolySize::Width32 => {vals::Polysize::POLYSIZE32} | ||
| 98 | } | ||
| 99 | )}) | ||
| 100 | } | ||
| 101 | } | ||
| 102 | |||
| 103 | pub fn reset(&mut self) { | ||
| 104 | unsafe { PAC_CRC.cr().modify(|w| w.set_reset(true)); } | ||
| 105 | } | ||
| 106 | |||
| 107 | fn set_crc_init(&mut self, value: u32) { | ||
| 108 | unsafe { | ||
| 109 | PAC_CRC.init().write_value(value) | ||
| 110 | } | ||
| 111 | } | ||
| 112 | |||
| 87 | } \ No newline at end of file | 113 | } \ No newline at end of file |
