Mercurial > ~darius > hgwebdir.cgi > modulator
diff trigger.pio @ 24:c7845db23ab2
Add sideset for trigger output.
Trigger both SMs
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Tue, 25 Feb 2025 16:47:00 +1030 |
parents | 283955273884 |
children | 6070d2e66b4c |
line wrap: on
line diff
--- a/trigger.pio Tue Feb 25 15:56:49 2025 +1030 +++ b/trigger.pio Tue Feb 25 16:47:00 2025 +1030 @@ -3,15 +3,19 @@ ; .program trigger -.define TRIGGER_IRQ 0 +.define DAC_TRIGGER_IRQ 0 +.define CTRL_TRIGGER_IRQ 1 +; Use 1 side set pin for debugging +.side_set 1 .wrap_target ; Wait for trigger to be low - wait 0 pin 0 + wait 0 pin 0 side 0 ; Wait for rising edge - wait 1 pin 0 -; Signal other state machine - irq nowait TRIGGER_IRQ + wait 1 pin 0 side 0 +; Signal other state machines + irq nowait DAC_TRIGGER_IRQ side 1 + irq nowait CTRL_TRIGGER_IRQ side 1 .wrap % c-sdk { @@ -25,6 +29,13 @@ // Connect this GPIO to this PIO block pio_gpio_init(pio, pin); + // Configure side pin mapping to point to debug pin + sm_config_set_sideset_pins(&c, pin + 1); + // Set to output + pio_sm_set_consecutive_pindirs(pio, sm, pin + 1, 1, true); + // Connect this GPIO to this PIO block + pio_gpio_init(pio, pin + 1); + sm_config_set_clkdiv(&c, clkdiv); // Load our configuration, and start the program from the beginning