@@ -38,7 +38,7 @@ pub const ExternalInterrupt = blk: {
3838 // Note: The value of each field is the interrupt number (VTOR offset),
3939 // not the offset into the whole vector table.
4040
41- const vector_info = @typeInfo (Interrupt ).@"enum" ;
41+ const vector_info = @typeInfo (Interrupt ).@"enum" ;
4242 const vector_fields = vector_info .fields ;
4343 var result_len : usize = 0 ;
4444
@@ -74,7 +74,7 @@ pub const Exception = blk: {
7474 // Note: The value of each field is the index into the whole
7575 // vector table, not the negative offset from VTOR.
7676
77- const vector_info = @typeInfo (Interrupt ).@"enum" ;
77+ const vector_info = @typeInfo (Interrupt ).@"enum" ;
7878 const vector_fields = vector_info .fields ;
7979 var result_len : usize = 0 ;
8080
@@ -106,7 +106,6 @@ pub const Exception = blk: {
106106};
107107
108108pub const interrupt = struct {
109-
110109 pub const Priority = enum (u8 ) {
111110 lowest = 0 ,
112111 highest = 15 ,
@@ -136,15 +135,11 @@ pub const interrupt = struct {
136135 }
137136
138137 pub const exception = struct {
139-
140138 const ppb = microzig .chip .peripherals .PPB ;
141139
142140 pub fn is_enabled (comptime excpt : Exception ) bool {
143141 switch (cortex_m ) {
144- .cortex_m3 ,
145- .cortex_m4 ,
146- .cortex_m7
147- = > {
142+ .cortex_m3 , .cortex_m4 , .cortex_m7 = > {
148143 const raw = ppb .SHCSR .raw ;
149144 switch (excpt ) {
150145 .UsageFault = > return (raw & 0x0004_0000 ) != 0 ,
@@ -171,10 +166,7 @@ pub const interrupt = struct {
171166
172167 pub fn enable (comptime excpt : Exception ) void {
173168 switch (cortex_m ) {
174- .cortex_m3 ,
175- .cortex_m4 ,
176- .cortex_m7
177- = > {
169+ .cortex_m3 , .cortex_m4 , .cortex_m7 = > {
178170 switch (excpt ) {
179171 .UsageFault = > ppb .SHCSR .raw |= 0x0004_0000 ,
180172 .BusFault = > ppb .SHCSR .raw |= 0x0002_0000 ,
@@ -195,14 +187,11 @@ pub const interrupt = struct {
195187 },
196188 else = > @compileError ("not supported on this platform" ),
197189 }
198- }
190+ }
199191
200192 pub fn disable (comptime excpt : Exception ) void {
201193 switch (cortex_m ) {
202- .cortex_m3 ,
203- .cortex_m4 ,
204- .cortex_m7
205- = > {
194+ .cortex_m3 , .cortex_m4 , .cortex_m7 = > {
206195 switch (excpt ) {
207196 .UsageFault = > ppb .SHCSR .raw &= ~ @as (u32 , 0x0004_0000 ),
208197 .BusFault = > ppb .SHCSR .raw &= ~ @as (u32 , 0x0002_0000 ),
@@ -232,10 +221,7 @@ pub const interrupt = struct {
232221 if (excpt == .SVCALL ) return (ppb .SHCSR .raw & 0x0000_8000 ) != 0 ;
233222 @compileError ("not supported on this platform" );
234223 },
235- .cortex_m3 ,
236- .cortex_m4 ,
237- .cortex_m7
238- = > {
224+ .cortex_m3 , .cortex_m4 , .cortex_m7 = > {
239225 const raw = ppb .SHCSR .raw ;
240226 switch (excpt ) {
241227 .SVCall = > return (raw & 0x0000_8000 ) != 0 ,
@@ -270,10 +256,7 @@ pub const interrupt = struct {
270256 if (excpt == .SVCALL ) ppb .SHCSR .raw |= 0x0000_8000 ;
271257 @compileError ("not supported on this platform" );
272258 },
273- .cortex_m3 ,
274- .cortex_m4 ,
275- .cortex_m7
276- = > {
259+ .cortex_m3 , .cortex_m4 , .cortex_m7 = > {
277260 switch (excpt ) {
278261 .SVCall = > ppb .SHCSR .raw |= 0x0000_8000 ,
279262 .BusFault = > ppb .SHCSR .raw |= 0x0000_4000 ,
@@ -306,10 +289,7 @@ pub const interrupt = struct {
306289 if (excpt == .SVCALL ) ppb .SHCSR .raw &= ~ @as (u32 , 0x0000_8000 );
307290 @compileError ("not supported on this platform" );
308291 },
309- .cortex_m3 ,
310- .cortex_m4 ,
311- .cortex_m7
312- = > {
292+ .cortex_m3 , .cortex_m4 , .cortex_m7 = > {
313293 switch (excpt ) {
314294 .SVCall = > ppb .SHCSR .raw &= ~ @as (u32 , 0x0000_8000 ),
315295 .BusFault = > ppb .SHCSR .raw &= ~ @as (u32 , 0x0000_4000 ),
@@ -357,7 +337,7 @@ pub const interrupt = struct {
357337 ppb .SHPR2 .raw &= ~ (@as (u32 , 0xFF ) << shift );
358338 ppb .SHPR2 .raw |= @as (u32 , @intFromEnum (priority )) << shift ;
359339 },
360- 3 = > {
340+ 3 = > {
361341 ppb .SHPR3 .raw &= ~ (@as (u32 , 0xFF ) << shift );
362342 ppb .SHPR3 .raw |= @as (u32 , @intFromEnum (priority )) << shift ;
363343 },
0 commit comments