1
0
Fork 0

more bits

sd2
radex 2024-05-24 21:27:43 +02:00
parent fe46fc625d
commit cffe7eefbf
Signed by: radex
SSH Key Fingerprint: SHA256:hvqRXAGG1h89yqnS+cyFTLKQbzjWD4uXIqw7Y+0ws30
5 changed files with 25 additions and 22 deletions

View File

@ -29,10 +29,10 @@ inline void outputEnable(uint8_t pin, bool enable) {
gpio_put(pin, !enable);
}
// we have 4-bit color depth, so 16 levels of brightness
// we go from phase 0 to phase 3
// we have COLOR_BITS-bit color depth, so 2^COLOR_BITS levels of brightness
// we go from phase 0 to phase (COLOR_BITS-1)
uint8_t brightnessPhase = 0;
uint8_t brightnessPhaseDelays[] = {1, 10, 30, 100};
uint8_t brightnessPhaseDelays[COLOR_BITS] = {0, 1, 6, 20, 60};
// NOTE: Alignment required to allow 4-byte reads
uint8_t framebuffer[ROW_COUNT * COL_COUNT] __attribute__((aligned(32))) = {0};
@ -185,7 +185,7 @@ void leds_render() {
}
// next brightness phase
brightnessPhase = (brightnessPhase + 1) % 4;
brightnessPhase = (brightnessPhase + 1) % COLOR_BITS;
}
void leds_initPusher() {

View File

@ -20,6 +20,7 @@
#define COL_MODULES 2
#define COL_COUNT COL_MODULES * 20
#define COLOR_BITS 5
#define FPS 30
#define MS_PER_FRAME 1000 / FPS

View File

@ -2,7 +2,8 @@
.side_set 1 opt
.wrap_target
public entry_point:
out null, 4 side 0 [0] ; ignore 4 least significant digits
out null, 3 side 0 [0] ; ignore least significant digits
out pins, 1 ; set bit (shifted for brightness phase by C code)
out null, 3 side 1 [1] ; ignore remaining bits, latch data, allow time for latching
out null, 4 side 1 [1] ; ignore remaining bits, latch data, allow time for latching
nop side 0 ; return to 0 (weird glitches happen otherwise)
.wrap

View File

@ -13,22 +13,23 @@
// -------------- //
#define leds_px_pusher_wrap_target 0
#define leds_px_pusher_wrap 2
#define leds_px_pusher_wrap 3
#define leds_px_pusher_offset_entry_point 0u
static const uint16_t leds_px_pusher_program_instructions[] = {
// .wrap_target
0x7064, // 0: out null, 4 side 0
0x7063, // 0: out null, 3 side 0
0x6001, // 1: out pins, 1
0x7963, // 2: out null, 3 side 1 [1]
0x7964, // 2: out null, 4 side 1 [1]
0xb042, // 3: nop side 0
// .wrap
};
#if !PICO_NO_HARDWARE
static const struct pio_program leds_px_pusher_program = {
.instructions = leds_px_pusher_program_instructions,
.length = 3,
.length = 4,
.origin = -1,
};

View File

@ -44,18 +44,18 @@ void loop() {
sd_loadNextAudio();
}
// if (Serial.available() > 0) {
// char c = Serial.read();
// if (c == 'p') {
// Serial.println("Paused. Press any key to continue.");
// leds_disable();
// while (Serial.available() == 0) {
// Serial.read();
// delay(50);
// }
// Serial.println("Continuing...");
// }
// }
if (Serial.available() > 0) {
char c = Serial.read();
if (c == 'p') {
Serial.println("Paused. Press any key to continue.");
leds_disable();
while (Serial.available() == 0) {
Serial.read();
delay(50);
}
Serial.println("Continuing...");
}
}
if (!gfx_decoder_handleLoop()) {
Serial.println("Failed to load frame...");