@@ -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 < ( ) > {
@@ -26,6 +27,7 @@ pub fn device(d: &Device, items: &mut Vec<Tokens>) -> Result<()> {
2627 #![ doc = #doc]
2728 #![ deny( missing_docs) ]
2829 #![ deny( warnings) ]
30+ #![ allow( non_camel_case_types) ]
2931 #![ feature( const_fn) ]
3032 #![ feature( optin_builtin_traits) ]
3133 #![ no_std]
@@ -130,7 +132,7 @@ pub fn interrupt(peripherals: &[Peripheral], items: &mut Vec<Tokens>) {
130132 ) ;
131133 }
132134
133- let name_pc = Ident :: new ( interrupt. name . to_sanitized_pascal_case ( ) ) ;
135+ let name_pc = Ident :: new ( interrupt. name . to_sanitized_upper_case ( ) ) ;
134136 let description = format ! (
135137 "{} - {}" ,
136138 interrupt. value,
@@ -242,7 +244,7 @@ pub fn peripheral(
242244 defaults : & Defaults ,
243245) -> Result < ( ) > {
244246 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 ( ) ) ;
246248 let address = util:: unsuffixed ( u64 ( p. base_address ) ) ;
247249 let description = util:: respace ( p. description . as_ref ( ) . unwrap_or ( & p. name ) ) ;
248250
@@ -425,7 +427,7 @@ pub fn register(
425427) -> Result < ( ) > {
426428 let access = util:: access_of ( register) ;
427429 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 ( ) ) ;
429431 let name_sc = Ident :: new ( & * name. to_sanitized_snake_case ( ) ) ;
430432 let rsize = register. size
431433 . or ( defs. size )
@@ -657,7 +659,7 @@ pub fn fields(
657659 fn from ( f : & ' a Field ) -> Result < Self > {
658660 let BitRange { offset, width } = f. bit_range ;
659661 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 ( ) ;
661663 let pc_r = Ident :: new ( & * format ! ( "{}R" , pc) ) ;
662664 let pc_w = Ident :: new ( & * format ! ( "{}W" , pc) ) ;
663665 let _pc_w = Ident :: new ( & * format ! ( "_{}W" , pc) ) ;
@@ -761,15 +763,15 @@ pub fn fields(
761763 description : description,
762764 sc : sc,
763765 pc : Ident :: new ( & * ev. name
764- . to_sanitized_pascal_case ( ) ) ,
766+ . to_sanitized_upper_case ( ) ) ,
765767 value : value,
766768 } )
767769 } )
768770 . collect :: < Result < Vec < _ > > > ( ) ?;
769771
770772 let pc_r = & f. pc_r ;
771773 if let Some ( ref base) = base {
772- let pc = base. field . to_sanitized_pascal_case ( ) ;
774+ let pc = base. field . to_sanitized_upper_case ( ) ;
773775 let base_pc_r = Ident :: new ( & * format ! ( "{}R" , pc) ) ;
774776 let description =
775777 format ! ( "Possible values of the field `{}`" , f. name) ;
@@ -1075,7 +1077,7 @@ pub fn fields(
10751077 let base_pc_w = base. as_ref ( )
10761078 . map (
10771079 |base| {
1078- let pc = base. field . to_sanitized_pascal_case ( ) ;
1080+ let pc = base. field . to_sanitized_upper_case ( ) ;
10791081 let base_pc_w = Ident :: new ( & * format ! ( "{}W" , pc) ) ;
10801082
10811083 if let ( Some ( ref peripheral) , Some ( ref register) ) = ( base. peripheral , base. register ) {
@@ -1142,7 +1144,7 @@ pub fn fields(
11421144 format ! ( "`{:b}`" , value)
11431145 } ) ,
11441146 pc : Ident :: new ( & * ev. name
1145- . to_sanitized_pascal_case ( ) ) ,
1147+ . to_sanitized_upper_case ( ) ) ,
11461148 sc : Ident :: new ( & * ev. name
11471149 . to_sanitized_snake_case ( ) ) ,
11481150 value : value,
0 commit comments