diff dac.pio @ 5:2db42eaba3c8

WIP
author Daniel O'Connor <darius@dons.net.au>
date Sat, 15 Feb 2025 22:57:18 +1030
parents 0d653f60dec8
children 3acdebd7eec7
line wrap: on
line diff
--- a/dac.pio	Tue Feb 04 14:20:07 2025 +1030
+++ b/dac.pio	Sat Feb 15 22:57:18 2025 +1030
@@ -19,7 +19,7 @@
 .wrap
 
 % c-sdk {
-static inline void dac_program_init(PIO pio, uint sm, uint offset, uint pin) {
+static inline void dac_program_init(PIO pio, uint sm, uint offset, uint pin, uint clkdiv) {
     pio_sm_config c = dac_program_get_default_config(offset);
 
     // Set the OUT base pin to the provided `pin` parameter.
@@ -35,7 +35,7 @@
         &c,
         true,  // Shift-to-right
         false, // Autopull enabled
-        8      // Autopull threshold (bits!)
+        32     // Autopull threshold (bits!)
     );
 
     // Configure clock as sideset pin
@@ -44,7 +44,7 @@
     // We only send, so disable the RX FIFO to make the TX FIFO deeper.
     sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_TX);
 
-//    sm_config_set_clkdiv(&c, 100);
+    sm_config_set_clkdiv(&c, clkdiv);
 
     // Load our configuration, and start the program from the beginning
     pio_sm_init(pio, sm, offset, &c);