mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-25 15:58:08 +00:00
emulator: Show DEBUG_LINK indicator
This commit is contained in:
parent
644907e160
commit
17340c2396
@ -58,6 +58,9 @@ void oledInit(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void oledRefresh(void) {
|
void oledRefresh(void) {
|
||||||
|
/* Draw triangle in upper right corner */
|
||||||
|
oledInvertDebugLink();
|
||||||
|
|
||||||
const uint8_t *buffer = oledGetBuffer();
|
const uint8_t *buffer = oledGetBuffer();
|
||||||
|
|
||||||
static uint32_t data[OLED_HEIGHT][OLED_WIDTH];
|
static uint32_t data[OLED_HEIGHT][OLED_WIDTH];
|
||||||
@ -75,6 +78,9 @@ void oledRefresh(void) {
|
|||||||
SDL_UpdateTexture(texture, NULL, data, OLED_WIDTH * sizeof(uint32_t));
|
SDL_UpdateTexture(texture, NULL, data, OLED_WIDTH * sizeof(uint32_t));
|
||||||
SDL_RenderCopy(renderer, texture, NULL, NULL);
|
SDL_RenderCopy(renderer, texture, NULL, NULL);
|
||||||
SDL_RenderPresent(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
|
|
||||||
|
/* Return it back */
|
||||||
|
oledInvertDebugLink();
|
||||||
}
|
}
|
||||||
|
|
||||||
void emulatorPoll(void) {
|
void emulatorPoll(void) {
|
||||||
|
27
oled.c
27
oled.c
@ -180,6 +180,17 @@ void oledClear()
|
|||||||
memset(_oledbuffer, 0, sizeof(_oledbuffer));
|
memset(_oledbuffer, 0, sizeof(_oledbuffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void oledInvertDebugLink()
|
||||||
|
{
|
||||||
|
if (is_debug_link) {
|
||||||
|
oledInvertPixel(OLED_WIDTH - 5, 0); oledInvertPixel(OLED_WIDTH - 4, 0); oledInvertPixel(OLED_WIDTH - 3, 0); oledInvertPixel(OLED_WIDTH - 2, 0); oledInvertPixel(OLED_WIDTH - 1, 0);
|
||||||
|
oledInvertPixel(OLED_WIDTH - 4, 1); oledInvertPixel(OLED_WIDTH - 3, 1); oledInvertPixel(OLED_WIDTH - 2, 1); oledInvertPixel(OLED_WIDTH - 1, 1);
|
||||||
|
oledInvertPixel(OLED_WIDTH - 3, 2); oledInvertPixel(OLED_WIDTH - 2, 2); oledInvertPixel(OLED_WIDTH - 1, 2);
|
||||||
|
oledInvertPixel(OLED_WIDTH - 2, 3); oledInvertPixel(OLED_WIDTH - 1, 3);
|
||||||
|
oledInvertPixel(OLED_WIDTH - 1, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Refresh the display. This copies the buffer to the display to show the
|
* Refresh the display. This copies the buffer to the display to show the
|
||||||
* contents. This must be called after every operation to the buffer to
|
* contents. This must be called after every operation to the buffer to
|
||||||
@ -192,13 +203,7 @@ void oledRefresh()
|
|||||||
static const uint8_t s[3] = {OLED_SETLOWCOLUMN | 0x00, OLED_SETHIGHCOLUMN | 0x00, OLED_SETSTARTLINE | 0x00};
|
static const uint8_t s[3] = {OLED_SETLOWCOLUMN | 0x00, OLED_SETHIGHCOLUMN | 0x00, OLED_SETSTARTLINE | 0x00};
|
||||||
|
|
||||||
// draw triangle in upper right corner
|
// draw triangle in upper right corner
|
||||||
if (is_debug_link) {
|
oledInvertDebugLink();
|
||||||
oledInvertPixel(OLED_WIDTH - 5, 0); oledInvertPixel(OLED_WIDTH - 4, 0); oledInvertPixel(OLED_WIDTH - 3, 0); oledInvertPixel(OLED_WIDTH - 2, 0); oledInvertPixel(OLED_WIDTH - 1, 0);
|
|
||||||
oledInvertPixel(OLED_WIDTH - 4, 1); oledInvertPixel(OLED_WIDTH - 3, 1); oledInvertPixel(OLED_WIDTH - 2, 1); oledInvertPixel(OLED_WIDTH - 1, 1);
|
|
||||||
oledInvertPixel(OLED_WIDTH - 3, 2); oledInvertPixel(OLED_WIDTH - 2, 2); oledInvertPixel(OLED_WIDTH - 1, 2);
|
|
||||||
oledInvertPixel(OLED_WIDTH - 2, 3); oledInvertPixel(OLED_WIDTH - 1, 3);
|
|
||||||
oledInvertPixel(OLED_WIDTH - 1, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
gpio_clear(OLED_CS_PORT, OLED_CS_PIN); // SPI select
|
gpio_clear(OLED_CS_PORT, OLED_CS_PIN); // SPI select
|
||||||
SPISend(SPI_BASE, s, 3);
|
SPISend(SPI_BASE, s, 3);
|
||||||
@ -211,13 +216,7 @@ void oledRefresh()
|
|||||||
gpio_clear(OLED_DC_PORT, OLED_DC_PIN); // set to CMD
|
gpio_clear(OLED_DC_PORT, OLED_DC_PIN); // set to CMD
|
||||||
|
|
||||||
// return it back
|
// return it back
|
||||||
if (is_debug_link) {
|
oledInvertDebugLink();
|
||||||
oledInvertPixel(OLED_WIDTH - 5, 0); oledInvertPixel(OLED_WIDTH - 4, 0); oledInvertPixel(OLED_WIDTH - 3, 0); oledInvertPixel(OLED_WIDTH - 2, 0); oledInvertPixel(OLED_WIDTH - 1, 0);
|
|
||||||
oledInvertPixel(OLED_WIDTH - 4, 1); oledInvertPixel(OLED_WIDTH - 3, 1); oledInvertPixel(OLED_WIDTH - 2, 1); oledInvertPixel(OLED_WIDTH - 1, 1);
|
|
||||||
oledInvertPixel(OLED_WIDTH - 3, 2); oledInvertPixel(OLED_WIDTH - 2, 2); oledInvertPixel(OLED_WIDTH - 1, 2);
|
|
||||||
oledInvertPixel(OLED_WIDTH - 2, 3); oledInvertPixel(OLED_WIDTH - 1, 3);
|
|
||||||
oledInvertPixel(OLED_WIDTH - 1, 4);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
2
oled.h
2
oled.h
@ -35,6 +35,8 @@ void oledClear(void);
|
|||||||
void oledRefresh(void);
|
void oledRefresh(void);
|
||||||
|
|
||||||
void oledSetDebugLink(bool set);
|
void oledSetDebugLink(bool set);
|
||||||
|
void oledInvertDebugLink(void);
|
||||||
|
|
||||||
void oledSetBuffer(uint8_t *buf);
|
void oledSetBuffer(uint8_t *buf);
|
||||||
const uint8_t *oledGetBuffer(void);
|
const uint8_t *oledGetBuffer(void);
|
||||||
void oledDrawPixel(int x, int y);
|
void oledDrawPixel(int x, int y);
|
||||||
|
Loading…
Reference in New Issue
Block a user