1
0
Fork 0

Compare commits

...

5 Commits

Author SHA1 Message Date
radex 58b6faa48a
pcb: mux design 2024-04-06 22:22:09 +02:00
radex 899bf5ee78
uart debug, apply more gamma, parallel processing 2024-03-29 00:03:39 +01:00
radex 953971f4ed
Revert "led characterization board test firmware"
This reverts commit bd8335af06.
2024-03-28 22:38:10 +01:00
radex bd8335af06
led characterization board test firmware 2024-03-28 22:38:06 +01:00
radex 2d09dc59ae
update errata 2024-03-28 22:28:49 +01:00
5 changed files with 39196 additions and 10344 deletions

View File

@ -4,7 +4,9 @@
#include "pico/multicore.h"
#include "mbed_wait_api.h"
#define COL_SER 0
#define Serial Serial1
#define COL_SER 2
#define COL_OE 26
#define COL_RCLK 27
#define COL_SRCLK 28
@ -38,20 +40,20 @@ inline void outputEnable(uint8_t pin, bool enable) {
#define MS_PER_FRAME 1000 / FPS
uint16_t frameIndex = 0;
uint16_t lastDecodedFrame = 0;
uint16_t lastRenderedFrameIndex = 0;
unsigned long frameLastChangedAt;
// we have 4-bit color depth, so 16 levels of brightness
// we go from phase 0 to phase 3
uint8_t brightnessPhase = 0;
uint8_t brightnessPhaseDelays[] = {10, 30, 80, 200};
uint8_t brightnessPhaseDelays[] = {2, 20, 60, 200};
uint8_t framebuffer[ROW_COUNT * COL_COUNT] = {0};
void main2();
void setup() {
Serial.begin(9600);
Serial.println("Hello");
Serial.begin(115200);
Serial.println("Hello worldd!");
memset(framebuffer, 0, sizeof(framebuffer));
@ -121,46 +123,25 @@ void loop() {
if (multicore_fifo_rvalid()) {
uint32_t value = multicore_fifo_pop_blocking();
// Serial.print("Core 1 says: ");
// Serial.println(value);
if (value == 21372137) {
Serial.println("Invalid frame size");
} else {
Serial.print("PNG decode error ");
Serial.print(value);
Serial.print(": ");
Serial.println(lodepng_error_text(value));
}
}
if (frameIndex != lastRenderedFrameIndex) {
Serial.print("Going to frame ");
Serial.println(frameIndex);
lastRenderedFrameIndex = frameIndex;
}
// hide output
outputEnable(ROW_OE, false);
// decode png
if (lastDecodedFrame != frameIndex) {
lastDecodedFrame = frameIndex;
unsigned error;
unsigned char *buffer = 0;
unsigned width, height;
const uint8_t *png = png_frames[frameIndex];
size_t pngSize = png_frame_sizes[frameIndex];
error = lodepng_decode_memory(&buffer, &width, &height, png, pngSize, LCT_GREY, 8);
if (error) {
Serial.print("PNG decode error ");
Serial.print(error);
Serial.print(": ");
Serial.println(lodepng_error_text(error));
return;
} else if (width != COL_COUNT || height != ROW_COUNT) {
Serial.println("Invalid frame size");
return;
}
// copy to framebuffer
// TODO: learn to use memcpy lmao
for (int y = ROW_COUNT - 1; y >= 0; y--) {
for (int x = 0; x < COL_COUNT; x++) {
framebuffer[y * COL_COUNT + x] = buffer[(ROW_COUNT - 1 - y) * COL_COUNT + x];
}
}
free(buffer);
}
// clear columns
clearShiftReg(COL_SRCLK, COL_SRCLR);
@ -212,26 +193,44 @@ void loop() {
// next brightness phase
brightnessPhase = (brightnessPhase + 1) % 4;
// next frame
if (millis() - frameLastChangedAt > MS_PER_FRAME) {
frameLastChangedAt = millis();
frameIndex++;
Serial.print("Going to frame ");
Serial.println(frameIndex);
if (frameIndex == PNG_COUNT) {
frameIndex = 0;
Serial.println("Loop over!");
}
}
}
uint32_t counter = 0;
void loop2() {
counter += 1;
if (multicore_fifo_wready()) {
multicore_fifo_push_blocking(counter);
unsigned error;
unsigned char *buffer = 0;
unsigned width, height;
// decode png
const uint8_t *png = png_frames[frameIndex];
size_t pngSize = png_frame_sizes[frameIndex];
error = lodepng_decode_memory(&buffer, &width, &height, png, pngSize, LCT_GREY, 8);
// push errors onto queue to be reported on core0, can't use serial here
if (error) {
free(buffer);
multicore_fifo_push_blocking(error);
return;
} else if (width != COL_COUNT || height != ROW_COUNT) {
free(buffer);
multicore_fifo_push_blocking(21372137);
return;
}
busy_wait_us(500000);
// copy to framebuffer
// TODO: mutex? double buffer? or something...
// TODO: learn to use memcpy lmao
for (int y = ROW_COUNT - 1; y >= 0; y--) {
for (int x = 0; x < COL_COUNT; x++) {
framebuffer[y * COL_COUNT + x] = buffer[(ROW_COUNT - 1 - y) * COL_COUNT + x];
}
}
free(buffer);
// wait until next frame
// TODO: measure time to decode png
busy_wait_ms(MS_PER_FRAME);
frameIndex = (frameIndex + 1) % PNG_COUNT;
}

View File

@ -4,6 +4,10 @@
## Errata
Rev A:
### Rev A
I'm an idiot and somehow managed to switch polarity of LEDs. Rows were supposed to be cathodes, and columns anodes, but it's the other way around. Fixable by a 90° rotation, albeit with less than ideal trace layout. Oh well.
1. I'm an idiot and somehow managed to switch polarity of LEDs. Rows were supposed to be cathodes, and columns anodes, but it's the other way around. Fixable by a 90° rotation, albeit with less than ideal trace layout. Oh well.
2. The notes about the XL-1608SURC-06 LED are incorrect, and were in fact taken from XL-1608SURC-04's data sheet. The correct info is:
- Forward voltage: 1.9-2.3V (at 20mA)
- Max peak forward current: 80mA
- Max continuous forward current: 20mA

File diff suppressed because it is too large Load Diff

View File

@ -115,9 +115,9 @@
},
"rules": {
"max_error": 0.005,
"min_clearance": 0.0,
"min_clearance": 0.16999999999999998,
"min_connection": 0.0,
"min_copper_edge_clearance": 0.5,
"min_copper_edge_clearance": 0.39999999999999997,
"min_hole_clearance": 0.25,
"min_hole_to_hole": 0.25,
"min_microvia_diameter": 0.19999999999999998,
@ -125,12 +125,12 @@
"min_resolved_spokes": 2,
"min_silk_clearance": 0.0,
"min_text_height": 0.7999999999999999,
"min_text_thickness": 0.08,
"min_text_thickness": 0.09999999999999999,
"min_through_hole_diameter": 0.3,
"min_track_width": 0.0,
"min_via_annular_width": 0.09999999999999999,
"min_via_diameter": 0.5,
"solder_mask_to_copper_clearance": 0.0,
"solder_mask_to_copper_clearance": 0.005,
"use_height_for_length_calcs": true
},
"teardrop_options": [
@ -215,10 +215,6 @@
"diameter": 0.0,
"drill": 0.0
},
{
"diameter": 0.5,
"drill": 0.3
},
{
"diameter": 0.6,
"drill": 0.3
@ -482,6 +478,40 @@
"via_drill": 0.3,
"wire_width": 6
},
{
"bus_width": 12,
"clearance": 0.2,
"diff_pair_gap": 0.25,
"diff_pair_via_gap": 0.25,
"diff_pair_width": 0.2,
"line_style": 0,
"microvia_diameter": 0.3,
"microvia_drill": 0.1,
"name": "Column Output",
"pcb_color": "rgb(255, 0, 32)",
"schematic_color": "rgb(255, 9, 55)",
"track_width": 0.35,
"via_diameter": 0.6,
"via_drill": 0.3,
"wire_width": 6
},
{
"bus_width": 12,
"clearance": 0.2,
"diff_pair_gap": 0.25,
"diff_pair_via_gap": 0.25,
"diff_pair_width": 0.2,
"line_style": 0,
"microvia_diameter": 0.3,
"microvia_drill": 0.1,
"name": "Parallel Output",
"pcb_color": "rgb(206, 3, 255)",
"schematic_color": "rgb(250, 12, 255)",
"track_width": 0.18,
"via_diameter": 0.6,
"via_drill": 0.3,
"wire_width": 6
},
{
"bus_width": 12,
"clearance": 0.2,
@ -509,6 +539,14 @@
{
"netclass": "Row Output",
"pattern": "/ROW_*"
},
{
"netclass": "Column Output",
"pattern": "/COL_*"
},
{
"netclass": "Parallel Output",
"pattern": "/P*"
}
]
},
@ -594,7 +632,7 @@
"group_by": false,
"label": "LCSC",
"name": "LCSC",
"show": false
"show": true
},
{
"group_by": false,

File diff suppressed because it is too large Load Diff