@@ -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 < ( ) > {
@@ -24,6 +25,7 @@ pub fn device(d: &Device, items: &mut Vec<Tokens>) -> Result<()> {
24
25
#![ doc = #doc]
25
26
#![ deny( missing_docs) ]
26
27
#![ deny( warnings) ]
28
+ #![ allow( non_camel_case_types) ]
27
29
#![ feature( const_fn) ]
28
30
#![ no_std]
29
31
@@ -127,7 +129,7 @@ pub fn interrupt(peripherals: &[Peripheral], items: &mut Vec<Tokens>) {
127
129
) ;
128
130
}
129
131
130
- let name_pc = Ident :: new ( interrupt. name . to_sanitized_pascal_case ( ) ) ;
132
+ let name_pc = Ident :: new ( interrupt. name . to_sanitized_upper_case ( ) ) ;
131
133
let description = format ! (
132
134
"{} - {}" ,
133
135
interrupt. value,
@@ -237,7 +239,7 @@ pub fn peripheral(
237
239
defaults : & Defaults ,
238
240
) -> Result < ( ) > {
239
241
let name = Ident :: new ( & * p. name . to_uppercase ( ) ) ;
240
- let name_pc = Ident :: new ( & * p. name . to_sanitized_pascal_case ( ) ) ;
242
+ let name_pc = Ident :: new ( & * p. name . to_sanitized_upper_case ( ) ) ;
241
243
let address = util:: unsuffixed ( u64 ( p. base_address ) ) ;
242
244
let description = util:: respace ( p. description . as_ref ( ) . unwrap_or ( & p. name ) ) ;
243
245
@@ -413,7 +415,7 @@ pub fn register(
413
415
) -> Result < ( ) > {
414
416
let access = util:: access_of ( register) ;
415
417
let name = util:: name_of ( register) ;
416
- let name_pc = Ident :: new ( & * name. to_sanitized_pascal_case ( ) ) ;
418
+ let name_pc = Ident :: new ( & * name. to_sanitized_upper_case ( ) ) ;
417
419
let name_sc = Ident :: new ( & * name. to_sanitized_snake_case ( ) ) ;
418
420
let rsize = register. size
419
421
. or ( defs. size )
@@ -637,7 +639,7 @@ pub fn fields(
637
639
fn from ( f : & ' a Field ) -> Result < Self > {
638
640
let BitRange { offset, width } = f. bit_range ;
639
641
let sc = f. name . to_sanitized_snake_case ( ) ;
640
- let pc = f. name . to_sanitized_pascal_case ( ) ;
642
+ let pc = f. name . to_sanitized_upper_case ( ) ;
641
643
let pc_r = Ident :: new ( & * format ! ( "{}R" , pc) ) ;
642
644
let pc_w = Ident :: new ( & * format ! ( "{}W" , pc) ) ;
643
645
let _pc_w = Ident :: new ( & * format ! ( "_{}W" , pc) ) ;
@@ -726,15 +728,15 @@ pub fn fields(
726
728
description : description,
727
729
sc : sc,
728
730
pc : Ident :: new ( & * ev. name
729
- . to_sanitized_pascal_case ( ) ) ,
731
+ . to_sanitized_upper_case ( ) ) ,
730
732
value : value,
731
733
} )
732
734
} )
733
735
. collect :: < Result < Vec < _ > > > ( ) ?;
734
736
735
737
let pc_r = & f. pc_r ;
736
738
if let Some ( ref base) = base {
737
- let pc = base. field . to_sanitized_pascal_case ( ) ;
739
+ let pc = base. field . to_sanitized_upper_case ( ) ;
738
740
let base_pc_r = Ident :: new ( & * format ! ( "{}R" , pc) ) ;
739
741
let description =
740
742
format ! ( "Possible values of the field `{}`" , f. name) ;
@@ -988,7 +990,7 @@ pub fn fields(
988
990
let base_pc_w = base. as_ref ( )
989
991
. map (
990
992
|base| {
991
- let pc = base. field . to_sanitized_pascal_case ( ) ;
993
+ let pc = base. field . to_sanitized_upper_case ( ) ;
992
994
let base_pc_w = Ident :: new ( & * format ! ( "{}W" , pc) ) ;
993
995
994
996
if let Some ( ref register) = base. register {
@@ -1036,7 +1038,7 @@ pub fn fields(
1036
1038
format ! ( "`{:b}`" , value)
1037
1039
} ) ,
1038
1040
pc : Ident :: new ( & * ev. name
1039
- . to_sanitized_pascal_case ( ) ) ,
1041
+ . to_sanitized_upper_case ( ) ) ,
1040
1042
sc : Ident :: new ( & * ev. name
1041
1043
. to_sanitized_snake_case ( ) ) ,
1042
1044
value : value,
0 commit comments