Skip to content

Commit b875ed7

Browse files
committed
main: update ssd1331 driver
1 parent d862bde commit b875ed7

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

main/inc/driver/ssd1331.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#include "device/spi.h"
1414

15+
#define SSD1331_SCREEN_WIDTH 96
16+
#define SSD1331_SCREEN_HEIGHT 64
17+
1518
extern void ssd1331_init_board(void);
1619
extern void ssd1331_setpin_dc(spi_transaction_t *);
1720
extern void ssd1331_setpin_reset(uint8_t rst);

main/src/driver/ssd1331.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <string.h>
99

1010
#include "device/spi.h"
11+
#include "driver/ssd1331.h"
1112

1213
#define SSD1331_GPIO_PIN_DC 23
1314
#define SSD1331_GPIO_PIN_RST 14
@@ -65,19 +66,19 @@ void ssd1331_refresh_gram(uint8_t *gram)
6566

6667
spi1_trans[0].length = 3*8;
6768
spi1_trans[0].tx_data[0] = 0x15; // Set Column Address
68-
spi1_trans[0].tx_data[1] = 0x00; // 0, startx
69-
spi1_trans[0].tx_data[2] = 0x5f; // 95, endx
69+
spi1_trans[0].tx_data[1] = 0x00; // startx
70+
spi1_trans[0].tx_data[2] = SSD1331_SCREEN_WIDTH - 1; // endx
7071
spi1_trans[0].user = (void*)0;
7172
spi1_trans[0].flags = SPI_TRANS_USE_TXDATA;
7273

7374
spi1_trans[1].length = 3*8,
7475
spi1_trans[1].tx_data[0] = 0x75; // Set Row Address
75-
spi1_trans[1].tx_data[1] = 0x00; // 0, starty
76-
spi1_trans[1].tx_data[2] = 0x3f; // 63, endy
76+
spi1_trans[1].tx_data[1] = 0x00; // starty
77+
spi1_trans[1].tx_data[2] = SSD1331_SCREEN_HEIGHT - 1; // endy
7778
spi1_trans[1].user = (void*)0;
7879
spi1_trans[1].flags = SPI_TRANS_USE_TXDATA;
7980

80-
spi1_trans[2].length = 96*64*2*8;
81+
spi1_trans[2].length = SSD1331_SCREEN_WIDTH*SSD1331_SCREEN_HEIGHT*2*8;
8182
spi1_trans[2].tx_buffer = gram;
8283
spi1_trans[2].user = (void*)1;
8384

0 commit comments

Comments
 (0)