1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 14:28:07 +00:00

fix when oled triangle is shown

This commit is contained in:
Pavol Rusnak 2017-01-19 16:16:57 +01:00
parent 3b10958113
commit 505df38a84
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
3 changed files with 7 additions and 10 deletions

View File

@ -99,11 +99,8 @@ int main(void)
timer_init();
#if DEBUG_LOG
oledSetDebug(1);
#endif
#if DEBUG_LINK
oledSetDebugLink(1);
storage_reset(); // wipe storage if debug link
storage_reset_uuid();
storage_commit();

10
oled.c
View File

@ -74,7 +74,7 @@
#define OLED_BUFTGL(X,Y) _oledbuffer[OLED_BUFSIZE - 1 - (X) - ((Y)/8)*OLED_WIDTH] ^= (1 << (7 - (Y)%8))
static uint8_t _oledbuffer[OLED_BUFSIZE];
static bool is_debug_mode = 0;
static bool is_debug_link = 0;
/*
* Send a block of data via the SPI bus.
@ -161,7 +161,7 @@ void oledRefresh()
static uint8_t s[3] = {OLED_SETLOWCOLUMN | 0x00, OLED_SETHIGHCOLUMN | 0x00, OLED_SETSTARTLINE | 0x00};
// draw triangle in upper right corner
if (is_debug_mode) {
if (is_debug_link) {
OLED_BUFTGL(OLED_WIDTH - 5, 0); OLED_BUFTGL(OLED_WIDTH - 4, 0); OLED_BUFTGL(OLED_WIDTH - 3, 0); OLED_BUFTGL(OLED_WIDTH - 2, 0); OLED_BUFTGL(OLED_WIDTH - 1, 0);
OLED_BUFTGL(OLED_WIDTH - 4, 1); OLED_BUFTGL(OLED_WIDTH - 3, 1); OLED_BUFTGL(OLED_WIDTH - 2, 1); OLED_BUFTGL(OLED_WIDTH - 1, 1);
OLED_BUFTGL(OLED_WIDTH - 3, 2); OLED_BUFTGL(OLED_WIDTH - 2, 2); OLED_BUFTGL(OLED_WIDTH - 1, 2);
@ -180,7 +180,7 @@ void oledRefresh()
gpio_clear(OLED_DC_PORT, OLED_DC_PIN); // set to CMD
// return it back
if (is_debug_mode) {
if (is_debug_link) {
OLED_BUFTGL(OLED_WIDTH - 5, 0); OLED_BUFTGL(OLED_WIDTH - 4, 0); OLED_BUFTGL(OLED_WIDTH - 3, 0); OLED_BUFTGL(OLED_WIDTH - 2, 0); OLED_BUFTGL(OLED_WIDTH - 1, 0);
OLED_BUFTGL(OLED_WIDTH - 4, 1); OLED_BUFTGL(OLED_WIDTH - 3, 1); OLED_BUFTGL(OLED_WIDTH - 2, 1); OLED_BUFTGL(OLED_WIDTH - 1, 1);
OLED_BUFTGL(OLED_WIDTH - 3, 2); OLED_BUFTGL(OLED_WIDTH - 2, 2); OLED_BUFTGL(OLED_WIDTH - 1, 2);
@ -194,9 +194,9 @@ const uint8_t *oledGetBuffer()
return _oledbuffer;
}
void oledSetDebug(bool set)
void oledSetDebugLink(bool set)
{
is_debug_mode = set;
is_debug_link = set;
oledRefresh();
}

2
oled.h
View File

@ -34,7 +34,7 @@ void oledInit(void);
void oledClear(void);
void oledRefresh(void);
void oledSetDebug(bool set);
void oledSetDebugLink(bool set);
void oledSetBuffer(uint8_t *buf);
const uint8_t *oledGetBuffer(void);
void oledDrawPixel(int x, int y);