Mercurial > ~darius > hgwebdir.cgi > modulator
comparison ctrl.pio @ 21:8d759cf5a9e7
Load correct program, use a separate IRQ
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Tue, 25 Feb 2025 15:46:32 +1030 |
parents | f1e44afb41a3 |
children | 6070d2e66b4c |
comparison
equal
deleted
inserted
replaced
20:6aaa9658df1e | 21:8d759cf5a9e7 |
---|---|
1 ; | 1 ; |
2 ; Copyright (c) 2025 Daniel O'Connor | 2 ; Copyright (c) 2025 Daniel O'Connor |
3 ; | 3 ; |
4 | 4 |
5 .program ctrl | 5 .program ctrl |
6 .define TRIGGER_IRQ 0 | 6 .define TRIGGER_IRQ 1 |
7 ; Assert all 0s | 7 ; Assert all 0s |
8 mov pins, null | 8 mov pins, null |
9 ; Wait for start trigger and clear IRQ | 9 ; Wait for start trigger and clear IRQ |
10 wait 1 irq TRIGGER_IRQ | 10 wait 1 irq TRIGGER_IRQ |
11 irq clear TRIGGER_IRQ | |
12 .wrap_target | 11 .wrap_target |
13 out pins 8 | 12 out pins 8 |
14 nop | 13 nop |
15 out pins 8 | 14 out pins 8 |
16 nop | 15 nop |
20 nop | 19 nop |
21 .wrap | 20 .wrap |
22 | 21 |
23 % c-sdk { | 22 % c-sdk { |
24 static inline void ctrl_program_init(PIO pio, uint sm, uint offset, uint pin, uint clkdiv) { | 23 static inline void ctrl_program_init(PIO pio, uint sm, uint offset, uint pin, uint clkdiv) { |
25 pio_sm_config c = dac_program_get_default_config(offset); | 24 pio_sm_config c = ctrl_program_get_default_config(offset); |
26 | 25 |
27 // Set the OUT base pin to the provided `pin` parameter. | 26 // Set the OUT base pin to the provided `pin` parameter. |
28 // Note: We only need 6 pins but pull a byte at a time to make | 27 // Note: We only need 6 pins but pull a byte at a time to make |
29 // generating the data simpler | 28 // generating the data simpler |
30 sm_config_set_out_pins(&c, pin, 6); | 29 sm_config_set_out_pins(&c, pin, 6); |