Added support for manual calibration button

Change-Id: I00867668c208bea174b88650ac8fc25d7767c3ed
issue_1022
David Banks 2017-05-28 12:09:58 +01:00
rodzic 097d010497
commit 2dc99dccaa
4 zmienionych plików z 27 dodań i 8 usunięć

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

@ -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");
@ -481,14 +483,23 @@ void rgb_to_hdmi_main() {
log_debug("Done setting up frame buffer");
int chars_per_line = mode7 ? MODE7_CHARS_PER_LINE : DEFAULT_CHARS_PER_LINE;
do {
for (int c = 0; c < NUM_CAL_PASSES; c++) {
calibrate_sampling(mode7, chars_per_line);
}
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);
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);
if (result & BIT_CAL) {
for (int c = 0; c < NUM_CAL_PASSES; c++) {
calibrate_sampling(mode7, chars_per_line);
}
}
last_mode7 = mode7;
mode7 = result & BIT_MODE7;
} while (mode7 == last_mode7);
}
}

Wyświetl plik

@ -16,8 +16,8 @@ NET "SW" LOC = "P18"; # input
NET "mode7" LOC = "P19"; # input
NET "sp_clk" LOC = "P1"; # input
NET "sp_data" LOC = "P2"; # input
NET "SWout" LOC = "P3"; # output
NET "test" LOC = "P40"; # output
NET "SWout" LOC = "P3"; # output
NET "test" LOC = "P40"; # output
NET "quad(0)" LOC = "P37"; # output
NET "quad(1)" LOC = "P36"; # output