@@ -9,7 +9,8 @@ use svd::{Access, BitRange, Defaults, Device, EnumeratedValues, Field,
99use syn:: { Ident , Lit } ;
1010
1111use errors:: * ;
12- use util:: { self , ToSanitizedPascalCase , ToSanitizedSnakeCase , U32Ext } ;
12+ use util:: { self , ToSanitizedPascalCase , ToSanitizedSnakeCase ,
13+ ToSanitizedUpperCase , U32Ext } ;
1314
1415/// Whole device generation
1516pub fn device ( d : & Device , items : & mut Vec < Tokens > ) -> Result < ( ) > {
@@ -24,6 +25,7 @@ pub fn device(d: &Device, items: &mut Vec<Tokens>) -> Result<()> {
2425 #![ doc = #doc]
2526 #![ deny( missing_docs) ]
2627 #![ deny( warnings) ]
28+ #![ allow( non_camel_case_types) ]
2729 #![ feature( const_fn) ]
2830 #![ no_std]
2931
@@ -127,7 +129,7 @@ pub fn interrupt(peripherals: &[Peripheral], items: &mut Vec<Tokens>) {
127129 ) ;
128130 }
129131
130- let name_pc = Ident :: new ( interrupt. name . to_sanitized_pascal_case ( ) ) ;
132+ let name_pc = Ident :: new ( interrupt. name . to_sanitized_upper_case ( ) ) ;
131133 let description = format ! (
132134 "{} - {}" ,
133135 interrupt. value,
@@ -237,7 +239,7 @@ pub fn peripheral(
237239 defaults : & Defaults ,
238240) -> Result < ( ) > {
239241 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 ( ) ) ;
241243 let address = util:: unsuffixed ( u64 ( p. base_address ) ) ;
242244 let description = util:: respace ( p. description . as_ref ( ) . unwrap_or ( & p. name ) ) ;
243245
@@ -413,7 +415,7 @@ pub fn register(
413415) -> Result < ( ) > {
414416 let access = util:: access_of ( register) ;
415417 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 ( ) ) ;
417419 let name_sc = Ident :: new ( & * name. to_sanitized_snake_case ( ) ) ;
418420 let rsize = register. size
419421 . or ( defs. size )
@@ -637,7 +639,7 @@ pub fn fields(
637639 fn from ( f : & ' a Field ) -> Result < Self > {
638640 let BitRange { offset, width } = f. bit_range ;
639641 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 ( ) ;
641643 let pc_r = Ident :: new ( & * format ! ( "{}R" , pc) ) ;
642644 let pc_w = Ident :: new ( & * format ! ( "{}W" , pc) ) ;
643645 let _pc_w = Ident :: new ( & * format ! ( "_{}W" , pc) ) ;
@@ -726,15 +728,15 @@ pub fn fields(
726728 description : description,
727729 sc : sc,
728730 pc : Ident :: new ( & * ev. name
729- . to_sanitized_pascal_case ( ) ) ,
731+ . to_sanitized_upper_case ( ) ) ,
730732 value : value,
731733 } )
732734 } )
733735 . collect :: < Result < Vec < _ > > > ( ) ?;
734736
735737 let pc_r = & f. pc_r ;
736738 if let Some ( ref base) = base {
737- let pc = base. field . to_sanitized_pascal_case ( ) ;
739+ let pc = base. field . to_sanitized_upper_case ( ) ;
738740 let base_pc_r = Ident :: new ( & * format ! ( "{}R" , pc) ) ;
739741 let description =
740742 format ! ( "Possible values of the field `{}`" , f. name) ;
@@ -988,7 +990,7 @@ pub fn fields(
988990 let base_pc_w = base. as_ref ( )
989991 . map (
990992 |base| {
991- let pc = base. field . to_sanitized_pascal_case ( ) ;
993+ let pc = base. field . to_sanitized_upper_case ( ) ;
992994 let base_pc_w = Ident :: new ( & * format ! ( "{}W" , pc) ) ;
993995
994996 if let Some ( ref register) = base. register {
@@ -1036,7 +1038,7 @@ pub fn fields(
10361038 format ! ( "`{:b}`" , value)
10371039 } ) ,
10381040 pc : Ident :: new ( & * ev. name
1039- . to_sanitized_pascal_case ( ) ) ,
1041+ . to_sanitized_upper_case ( ) ) ,
10401042 sc : Ident :: new ( & * ev. name
10411043 . to_sanitized_snake_case ( ) ) ,
10421044 value : value,
0 commit comments