Remove ad-hoc imports from generated code.

This commit is contained in:
Dario Nieuwenhuis 2021-05-21 19:29:37 +02:00
parent da16c60487
commit f96db3d9d2
2 changed files with 5 additions and 7 deletions

View File

@ -118,7 +118,7 @@ for chip in chips.values():
if block_mod == 'rng': if block_mod == 'rng':
for irq in chip['interrupts']: for irq in chip['interrupts']:
if re.search('RNG', irq): if re.search('RNG', irq):
f.write(f'impl_rng!({name}, ' + irq + f');') f.write(f'impl_rng!({name}, {irq});')
if block_mod == 'spi': if block_mod == 'spi':
if 'clock' in peri: if 'clock' in peri:
@ -182,7 +182,6 @@ for chip in chips.values():
if func := funcs.get(f'{name}_D7'): if func := funcs.get(f'{name}_D7'):
f.write(f'impl_sdmmc_pin!({name}, D7Pin, {pin}, {func});') f.write(f'impl_sdmmc_pin!({name}, D7Pin, {pin}, {func});')
if block_mod == 'exti': if block_mod == 'exti':
for irq in chip['interrupts']: for irq in chip['interrupts']:
if re.match('EXTI', irq): if re.match('EXTI', irq):
@ -201,7 +200,6 @@ for chip in chips.values():
peripherals!({','.join(peripheral_names)}); peripherals!({','.join(peripheral_names)});
""") """)
# ========= DMA peripherals # ========= DMA peripherals
if num_dmas > 0: if num_dmas > 0:
f.write(f""" f.write(f"""
@ -219,9 +217,6 @@ for chip in chips.values():
# ========= exti interrupts # ========= exti interrupts
f.write(f""" f.write(f"""
use embassy::interrupt::Interrupt;
use embassy::interrupt::InterruptExt;
impl_exti_irq!({','.join(exti_interrupts)}); impl_exti_irq!({','.join(exti_interrupts)});
""") """)

View File

@ -216,6 +216,9 @@ macro_rules! impl_exti_irq {
($($e:ident),+) => { ($($e:ident),+) => {
/// safety: must be called only once /// safety: must be called only once
pub(crate) unsafe fn init_exti() { pub(crate) unsafe fn init_exti() {
use embassy::interrupt::Interrupt;
use embassy::interrupt::InterruptExt;
$( $(
crate::interrupt::$e::steal().enable(); crate::interrupt::$e::steal().enable();
)+ )+