Skip to content

Commit b19fed7

Browse files
author
Embassy CI
committed
Generated from stm32-data 3eb284caf52db3142f8a12ccfa4dc4633df05b6e
1 parent 33540d5 commit b19fed7

File tree

3 files changed

+39
-103
lines changed

3 files changed

+39
-103
lines changed

data/registers/spi_v2.json

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@
287287
"description": "I2S standard selection",
288288
"bit_offset": 4,
289289
"bit_size": 2,
290-
"enum": "ISSTD"
290+
"enum": "I2SSTD"
291291
},
292292
{
293293
"name": "PCMSYNC",
@@ -301,7 +301,7 @@
301301
"description": "I2S configuration mode",
302302
"bit_offset": 8,
303303
"bit_size": 2,
304-
"enum": "ISCFG"
304+
"enum": "I2SCFG"
305305
},
306306
{
307307
"name": "I2SE",
@@ -313,8 +313,7 @@
313313
"name": "I2SMOD",
314314
"description": "I2S mode selection",
315315
"bit_offset": 11,
316-
"bit_size": 1,
317-
"enum": "ISMOD"
316+
"bit_size": 1
318317
},
319318
{
320319
"name": "ASTRTEN",
@@ -794,7 +793,7 @@
794793
}
795794
]
796795
},
797-
"enum/ISCFG": {
796+
"enum/I2SCFG": {
798797
"bit_size": 2,
799798
"variants": [
800799
{
@@ -819,22 +818,7 @@
819818
}
820819
]
821820
},
822-
"enum/ISMOD": {
823-
"bit_size": 1,
824-
"variants": [
825-
{
826-
"name": "SPIMode",
827-
"description": "SPI mode is selected",
828-
"value": 0
829-
},
830-
{
831-
"name": "I2SMode",
832-
"description": "I2S mode is selected",
833-
"value": 1
834-
}
835-
]
836-
},
837-
"enum/ISSTD": {
821+
"enum/I2SSTD": {
838822
"bit_size": 2,
839823
"variants": [
840824
{

stm32-metapac/src/peripherals/spi_v2.rs

Lines changed: 29 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -505,13 +505,13 @@ pub mod regs {
505505
}
506506
#[doc = "I2S standard selection"]
507507
#[inline(always)]
508-
pub const fn i2sstd(&self) -> super::vals::Isstd {
508+
pub const fn i2sstd(&self) -> super::vals::I2sstd {
509509
let val = (self.0 >> 4usize) & 0x03;
510-
super::vals::Isstd::from_bits(val as u8)
510+
super::vals::I2sstd::from_bits(val as u8)
511511
}
512512
#[doc = "I2S standard selection"]
513513
#[inline(always)]
514-
pub fn set_i2sstd(&mut self, val: super::vals::Isstd) {
514+
pub fn set_i2sstd(&mut self, val: super::vals::I2sstd) {
515515
self.0 = (self.0 & !(0x03 << 4usize)) | (((val.to_bits() as u32) & 0x03) << 4usize);
516516
}
517517
#[doc = "PCM frame synchronization"]
@@ -527,13 +527,13 @@ pub mod regs {
527527
}
528528
#[doc = "I2S configuration mode"]
529529
#[inline(always)]
530-
pub const fn i2scfg(&self) -> super::vals::Iscfg {
530+
pub const fn i2scfg(&self) -> super::vals::I2scfg {
531531
let val = (self.0 >> 8usize) & 0x03;
532-
super::vals::Iscfg::from_bits(val as u8)
532+
super::vals::I2scfg::from_bits(val as u8)
533533
}
534534
#[doc = "I2S configuration mode"]
535535
#[inline(always)]
536-
pub fn set_i2scfg(&mut self, val: super::vals::Iscfg) {
536+
pub fn set_i2scfg(&mut self, val: super::vals::I2scfg) {
537537
self.0 = (self.0 & !(0x03 << 8usize)) | (((val.to_bits() as u32) & 0x03) << 8usize);
538538
}
539539
#[doc = "I2S Enabled"]
@@ -549,14 +549,14 @@ pub mod regs {
549549
}
550550
#[doc = "I2S mode selection"]
551551
#[inline(always)]
552-
pub const fn i2smod(&self) -> super::vals::Ismod {
552+
pub const fn i2smod(&self) -> bool {
553553
let val = (self.0 >> 11usize) & 0x01;
554-
super::vals::Ismod::from_bits(val as u8)
554+
val != 0
555555
}
556556
#[doc = "I2S mode selection"]
557557
#[inline(always)]
558-
pub fn set_i2smod(&mut self, val: super::vals::Ismod) {
559-
self.0 = (self.0 & !(0x01 << 11usize)) | (((val.to_bits() as u32) & 0x01) << 11usize);
558+
pub fn set_i2smod(&mut self, val: bool) {
559+
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
560560
}
561561
#[doc = "Asynchronous start enable"]
562562
#[inline(always)]
@@ -594,7 +594,7 @@ pub mod regs {
594594
#[cfg(feature = "defmt")]
595595
impl defmt::Format for I2scfgr {
596596
fn format(&self, f: defmt::Formatter) {
597-
defmt :: write ! (f , "I2scfgr {{ chlen: {:?}, datlen: {:?}, ckpol: {:?}, i2sstd: {:?}, pcmsync: {:?}, i2scfg: {:?}, i2se: {=bool:?}, i2smod: {:?}, astrten: {=bool:?} }}" , self . chlen () , self . datlen () , self . ckpol () , self . i2sstd () , self . pcmsync () , self . i2scfg () , self . i2se () , self . i2smod () , self . astrten ())
597+
defmt :: write ! (f , "I2scfgr {{ chlen: {:?}, datlen: {:?}, ckpol: {:?}, i2sstd: {:?}, pcmsync: {:?}, i2scfg: {:?}, i2se: {=bool:?}, i2smod: {=bool:?}, astrten: {=bool:?} }}" , self . chlen () , self . datlen () , self . ckpol () , self . i2sstd () , self . pcmsync () , self . i2scfg () , self . i2se () , self . i2smod () , self . astrten ())
598598
}
599599
}
600600
#[doc = "I2S prescaler register"]
@@ -1436,7 +1436,7 @@ pub mod vals {
14361436
#[repr(u8)]
14371437
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
14381438
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
1439-
pub enum Iscfg {
1439+
pub enum I2scfg {
14401440
#[doc = "Slave - transmit"]
14411441
SLAVE_TX = 0x0,
14421442
#[doc = "Slave - receive"]
@@ -1446,63 +1446,32 @@ pub mod vals {
14461446
#[doc = "Master - receive"]
14471447
MASTER_RX = 0x03,
14481448
}
1449-
impl Iscfg {
1449+
impl I2scfg {
14501450
#[inline(always)]
1451-
pub const fn from_bits(val: u8) -> Iscfg {
1451+
pub const fn from_bits(val: u8) -> I2scfg {
14521452
unsafe { core::mem::transmute(val & 0x03) }
14531453
}
14541454
#[inline(always)]
14551455
pub const fn to_bits(self) -> u8 {
14561456
unsafe { core::mem::transmute(self) }
14571457
}
14581458
}
1459-
impl From<u8> for Iscfg {
1460-
#[inline(always)]
1461-
fn from(val: u8) -> Iscfg {
1462-
Iscfg::from_bits(val)
1463-
}
1464-
}
1465-
impl From<Iscfg> for u8 {
1466-
#[inline(always)]
1467-
fn from(val: Iscfg) -> u8 {
1468-
Iscfg::to_bits(val)
1469-
}
1470-
}
1471-
#[repr(u8)]
1472-
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
1473-
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
1474-
pub enum Ismod {
1475-
#[doc = "SPI mode is selected"]
1476-
SPIMODE = 0x0,
1477-
#[doc = "I2S mode is selected"]
1478-
I2SMODE = 0x01,
1479-
}
1480-
impl Ismod {
1481-
#[inline(always)]
1482-
pub const fn from_bits(val: u8) -> Ismod {
1483-
unsafe { core::mem::transmute(val & 0x01) }
1484-
}
1485-
#[inline(always)]
1486-
pub const fn to_bits(self) -> u8 {
1487-
unsafe { core::mem::transmute(self) }
1488-
}
1489-
}
1490-
impl From<u8> for Ismod {
1459+
impl From<u8> for I2scfg {
14911460
#[inline(always)]
1492-
fn from(val: u8) -> Ismod {
1493-
Ismod::from_bits(val)
1461+
fn from(val: u8) -> I2scfg {
1462+
I2scfg::from_bits(val)
14941463
}
14951464
}
1496-
impl From<Ismod> for u8 {
1465+
impl From<I2scfg> for u8 {
14971466
#[inline(always)]
1498-
fn from(val: Ismod) -> u8 {
1499-
Ismod::to_bits(val)
1467+
fn from(val: I2scfg) -> u8 {
1468+
I2scfg::to_bits(val)
15001469
}
15011470
}
15021471
#[repr(u8)]
15031472
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
15041473
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
1505-
pub enum Isstd {
1474+
pub enum I2sstd {
15061475
#[doc = "I2S Philips standard"]
15071476
PHILIPS = 0x0,
15081477
#[doc = "MSB justified standard"]
@@ -1512,26 +1481,26 @@ pub mod vals {
15121481
#[doc = "PCM standard"]
15131482
PCM = 0x03,
15141483
}
1515-
impl Isstd {
1484+
impl I2sstd {
15161485
#[inline(always)]
1517-
pub const fn from_bits(val: u8) -> Isstd {
1486+
pub const fn from_bits(val: u8) -> I2sstd {
15181487
unsafe { core::mem::transmute(val & 0x03) }
15191488
}
15201489
#[inline(always)]
15211490
pub const fn to_bits(self) -> u8 {
15221491
unsafe { core::mem::transmute(self) }
15231492
}
15241493
}
1525-
impl From<u8> for Isstd {
1494+
impl From<u8> for I2sstd {
15261495
#[inline(always)]
1527-
fn from(val: u8) -> Isstd {
1528-
Isstd::from_bits(val)
1496+
fn from(val: u8) -> I2sstd {
1497+
I2sstd::from_bits(val)
15291498
}
15301499
}
1531-
impl From<Isstd> for u8 {
1500+
impl From<I2sstd> for u8 {
15321501
#[inline(always)]
1533-
fn from(val: Isstd) -> u8 {
1534-
Isstd::to_bits(val)
1502+
fn from(val: I2sstd) -> u8 {
1503+
I2sstd::to_bits(val)
15351504
}
15361505
}
15371506
#[repr(u8)]

stm32-metapac/src/registers/spi_v2.rs

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ pub(crate) static REGISTERS: IR = IR {
393393
bit_offset: BitOffset::Regular(RegularBitOffset { offset: 4 }),
394394
bit_size: 2,
395395
array: None,
396-
enumm: Some("Isstd"),
396+
enumm: Some("I2sstd"),
397397
},
398398
Field {
399399
name: "pcmsync",
@@ -409,7 +409,7 @@ pub(crate) static REGISTERS: IR = IR {
409409
bit_offset: BitOffset::Regular(RegularBitOffset { offset: 8 }),
410410
bit_size: 2,
411411
array: None,
412-
enumm: Some("Iscfg"),
412+
enumm: Some("I2scfg"),
413413
},
414414
Field {
415415
name: "i2se",
@@ -425,7 +425,7 @@ pub(crate) static REGISTERS: IR = IR {
425425
bit_offset: BitOffset::Regular(RegularBitOffset { offset: 11 }),
426426
bit_size: 1,
427427
array: None,
428-
enumm: Some("Ismod"),
428+
enumm: None,
429429
},
430430
Field {
431431
name: "astrten",
@@ -982,7 +982,7 @@ pub(crate) static REGISTERS: IR = IR {
982982
],
983983
},
984984
Enum {
985-
name: "Iscfg",
985+
name: "I2scfg",
986986
description: None,
987987
bit_size: 2,
988988
variants: &[
@@ -1009,24 +1009,7 @@ pub(crate) static REGISTERS: IR = IR {
10091009
],
10101010
},
10111011
Enum {
1012-
name: "Ismod",
1013-
description: None,
1014-
bit_size: 1,
1015-
variants: &[
1016-
EnumVariant {
1017-
name: "SPIMODE",
1018-
description: Some("SPI mode is selected"),
1019-
value: 0,
1020-
},
1021-
EnumVariant {
1022-
name: "I2SMODE",
1023-
description: Some("I2S mode is selected"),
1024-
value: 1,
1025-
},
1026-
],
1027-
},
1028-
Enum {
1029-
name: "Isstd",
1012+
name: "I2sstd",
10301013
description: None,
10311014
bit_size: 2,
10321015
variants: &[

0 commit comments

Comments
 (0)