@@ -9,7 +9,8 @@ use svd::{Access, BitRange, Defaults, Device, EnumeratedValues, Field,
9
9
use syn:: { Ident , Lit } ;
10
10
11
11
use errors:: * ;
12
- use util:: { self , ToSanitizedPascalCase , ToSanitizedSnakeCase , U32Ext } ;
12
+ use util:: { self , ToSanitizedPascalCase , ToSanitizedSnakeCase ,
13
+ ToSanitizedUpperCase , U32Ext } ;
13
14
14
15
/// Whole device generation
15
16
pub fn device ( d : & Device , items : & mut Vec < Tokens > ) -> Result < ( ) > {
@@ -26,6 +27,7 @@ pub fn device(d: &Device, items: &mut Vec<Tokens>) -> Result<()> {
26
27
#![ doc = #doc]
27
28
#![ deny( missing_docs) ]
28
29
#![ deny( warnings) ]
30
+ #![ allow( non_camel_case_types) ]
29
31
#![ feature( const_fn) ]
30
32
#![ feature( optin_builtin_traits) ]
31
33
#![ no_std]
@@ -130,7 +132,7 @@ pub fn interrupt(peripherals: &[Peripheral], items: &mut Vec<Tokens>) {
130
132
) ;
131
133
}
132
134
133
- let name_pc = Ident :: new ( interrupt. name . to_sanitized_pascal_case ( ) ) ;
135
+ let name_pc = Ident :: new ( interrupt. name . to_sanitized_upper_case ( ) ) ;
134
136
let description = format ! (
135
137
"{} - {}" ,
136
138
interrupt. value,
@@ -242,7 +244,7 @@ pub fn peripheral(
242
244
defaults : & Defaults ,
243
245
) -> Result < ( ) > {
244
246
let name = Ident :: new ( & * p. name . to_uppercase ( ) ) ;
245
- let name_pc = Ident :: new ( & * p. name . to_sanitized_pascal_case ( ) ) ;
247
+ let name_pc = Ident :: new ( & * p. name . to_sanitized_upper_case ( ) ) ;
246
248
let address = util:: unsuffixed ( u64 ( p. base_address ) ) ;
247
249
let description = util:: respace ( p. description . as_ref ( ) . unwrap_or ( & p. name ) ) ;
248
250
@@ -425,7 +427,7 @@ pub fn register(
425
427
) -> Result < ( ) > {
426
428
let access = util:: access_of ( register) ;
427
429
let name = util:: name_of ( register) ;
428
- let name_pc = Ident :: new ( & * name. to_sanitized_pascal_case ( ) ) ;
430
+ let name_pc = Ident :: new ( & * name. to_sanitized_upper_case ( ) ) ;
429
431
let name_sc = Ident :: new ( & * name. to_sanitized_snake_case ( ) ) ;
430
432
let rsize = register. size
431
433
. or ( defs. size )
@@ -657,7 +659,7 @@ pub fn fields(
657
659
fn from ( f : & ' a Field ) -> Result < Self > {
658
660
let BitRange { offset, width } = f. bit_range ;
659
661
let sc = f. name . to_sanitized_snake_case ( ) ;
660
- let pc = f. name . to_sanitized_pascal_case ( ) ;
662
+ let pc = f. name . to_sanitized_upper_case ( ) ;
661
663
let pc_r = Ident :: new ( & * format ! ( "{}R" , pc) ) ;
662
664
let pc_w = Ident :: new ( & * format ! ( "{}W" , pc) ) ;
663
665
let _pc_w = Ident :: new ( & * format ! ( "_{}W" , pc) ) ;
@@ -761,15 +763,15 @@ pub fn fields(
761
763
description : description,
762
764
sc : sc,
763
765
pc : Ident :: new ( & * ev. name
764
- . to_sanitized_pascal_case ( ) ) ,
766
+ . to_sanitized_upper_case ( ) ) ,
765
767
value : value,
766
768
} )
767
769
} )
768
770
. collect :: < Result < Vec < _ > > > ( ) ?;
769
771
770
772
let pc_r = & f. pc_r ;
771
773
if let Some ( ref base) = base {
772
- let pc = base. field . to_sanitized_pascal_case ( ) ;
774
+ let pc = base. field . to_sanitized_upper_case ( ) ;
773
775
let base_pc_r = Ident :: new ( & * format ! ( "{}R" , pc) ) ;
774
776
let description =
775
777
format ! ( "Possible values of the field `{}`" , f. name) ;
@@ -1075,7 +1077,7 @@ pub fn fields(
1075
1077
let base_pc_w = base. as_ref ( )
1076
1078
. map (
1077
1079
|base| {
1078
- let pc = base. field . to_sanitized_pascal_case ( ) ;
1080
+ let pc = base. field . to_sanitized_upper_case ( ) ;
1079
1081
let base_pc_w = Ident :: new ( & * format ! ( "{}W" , pc) ) ;
1080
1082
1081
1083
if let ( Some ( ref peripheral) , Some ( ref register) ) = ( base. peripheral , base. register ) {
@@ -1142,7 +1144,7 @@ pub fn fields(
1142
1144
format ! ( "`{:b}`" , value)
1143
1145
} ) ,
1144
1146
pc : Ident :: new ( & * ev. name
1145
- . to_sanitized_pascal_case ( ) ) ,
1147
+ . to_sanitized_upper_case ( ) ) ,
1146
1148
sc : Ident :: new ( & * ev. name
1147
1149
. to_sanitized_snake_case ( ) ) ,
1148
1150
value : value,
0 commit comments