kopia lustrzana https://github.com/raspberrypi/pico-playground
fix case of PICO_SCANVIDEO_48MHZ and fix test_pattern for lower bit depths
rodzic
e551a2d760
commit
f0ce80c9d2
|
@ -14,6 +14,11 @@ if (TARGET pico_audio_i2s)
|
||||||
PICO_AUDIO_I2S_MONO_INPUT=1
|
PICO_AUDIO_I2S_MONO_INPUT=1
|
||||||
#define for our example code
|
#define for our example code
|
||||||
USE_AUDIO_I2S=1
|
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.
|
# create map/bin/hex file etc.
|
||||||
pico_add_extra_outputs(sine_wave_i2s)
|
pico_add_extra_outputs(sine_wave_i2s)
|
||||||
|
|
|
@ -20,6 +20,11 @@
|
||||||
|
|
||||||
#include "pico/audio_i2s.h"
|
#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
|
#elif USE_AUDIO_PWM
|
||||||
#include "pico/audio_pwm.h"
|
#include "pico/audio_pwm.h"
|
||||||
#elif USE_AUDIO_SPDIF
|
#elif USE_AUDIO_SPDIF
|
||||||
|
|
|
@ -602,7 +602,7 @@ int main(void) {
|
||||||
|
|
||||||
gpio_put(27, 0);
|
gpio_put(27, 0);
|
||||||
#if PICO_ON_DEVICE && !PICO_ON_FPGA
|
#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 to double frequency 48Mhz for some examples which were written for a higher clock speed */
|
||||||
set_sys_clock_khz(96000, true);
|
set_sys_clock_khz(96000, true);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -572,7 +572,7 @@ void go_core1(void (*execute)()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
#if PICO_SCANVIDEO_48MHz
|
#if PICO_SCANVIDEO_48MHZ
|
||||||
set_sys_clock_48mhz();
|
set_sys_clock_48mhz();
|
||||||
#endif
|
#endif
|
||||||
setup_default_uart();
|
setup_default_uart();
|
||||||
|
|
|
@ -665,7 +665,7 @@ void go_core1(void (*execute)()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
#if PICO_SCANVIDEO_48MHz
|
#if PICO_SCANVIDEO_48MHZ
|
||||||
set_sys_clock_48mhz();
|
set_sys_clock_48mhz();
|
||||||
#endif
|
#endif
|
||||||
setup_default_uart();
|
setup_default_uart();
|
||||||
|
|
|
@ -104,7 +104,7 @@ void render_scanline(struct scanvideo_scanline_buffer *dest, int core) {
|
||||||
|
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
#if PICO_SCANVIDEO_48MHz
|
#if PICO_SCANVIDEO_48MHZ
|
||||||
set_sys_clock_48mhz();
|
set_sys_clock_48mhz();
|
||||||
#endif
|
#endif
|
||||||
// Re init uart now that clk_peri has changed
|
// Re init uart now that clk_peri has changed
|
||||||
|
|
|
@ -176,7 +176,7 @@ int main(void) {
|
||||||
sleep_ms(10);
|
sleep_ms(10);
|
||||||
set_sys_clock_khz(400000, true);
|
set_sys_clock_khz(400000, true);
|
||||||
#else
|
#else
|
||||||
#if PICO_SCANVIDEO_48MHz
|
#if PICO_SCANVIDEO_48MHZ
|
||||||
set_sys_clock_khz(192000, true);
|
set_sys_clock_khz(192000, true);
|
||||||
#else
|
#else
|
||||||
set_sys_clock_khz(200000, true);
|
set_sys_clock_khz(200000, true);
|
||||||
|
|
|
@ -58,19 +58,18 @@ int main(void) {
|
||||||
void draw_color_bar(scanvideo_scanline_buffer_t *buffer) {
|
void draw_color_bar(scanvideo_scanline_buffer_t *buffer) {
|
||||||
// figure out 1/32 of the color value
|
// figure out 1/32 of the color value
|
||||||
uint line_num = scanvideo_scanline_number(buffer->scanline_id);
|
uint line_num = scanvideo_scanline_number(buffer->scanline_id);
|
||||||
int32_t color_step = 1 + (line_num * 7 / vga_mode.height);
|
uint32_t primary_color = 1u + (line_num * 7 / vga_mode.height);
|
||||||
color_step = PICO_SCANVIDEO_PIXEL_FROM_RGB5(color_step & 1u, (color_step >> 1u) & 1u, (color_step >> 2u) & 1u);
|
uint32_t color_mask = PICO_SCANVIDEO_PIXEL_FROM_RGB5(0x1f * (primary_color & 1u), 0x1f * ((primary_color >> 1u) & 1u), 0x1f * ((primary_color >> 2u) & 1u));
|
||||||
if (invert) color_step = -color_step;
|
|
||||||
uint bar_width = vga_mode.width / 32;
|
uint bar_width = vga_mode.width / 32;
|
||||||
|
|
||||||
uint16_t *p = (uint16_t *) buffer->data;
|
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++) {
|
for (uint bar = 0; bar < 32; bar++) {
|
||||||
*p++ = COMPOSABLE_COLOR_RUN;
|
*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;
|
*p++ = bar_width - 3;
|
||||||
color += color_step;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 32 * 3, so we should be word aligned
|
// 32 * 3, so we should be word aligned
|
||||||
|
|
Ładowanie…
Reference in New Issue