kopia lustrzana https://github.com/hoglet67/RGBtoHDMI
Added support for manual calibration button
Change-Id: I00867668c208bea174b88650ac8fc25d7767c3edissue_1022
rodzic
097d010497
commit
2dc99dccaa
|
@ -32,6 +32,9 @@
|
|||
#define BIT_CALIBRATE 0x20
|
||||
#define BIT_INITIALIZE 0x40
|
||||
|
||||
// R0 return value bits
|
||||
#define BIT_CAL 0x02
|
||||
|
||||
#define BIT_BOTH_BUFFERS (BIT_DRAW_BUFFER | BIT_DISP_BUFFER)
|
||||
|
||||
// Define the size of the Pi Framebuffer
|
||||
|
@ -100,6 +103,7 @@
|
|||
// Quad Pixel input on GPIOs 2..13
|
||||
#define PIXEL_BASE (2)
|
||||
|
||||
#define CAL_PIN (16)
|
||||
#define PSYNC_PIN (17)
|
||||
#define CSYNC_PIN (18)
|
||||
#define MODE7_PIN (19)
|
||||
|
@ -109,6 +113,7 @@
|
|||
|
||||
#define LED_PIN (47)
|
||||
|
||||
#define CAL_MASK (1 << CAL_PIN)
|
||||
#define PSYNC_MASK (1 << PSYNC_PIN)
|
||||
#define CSYNC_MASK (1 << CSYNC_PIN)
|
||||
#define MODE7_MASK (1 << MODE7_PIN)
|
||||
|
|
|
@ -175,6 +175,9 @@ frame:
|
|||
movge r0, #1 // Mode 7
|
||||
tst r3, #BIT_PROBE
|
||||
bne exit
|
||||
tst r8, #CAL_MASK // Is the cal button pressed (active low)
|
||||
orreq r0, #BIT_CAL //
|
||||
beq exit
|
||||
tst r3, #BIT_MODE7
|
||||
moveq r5, #0 // Modes 0-6
|
||||
movne r5, #1 // Mode 7
|
||||
|
|
|
@ -463,6 +463,8 @@ void calibrate_sampling(int mode7, int chars_per_line) {
|
|||
|
||||
void rgb_to_hdmi_main() {
|
||||
int mode7;
|
||||
int last_mode7;
|
||||
int result;
|
||||
|
||||
// The divisor us now the same for both modes
|
||||
log_debug("Setting up divisor");
|
||||
|
@ -482,13 +484,22 @@ void rgb_to_hdmi_main() {
|
|||
|
||||
int chars_per_line = mode7 ? MODE7_CHARS_PER_LINE : DEFAULT_CHARS_PER_LINE;
|
||||
|
||||
do {
|
||||
|
||||
log_debug("Entering rgb_to_fb");
|
||||
result = rgb_to_fb(fb, chars_per_line, pitch, mode7);
|
||||
log_debug("Leaving rgb_to_fb, result= %d", result);
|
||||
|
||||
if (result & BIT_CAL) {
|
||||
for (int c = 0; c < NUM_CAL_PASSES; c++) {
|
||||
calibrate_sampling(mode7, chars_per_line);
|
||||
}
|
||||
}
|
||||
|
||||
log_debug("Entering rgb_to_fb %d", mode7);
|
||||
mode7 = rgb_to_fb(fb, chars_per_line, pitch, mode7);
|
||||
log_debug("Leaving rgb_to_fb %d", mode7);
|
||||
last_mode7 = mode7;
|
||||
mode7 = result & BIT_MODE7;
|
||||
|
||||
} while (mode7 == last_mode7);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue