Mercurial > ~darius > hgwebdir.cgi > modulator
view modulator.c @ 2:0d653f60dec8
Actually get data moving out.
Previous shape info caused a hard fault.
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Mon, 29 Mar 2021 17:39:00 +1030 |
parents | a55e39064a71 |
children | b10097c3383d |
line wrap: on
line source
/****************************************************************** ******************************************************************* ** ** This is proprietary unpublished source code, property ** of Genesis Software. Use or disclosure without prior ** agreement is expressly prohibited. ** ** Copyright (c) 2021 Genesis Software, all rights reserved. ** ******************************************************************* ******************************************************************/ /* ** MODULATOR.C ** ** Create modulation shape ** */ #include "pico/stdlib.h" #include "hardware/clocks.h" #include "hardware/pio.h" #include "dac.pio.h" #if 0 extern void* shaped_trap_dat_size; extern void* shaped_trap_dat_start; extern void* sgauss_dat_size; extern void* sgauss_dat_start; #endif uint8_t shaped_trap_dat_start[] = { 0, 1, 2, 4, 8, 16, 32, 64, 128, 0, 0, 0, 0, 0, 0, 0 }; //uint8_t shaped_trap_dat_start[] = { 0, 1, 2, 3, 1, 2, 0, 3, 1, 1, 2, 3, 0, 1, 2, 3 }; int main() { int i; const uint LED_PIN = PICO_DEFAULT_LED_PIN; stdio_init_all(); gpio_init(LED_PIN); gpio_set_dir(LED_PIN, GPIO_OUT); // Load the clocked_input program, and configure a free state machine // to run the program. PIO pio = pio0; uint offset = pio_add_program(pio, &dac_program); uint sm = pio_claim_unused_sm(pio, true); // XXX: I would prefer starting at GPIO16 but in that case the top 2 // bits don't seem to work dac_program_init(pio, sm, offset, 14); while (true) { for (int i = 0; i < sizeof(shaped_trap_dat_start) / 4; i++) { pio_sm_put_blocking(pio, sm, ((uint32_t *)shaped_trap_dat_start)[i]); } #if 0 gpio_put(LED_PIN, 1); sleep_ms(100); gpio_put(LED_PIN, 0); #endif } }