@@ -206,34 +206,68 @@ pub fn render(
206206 }
207207 } ;
208208
209- if target == Target :: CortexM {
210- root. extend ( quote ! {
211- #interrupt_enum
212-
213- unsafe impl cortex_m:: interrupt:: InterruptNumber for Interrupt {
214- #[ inline( always) ]
215- fn number( #self_token) -> u16 {
216- #nr_expr
209+ match target {
210+ Target :: CortexM => {
211+ root. extend ( quote ! {
212+ #interrupt_enum
213+
214+ unsafe impl cortex_m:: interrupt:: InterruptNumber for Interrupt {
215+ #[ inline( always) ]
216+ fn number( #self_token) -> u16 {
217+ #nr_expr
218+ }
219+ }
220+ } ) ;
221+ }
222+ Target :: XtensaLX => {
223+ root. extend ( quote ! {
224+ #interrupt_enum
225+
226+ unsafe impl xtensa_lx:: interrupt:: InterruptNumber for Interrupt {
227+ #[ inline( always) ]
228+ fn number( #self_token) -> u16 {
229+ #nr_expr
230+ }
217231 }
218- }
219- } ) ;
220- } else {
221- mod_items. extend ( quote ! {
222- #interrupt_enum
223232
224- #[ derive( Debug , Copy , Clone ) ]
225- pub struct TryFromInterruptError ( ( ) ) ;
233+ /// TryFromInterruptError
234+ #[ derive( Debug , Copy , Clone ) ]
235+ pub struct TryFromInterruptError ( ( ) ) ;
226236
227- impl Interrupt {
228- #[ inline]
229- pub fn try_from( value: u8 ) -> Result <Self , TryFromInterruptError > {
230- match value {
231- #from_arms
232- _ => Err ( TryFromInterruptError ( ( ) ) ) ,
237+ impl Interrupt {
238+
239+ /// Attempt to convert a given value into an `Interrupt`
240+ #[ inline]
241+ pub fn try_from( value: u16 ) -> Result <Self , TryFromInterruptError > {
242+ match value {
243+ #from_arms
244+ _ => Err ( TryFromInterruptError ( ( ) ) ) ,
245+ }
233246 }
234247 }
235- }
236- } ) ;
248+ } ) ;
249+ }
250+ _ => {
251+ mod_items. extend ( quote ! {
252+ #interrupt_enum
253+
254+ /// TryFromInterruptError
255+ #[ derive( Debug , Copy , Clone ) ]
256+ pub struct TryFromInterruptError ( ( ) ) ;
257+
258+ impl Interrupt {
259+
260+ /// Attempt to convert a given value into an `Interrupt`
261+ #[ inline]
262+ pub fn try_from( value: u8 ) -> Result <Self , TryFromInterruptError > {
263+ match value {
264+ #from_arms
265+ _ => Err ( TryFromInterruptError ( ( ) ) ) ,
266+ }
267+ }
268+ }
269+ } ) ;
270+ }
237271 }
238272 }
239273
@@ -330,7 +364,11 @@ pub fn render(
330364 }
331365 }
332366
333- if !interrupts. is_empty ( ) && target != Target :: CortexM && target != Target :: Msp430 {
367+ if !interrupts. is_empty ( )
368+ && target != Target :: CortexM
369+ && target != Target :: XtensaLX
370+ && target != Target :: Msp430
371+ {
334372 root. extend ( quote ! {
335373 #[ doc( hidden) ]
336374 pub mod interrupt {
0 commit comments