diff --git a/audio/sine_wave/CMakeLists.txt b/audio/sine_wave/CMakeLists.txt index 715dd54..75a5b89 100644 --- a/audio/sine_wave/CMakeLists.txt +++ b/audio/sine_wave/CMakeLists.txt @@ -14,6 +14,11 @@ if (TARGET pico_audio_i2s) PICO_AUDIO_I2S_MONO_INPUT=1 #define for our example code USE_AUDIO_I2S=1 +# PICO_AUDIO_I2S_DATA_PIN=22 +# PICO_AUDIO_I2S_CLOCK_PIN_BASE=23 +# PICO_DEFAULT_UART=0 +# PICO_DEFAULT_UART_TX_PIN=28 +# PICO_DEFAULT_UART_RX_PIN=29 ) # create map/bin/hex file etc. pico_add_extra_outputs(sine_wave_i2s) diff --git a/audio/sine_wave/sine_wave.c b/audio/sine_wave/sine_wave.c index c6f62c7..7cc7b26 100644 --- a/audio/sine_wave/sine_wave.c +++ b/audio/sine_wave/sine_wave.c @@ -20,6 +20,11 @@ #include "pico/audio_i2s.h" +#if PICO_ON_DEVICE +#include "pico/binary_info.h" +bi_decl(bi_3pins_with_names(PICO_AUDIO_I2S_DATA_PIN, "I2S DIN", PICO_AUDIO_I2S_CLOCK_PIN_BASE, "I2S BCK", PICO_AUDIO_I2S_CLOCK_PIN_BASE+1, "I2S LRCK")); +#endif + #elif USE_AUDIO_PWM #include "pico/audio_pwm.h" #elif USE_AUDIO_SPDIF diff --git a/scanvideo/demo1/demo1.c b/scanvideo/demo1/demo1.c index bc57cbe..e2959e4 100644 --- a/scanvideo/demo1/demo1.c +++ b/scanvideo/demo1/demo1.c @@ -602,7 +602,7 @@ int main(void) { gpio_put(27, 0); #if PICO_ON_DEVICE && !PICO_ON_FPGA -#if PICO_SCANVIDEO_48MHz +#if PICO_SCANVIDEO_48MHZ /* set to double frequency 48Mhz for some examples which were written for a higher clock speed */ set_sys_clock_khz(96000, true); #endif diff --git a/scanvideo/hscroll_dma_tiles/hscroll_dma_tiles.c b/scanvideo/hscroll_dma_tiles/hscroll_dma_tiles.c index d198217..77bc56b 100644 --- a/scanvideo/hscroll_dma_tiles/hscroll_dma_tiles.c +++ b/scanvideo/hscroll_dma_tiles/hscroll_dma_tiles.c @@ -572,7 +572,7 @@ void go_core1(void (*execute)()) { } int main(void) { -#if PICO_SCANVIDEO_48MHz +#if PICO_SCANVIDEO_48MHZ set_sys_clock_48mhz(); #endif setup_default_uart(); diff --git a/scanvideo/mario_tiles/mario_tiles.c b/scanvideo/mario_tiles/mario_tiles.c index 0bac509..9ce63c4 100644 --- a/scanvideo/mario_tiles/mario_tiles.c +++ b/scanvideo/mario_tiles/mario_tiles.c @@ -665,7 +665,7 @@ void go_core1(void (*execute)()) { } int main(void) { -#if PICO_SCANVIDEO_48MHz +#if PICO_SCANVIDEO_48MHZ set_sys_clock_48mhz(); #endif setup_default_uart(); diff --git a/scanvideo/scanvideo_minimal/scanvideo_minimal.c b/scanvideo/scanvideo_minimal/scanvideo_minimal.c index 1845ebc..01e4c35 100644 --- a/scanvideo/scanvideo_minimal/scanvideo_minimal.c +++ b/scanvideo/scanvideo_minimal/scanvideo_minimal.c @@ -104,7 +104,7 @@ void render_scanline(struct scanvideo_scanline_buffer *dest, int core) { int main(void) { -#if PICO_SCANVIDEO_48MHz +#if PICO_SCANVIDEO_48MHZ set_sys_clock_48mhz(); #endif // Re init uart now that clk_peri has changed diff --git a/scanvideo/sprite_demo/sprite_demo.c b/scanvideo/sprite_demo/sprite_demo.c index 124982b..1b9480e 100644 --- a/scanvideo/sprite_demo/sprite_demo.c +++ b/scanvideo/sprite_demo/sprite_demo.c @@ -176,7 +176,7 @@ int main(void) { sleep_ms(10); set_sys_clock_khz(400000, true); #else -#if PICO_SCANVIDEO_48MHz +#if PICO_SCANVIDEO_48MHZ set_sys_clock_khz(192000, true); #else set_sys_clock_khz(200000, true); diff --git a/scanvideo/test_pattern/test_pattern.c b/scanvideo/test_pattern/test_pattern.c index 265ad7e..77190e6 100644 --- a/scanvideo/test_pattern/test_pattern.c +++ b/scanvideo/test_pattern/test_pattern.c @@ -58,19 +58,18 @@ int main(void) { void draw_color_bar(scanvideo_scanline_buffer_t *buffer) { // figure out 1/32 of the color value uint line_num = scanvideo_scanline_number(buffer->scanline_id); - int32_t color_step = 1 + (line_num * 7 / vga_mode.height); - color_step = PICO_SCANVIDEO_PIXEL_FROM_RGB5(color_step & 1u, (color_step >> 1u) & 1u, (color_step >> 2u) & 1u); - if (invert) color_step = -color_step; + uint32_t primary_color = 1u + (line_num * 7 / vga_mode.height); + uint32_t color_mask = PICO_SCANVIDEO_PIXEL_FROM_RGB5(0x1f * (primary_color & 1u), 0x1f * ((primary_color >> 1u) & 1u), 0x1f * ((primary_color >> 2u) & 1u)); uint bar_width = vga_mode.width / 32; uint16_t *p = (uint16_t *) buffer->data; - int32_t color = invert ? PICO_SCANVIDEO_PIXEL_FROM_RGB8(255, 255, 255) : 0; + uint32_t invert_bits = invert ? PICO_SCANVIDEO_PIXEL_FROM_RGB5(0x1f,0x1f,0x1f) : 0; for (uint bar = 0; bar < 32; bar++) { *p++ = COMPOSABLE_COLOR_RUN; - *p++ = color; + uint32_t color = PICO_SCANVIDEO_PIXEL_FROM_RGB5(bar, bar, bar); + *p++ = (color & color_mask) ^ invert_bits; *p++ = bar_width - 3; - color += color_step; } // 32 * 3, so we should be word aligned