Mercurial > ~darius > hgwebdir.cgi > modulator
comparison modulator.c @ 0:a55e39064a71
First commit of code that compiles.
Does nothing like it should but has cmake goo to wrap dat files
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Mon, 29 Mar 2021 13:48:34 +1030 |
parents | |
children | 0d653f60dec8 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:a55e39064a71 |
---|---|
1 /****************************************************************** | |
2 ******************************************************************* | |
3 ** | |
4 ** This is proprietary unpublished source code, property | |
5 ** of Genesis Software. Use or disclosure without prior | |
6 ** agreement is expressly prohibited. | |
7 ** | |
8 ** Copyright (c) 2021 Genesis Software, all rights reserved. | |
9 ** | |
10 ******************************************************************* | |
11 ******************************************************************/ | |
12 | |
13 /* | |
14 ** MODULATOR.C | |
15 ** | |
16 ** Create modulation shape | |
17 ** | |
18 */ | |
19 | |
20 #include "pico/stdlib.h" | |
21 #include "hardware/clocks.h" | |
22 #include "hardware/pio.h" | |
23 | |
24 #include "dac.pio.h" | |
25 | |
26 extern void* shaped_trap_dat_size; | |
27 extern void* shaped_trap_dat_start; | |
28 | |
29 extern void* sgauss_dat_size; | |
30 extern void* sgauss_dat_start; | |
31 | |
32 int | |
33 main() { | |
34 int i; | |
35 const uint LED_PIN = PICO_DEFAULT_LED_PIN; | |
36 | |
37 stdio_init_all(); | |
38 | |
39 gpio_init(LED_PIN); | |
40 gpio_set_dir(LED_PIN, GPIO_OUT); | |
41 | |
42 // Load the clocked_input program, and configure a free state machine | |
43 // to run the program. | |
44 PIO pio = pio0; | |
45 uint offset = pio_add_program(pio, &dac_program); | |
46 uint sm = pio_claim_unused_sm(pio, true); | |
47 dac_program_init(pio, sm, offset, 4); | |
48 | |
49 while (true) { | |
50 for (i = 0; i < (int)&shaped_trap_dat_size; i++) { | |
51 if (*(uint8_t *)shaped_trap_dat_start) | |
52 gpio_put(LED_PIN, 1); | |
53 else | |
54 gpio_put(LED_PIN, 0); | |
55 sleep_ms(250); | |
56 } | |
57 for (i = 0; i < (int)&sgauss_dat_size; i++) { | |
58 if (*(uint8_t *)sgauss_dat_start) | |
59 gpio_put(LED_PIN, 1); | |
60 else | |
61 gpio_put(LED_PIN, 0); | |
62 sleep_ms(250); | |
63 } | |
64 } | |
65 } |