aboutsummaryrefslogtreecommitdiff
path: root/keyboards/ergodox_infinity/board_st7565.h
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/ergodox_infinity/board_st7565.h')
-rw-r--r--keyboards/ergodox_infinity/board_st7565.h96
1 files changed, 0 insertions, 96 deletions
diff --git a/keyboards/ergodox_infinity/board_st7565.h b/keyboards/ergodox_infinity/board_st7565.h
deleted file mode 100644
index 875ed9e65..000000000
--- a/keyboards/ergodox_infinity/board_st7565.h
+++ /dev/null
@@ -1,96 +0,0 @@
1/*
2 * This file is subject to the terms of the GFX License. If a copy of
3 * the license was not distributed with this file, you can obtain one at:
4 *
5 * http://ugfx.org/license.html
6 */
7
8#ifndef _GDISP_LLD_BOARD_H
9#define _GDISP_LLD_BOARD_H
10
11#include "quantum.h"
12
13#define ST7565_LCD_BIAS ST7565_LCD_BIAS_7
14#define ST7565_COM_SCAN ST7565_COM_SCAN_DEC
15#define ST7565_PAGE_ORDER 0, 1, 2, 3
16/*
17 * Custom page order for several LCD boards, e.g. HEM12864-99
18 * #define ST7565_PAGE_ORDER 4,5,6,7,0,1,2,3
19 */
20
21#define ST7565_A0_PIN C7
22#define ST7565_RST_PIN C8
23#define ST7565_MOSI_PIN C6
24#define ST7565_SCLK_PIN C5
25#define ST7565_SS_PIN C4
26
27// DSPI Clock and Transfer Attributes
28// Frame Size: 8 bits
29// MSB First
30// CLK Low by default
31static const SPIConfig spi1config = {
32 // Operation complete callback or @p NULL.
33 .end_cb = NULL,
34 // The chip select line port - when not using pcs.
35 .ssport = PAL_PORT(ST7565_SS_PIN),
36 // brief The chip select line pad number - when not using pcs.
37 .sspad = PAL_PAD(ST7565_SS_PIN),
38 // SPI initialization data.
39 .tar0 = SPIx_CTARn_FMSZ(7) // Frame size = 8 bytes
40 | SPIx_CTARn_ASC(1) // After SCK Delay Scaler (min 50 ns) = 55.56ns
41 | SPIx_CTARn_DT(0) // Delay After Transfer Scaler (no minimum)= 27.78ns
42 | SPIx_CTARn_CSSCK(0) // PCS to SCK Delay Scaler (min 20 ns) = 27.78ns
43 | SPIx_CTARn_PBR(0) // Baud Rate Prescaler = 2
44 | SPIx_CTARn_BR(0) // Baud rate (min 50ns) = 55.56ns
45};
46
47static GFXINLINE void acquire_bus(GDisplay *g) {
48 (void)g;
49 // Only the LCD is using the SPI bus, so no need to acquire
50 // spiAcquireBus(&SPID1);
51 spiSelect(&SPID1);
52}
53
54static GFXINLINE void release_bus(GDisplay *g) {
55 (void)g;
56 // Only the LCD is using the SPI bus, so no need to release
57 // spiReleaseBus(&SPID1);
58 spiUnselect(&SPID1);
59}
60
61static GFXINLINE void init_board(GDisplay *g) {
62 (void)g;
63 setPinOutput(ST7565_A0_PIN);
64 writePinHigh(ST7565_A0_PIN);
65 setPinOutput(ST7565_RST_PIN);
66 writePinHigh(ST7565_RST_PIN);
67 setPinOutput(ST7565_SS_PIN);
68
69 palSetPadMode(PAL_PORT(ST7565_MOSI_PIN), PAL_PAD(ST7565_MOSI_PIN), PAL_MODE_ALTERNATIVE_2);
70 palSetPadMode(PAL_PORT(ST7565_SCLK_PIN), PAL_PAD(ST7565_SCLK_PIN), PAL_MODE_ALTERNATIVE_2);
71
72 spiInit();
73 spiStart(&SPID1, &spi1config);
74 release_bus(g);
75}
76
77static GFXINLINE void post_init_board(GDisplay *g) { (void)g; }
78
79static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
80 (void)g;
81 writePin(ST7565_RST_PIN, !state);
82}
83
84static GFXINLINE void write_cmd(GDisplay *g, gU8 cmd) {
85 (void)g;
86 writePinLow(ST7565_A0_PIN);
87 spiSend(&SPID1, 1, &cmd);
88}
89
90static GFXINLINE void write_data(GDisplay *g, gU8 *data, gU16 length) {
91 (void)g;
92 writePinHigh(ST7565_A0_PIN);
93 spiSend(&SPID1, length, data);
94}
95
96#endif /* _GDISP_LLD_BOARD_H */