display: fix font bit-order (MSB=left) and remove panel mirror; rfid: probe uses HALFDUPLEX so VersionReg read is valid
This commit is contained in:
@@ -72,10 +72,10 @@ esp_err_t display_manager_init(void)
|
|||||||
ESP_ERROR_CHECK(esp_lcd_panel_reset(s_panel));
|
ESP_ERROR_CHECK(esp_lcd_panel_reset(s_panel));
|
||||||
ESP_ERROR_CHECK(esp_lcd_panel_init(s_panel));
|
ESP_ERROR_CHECK(esp_lcd_panel_init(s_panel));
|
||||||
ESP_ERROR_CHECK(esp_lcd_panel_invert_color(s_panel, true));
|
ESP_ERROR_CHECK(esp_lcd_panel_invert_color(s_panel, true));
|
||||||
/* This panel variant scans mirrored on X; flip so text reads correctly.
|
/* No panel mirror: the font bit-order fix in display_put_text already
|
||||||
* If text appears upside-down instead, use mirror(false,true); if still
|
* yields correct (non-mirrored) glyphs. Mirroring here would flip the
|
||||||
* mirrored both ways, use mirror(true,true). */
|
* whole frame and re-break the text. */
|
||||||
ESP_ERROR_CHECK(esp_lcd_panel_mirror(s_panel, true, false));
|
ESP_ERROR_CHECK(esp_lcd_panel_mirror(s_panel, false, false));
|
||||||
ESP_ERROR_CHECK(esp_lcd_panel_disp_on_off(s_panel, true));
|
ESP_ERROR_CHECK(esp_lcd_panel_disp_on_off(s_panel, true));
|
||||||
|
|
||||||
s_staging = malloc(DISP_W * sizeof(uint16_t));
|
s_staging = malloc(DISP_W * sizeof(uint16_t));
|
||||||
@@ -132,13 +132,13 @@ int display_put_text(int x, int y, const char *str, uint16_t fg, uint16_t bg)
|
|||||||
char c = *str++;
|
char c = *str++;
|
||||||
if (c >= FONT5X7_FIRST_CHAR && c <= FONT5X7_LAST_CHAR) {
|
if (c >= FONT5X7_FIRST_CHAR && c <= FONT5X7_LAST_CHAR) {
|
||||||
const uint8_t *glyph = font5x7[c - FONT5X7_FIRST_CHAR];
|
const uint8_t *glyph = font5x7[c - FONT5X7_FIRST_CHAR];
|
||||||
/* Row-major [row][col] so the linear buffer matches what
|
/* Row-major [row][col]. The font table stores each row with the
|
||||||
* esp_lcd_panel_draw_bitmap expects. */
|
* MSB as the LEFT column, so read bit (W-1-gx) for column gx. */
|
||||||
uint16_t cell[FONT5X7_H][FONT5X7_W];
|
uint16_t cell[FONT5X7_H][FONT5X7_W];
|
||||||
|
|
||||||
for (int gy = 0; gy < FONT5X7_H; gy++) {
|
for (int gy = 0; gy < FONT5X7_H; gy++) {
|
||||||
for (int gx = 0; gx < FONT5X7_W; gx++) {
|
for (int gx = 0; gx < FONT5X7_W; gx++) {
|
||||||
cell[gy][gx] = (glyph[gy] >> gx) & 1 ? fg : bg;
|
cell[gy][gx] = (glyph[gy] >> (FONT5X7_W - 1 - gx)) & 1 ? fg : bg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (x + FONT5X7_W <= DISP_W && y + FONT5X7_H <= DISP_H) {
|
if (x + FONT5X7_W <= DISP_W && y + FONT5X7_H <= DISP_H) {
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ static void rfid_probe_version(void)
|
|||||||
.command_bits = 1, /* read/write select bit */
|
.command_bits = 1, /* read/write select bit */
|
||||||
.address_bits = 6, /* register address */
|
.address_bits = 6, /* register address */
|
||||||
.dummy_bits = 1,
|
.dummy_bits = 1,
|
||||||
|
.flags = SPI_DEVICE_HALFDUPLEX, /* RX-only reads like the rc522 driver */
|
||||||
};
|
};
|
||||||
if (spi_bus_add_device(HW_RFID_SPI_HOST, &devcfg, &probe) != ESP_OK || probe == NULL) {
|
if (spi_bus_add_device(HW_RFID_SPI_HOST, &devcfg, &probe) != ESP_OK || probe == NULL) {
|
||||||
ESP_LOGW(TAG, "probe: could not add temp SPI device on SPI3");
|
ESP_LOGW(TAG, "probe: could not add temp SPI device on SPI3");
|
||||||
|
|||||||
Reference in New Issue
Block a user