fix case of PICO_SCANVIDEO_48MHZ and fix test_pattern for lower bit depths

pull/26/head
graham sanderson 2022-05-17 16:03:20 -05:00
rodzic e551a2d760
commit f0ce80c9d2
8 zmienionych plików z 20 dodań i 11 usunięć

Wyświetl plik

@ -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)

Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

@ -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();

Wyświetl plik

@ -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();

Wyświetl plik

@ -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

Wyświetl plik

@ -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);

Wyświetl plik

@ -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