diff modulator.c @ 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 3c713073dd0c
children 6070d2e66b4c
line wrap: on
line diff
--- a/modulator.c	Tue Feb 25 15:56:49 2025 +1030
+++ b/modulator.c	Tue Feb 25 16:47:00 2025 +1030
@@ -16,7 +16,7 @@
 ** Create modulation shape
 **
 */
-//#define WITH_TRIGGER
+#define WITH_TRIGGER
 
 #include <stdio.h>
 #include <string.h>
@@ -51,8 +51,9 @@
 // Base of ctrl pins
 #define CTRLOUT_GPIO	16
 // PWM output pin
-#define TRIGOUT_GPIO	23
+#define TRIGOUT_GPIO	22
 // PIO SM trigger input pin (connected to above for testing)
+// Also outputs trigger on next pin
 #define TRIGIN_GPIO	27
 
 // Pulse control bits
@@ -119,7 +120,6 @@
   dma_channel_set_read_addr(ctrl_dma_chan, pulse_ctrl, true);
 }
 
-
 void
 pwm_wrap(void) {
   pwm_clear_irq(slice_num);
@@ -426,6 +426,7 @@
     uint trigger_sm = pio_claim_unused_sm(pulse_pio, true);
     trigger_program_init(pulse_pio, trigger_sm, trigger_pio_sm_offset, TRIGIN_GPIO, 2);
 #endif
+
     //
     // Setup PWM
     // Used here to output a trigger which gets fed back into the trigger SM