Skip to content

Commit

Permalink
Merge commit 'c21d5a09735e84412ee5b3efb4c3f5d3fc734393' into blitzwol…
Browse files Browse the repository at this point in the history
…f_kb1
  • Loading branch information
IslamAlam committed Jan 16, 2021
2 parents 0d44035 + c21d5a0 commit f942bf0
Show file tree
Hide file tree
Showing 234 changed files with 13,338 additions and 1,044 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/develop_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,15 @@ jobs:
git checkout develop
- name: Check if branch locked
run: |
test -e .locked || exit 1
id: check_locked
uses: andstor/file-existence-action@v1
with:
files: ".locked"

- name: Update develop from master
if: steps.check_locked.outputs.files_exists == 'false'
run: |
git config --global user.name "QMK Bot"
git config --global user.email "hello@qmk.fm"
git merge origin/master
git push origin develop
9 changes: 6 additions & 3 deletions docs/newbs_getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,12 @@ After Homebrew is installed run this command:

You will need to install Git and Python. It's very likely that you already have both, but if not, one of the following commands should install them:

* Debian / Ubuntu / Devuan: `sudo apt install git python3 python3-pip`
* Fedora / Red Hat / CentOS: `sudo yum install git python3 python3-pip`
* Arch / Manjaro: `sudo pacman -S git python python-pip python-setuptools libffi`
* Debian / Ubuntu / Devuan: `sudo apt install -y git python3-pip`
* Fedora / Red Hat / CentOS: `sudo yum -y install git python3-pip`
* Arch / Manjaro: `sudo pacman --needed --noconfirm -S git python-pip libffi`
* Void: `sudo xbps-install -y git python3-pip`
* Solus: `sudo eopkg -y install git python3`
* Sabayon: `sudo equo install dev-vcs/git dev-python/pip`

Install the global CLI to bootstrap your system:

Expand Down
58 changes: 26 additions & 32 deletions drivers/ugfx/gdisp/st7565/board_st7565_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,22 @@
#ifndef _GDISP_LLD_BOARD_H
#define _GDISP_LLD_BOARD_H

#define ST7565_LCD_BIAS ST7565_LCD_BIAS_9 // actually 6
#define ST7565_ADC ST7565_ADC_NORMAL
#include "quantum.h"

#define ST7565_LCD_BIAS ST7565_LCD_BIAS_7
#define ST7565_COM_SCAN ST7565_COM_SCAN_DEC
#define ST7565_PAGE_ORDER 0, 1, 2, 3
/*
* Custom page order for several LCD boards, e.g. HEM12864-99
* #define ST7565_PAGE_ORDER 4,5,6,7,0,1,2,3
*/

#define ST7565_GPIOPORT GPIOC
#define ST7565_PORT PORTC
#define ST7565_A0_PIN 7
#define ST7565_RST_PIN 8
#define ST7565_MOSI_PIN 6
#define ST7565_SLCK_PIN 5
#define ST7565_SS_PIN 4

#define palSetPadModeRaw(portname, bits) ST7565_PORT->PCR[ST7565_##portname##_PIN] = bits
#define ST7565_A0_PIN C7
#define ST7565_RST_PIN C8
#define ST7565_MOSI_PIN C6
#define ST7565_SCLK_PIN C5
#define ST7565_SS_PIN C4

#define palSetPadModeNamed(portname, portmode) palSetPadMode(ST7565_GPIOPORT, ST7565_##portname##_PIN, portmode)

#define ST7565_SPI_MODE PORTx_PCRn_DSE | PORTx_PCRn_MUX(2)
// DSPI Clock and Transfer Attributes
// Frame Size: 8 bits
// MSB First
Expand All @@ -38,9 +32,9 @@ static const SPIConfig spi1config = {
// Operation complete callback or @p NULL.
.end_cb = NULL,
// The chip select line port - when not using pcs.
.ssport = ST7565_GPIOPORT,
.ssport = PAL_PORT(ST7565_SS_PIN),
// brief The chip select line pad number - when not using pcs.
.sspad = ST7565_SS_PIN,
.sspad = PAL_PAD(ST7565_SS_PIN),
// SPI initialization data.
.tar0 = SPIx_CTARn_FMSZ(7) // Frame size = 8 bytes
| SPIx_CTARn_ASC(1) // After SCK Delay Scaler (min 50 ns) = 55.56ns
Expand All @@ -66,13 +60,14 @@ static GFXINLINE void release_bus(GDisplay *g) {

static GFXINLINE void init_board(GDisplay *g) {
(void)g;
palSetPadModeNamed(A0, PAL_MODE_OUTPUT_PUSHPULL);
palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN);
palSetPadModeNamed(RST, PAL_MODE_OUTPUT_PUSHPULL);
palSetPad(ST7565_GPIOPORT, ST7565_RST_PIN);
palSetPadModeRaw(MOSI, ST7565_SPI_MODE);
palSetPadModeRaw(SLCK, ST7565_SPI_MODE);
palSetPadModeNamed(SS, PAL_MODE_OUTPUT_PUSHPULL);
setPinOutput(ST7565_A0_PIN);
writePinHigh(ST7565_A0_PIN);
setPinOutput(ST7565_RST_PIN);
writePinHigh(ST7565_RST_PIN);
setPinOutput(ST7565_SS_PIN);

palSetPadMode(PAL_PORT(ST7565_MOSI_PIN), PAL_PAD(ST7565_MOSI_PIN), PAL_MODE_ALTERNATIVE_2);
palSetPadMode(PAL_PORT(ST7565_SCLK_PIN), PAL_PAD(ST7565_SCLK_PIN), PAL_MODE_ALTERNATIVE_2);

spiInit();
spiStart(&SPID1, &spi1config);
Expand All @@ -83,19 +78,18 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void)g; }

static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
(void)g;
if (state) {
palClearPad(ST7565_GPIOPORT, ST7565_RST_PIN);
} else {
palSetPad(ST7565_GPIOPORT, ST7565_RST_PIN);
}
writePin(ST7565_RST_PIN, !state);
}

static GFXINLINE void enter_data_mode(GDisplay *g) { palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN); }

static GFXINLINE void enter_cmd_mode(GDisplay *g) { palClearPad(ST7565_GPIOPORT, ST7565_A0_PIN); }
static GFXINLINE void write_cmd(GDisplay *g, gU8 cmd) {
(void)g;
writePinLow(ST7565_A0_PIN);
spiSend(&SPID1, 1, &cmd);
}

static GFXINLINE void write_data(GDisplay *g, uint8_t *data, uint16_t length) {
static GFXINLINE void write_data(GDisplay *g, gU8 *data, gU16 length) {
(void)g;
writePinHigh(ST7565_A0_PIN);
spiSend(&SPID1, length, data);
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/ugfx/gdisp/st7565/driver.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
GFXINC += drivers/ugfx/gdisp/st7565
GFXSRC += drivers/ugfx/gdisp/st7565/gdisp_lld_ST7565.c
GDISP_DRIVER_LIST += GDISPVMT_ST7565_QMK
GDISP_DRIVER_LIST += GDISPVMT_ST7565_QMK
76 changes: 29 additions & 47 deletions drivers/ugfx/gdisp/st7565/gdisp_lld_ST7565.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,31 +49,15 @@
# define ST7565_COM_SCAN ST7565_COM_SCAN_INC
# endif
# ifndef ST7565_PAGE_ORDER
# define ST7565_PAGE_ORDER 0, 1, 2, 3
# define ST7565_PAGE_ORDER 0, 1, 2, 3, 4, 5, 6, 7
# endif

/*===========================================================================*/
/* Driver local functions. */
/*===========================================================================*/

typedef struct {
bool_t buffer2;
uint8_t data_pos;
uint8_t data[16];
uint8_t ram[GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH / 8];
} PrivData;

// Some common routines and macros
# define PRIV(g) ((PrivData *)g->priv)
# define RAM(g) (PRIV(g)->ram)

static GFXINLINE void write_cmd(GDisplay *g, uint8_t cmd) { PRIV(g)->data[PRIV(g)->data_pos++] = cmd; }

static GFXINLINE void flush_cmd(GDisplay *g) {
write_data(g, PRIV(g)->data, PRIV(g)->data_pos);
PRIV(g)->data_pos = 0;
}

# define RAM(g) ((gU8 *)g->priv)
# define write_cmd2(g, cmd1, cmd2) \
{ \
write_cmd(g, cmd1); \
Expand Down Expand Up @@ -106,9 +90,10 @@ static GFXINLINE void flush_cmd(GDisplay *g) {

LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
// The private area is the display surface.
g->priv = gfxAlloc(sizeof(PrivData));
PRIV(g)->buffer2 = false;
PRIV(g)->data_pos = 0;
g->priv = gfxAlloc(GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH / 8);
if (!g->priv) {
return gFalse;
}

// Initialise the board interface
init_board(g);
Expand All @@ -119,25 +104,33 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
setpin_reset(g, FALSE);
gfxSleepMilliseconds(20);
acquire_bus(g);
enter_cmd_mode(g);

write_cmd(g, ST7565_RESET);
write_cmd(g, ST7565_LCD_BIAS);
write_cmd(g, ST7565_ADC);
write_cmd(g, ST7565_COM_SCAN);

write_cmd(g, ST7565_START_LINE | 0);

write_cmd2(g, ST7565_CONTRAST, GDISP_INITIAL_CONTRAST * 64 / 101);
write_cmd(g, ST7565_RESISTOR_RATIO | 0x1);
write_cmd2(g, ST7565_CONTRAST, GDISP_INITIAL_CONTRAST);

// turn on internal power supply (VC=1, VR=1, VF=1)
// turn on voltage converter (VC=1, VR=0, VF=0)
write_cmd(g, ST7565_POWER_CONTROL | 0x04);
delay_ms(50);

// turn on voltage regulator (VC=1, VR=1, VF=0)
write_cmd(g, ST7565_POWER_CONTROL | 0x06);
delay_ms(50);

// turn on voltage follower (VC=1, VR=1, VF=1)
write_cmd(g, ST7565_POWER_CONTROL | 0x07);
delay_ms(50);

write_cmd(g, ST7565_INVERT_DISPLAY);
write_cmd(g, ST7565_DISPLAY_ON);
write_cmd(g, ST7565_ALLON_NORMAL);
write_cmd(g, ST7565_INVERT_DISPLAY); // Disable Inversion of display.

write_cmd(g, ST7565_START_LINE | 0);
write_cmd(g, ST7565_RMW);
flush_cmd(g);

// Finish Init
post_init_board(g);
Expand All @@ -163,22 +156,14 @@ LLDSPEC void gdisp_lld_flush(GDisplay *g) {
if (!(g->flags & GDISP_FLG_NEEDFLUSH)) return;

acquire_bus(g);
enter_cmd_mode(g);
unsigned dstOffset = (PRIV(g)->buffer2 ? 4 : 0);
for (p = 0; p < 4; p++) {
write_cmd(g, ST7565_PAGE | (p + dstOffset));
gU8 pagemap[] = {ST7565_PAGE_ORDER};
for (p = 0; p < sizeof(pagemap); p++) {
write_cmd(g, ST7565_PAGE | pagemap[p]);
write_cmd(g, ST7565_COLUMN_MSB | 0);
write_cmd(g, ST7565_COLUMN_LSB | 0);
write_cmd(g, ST7565_RMW);
flush_cmd(g);
enter_data_mode(g);
write_data(g, RAM(g) + (p * GDISP_SCREEN_WIDTH), GDISP_SCREEN_WIDTH);
enter_cmd_mode(g);
}
unsigned line = (PRIV(g)->buffer2 ? 32 : 0);
write_cmd(g, ST7565_START_LINE | line);
flush_cmd(g);
PRIV(g)->buffer2 = !PRIV(g)->buffer2;
release_bus(g);

g->flags &= ~GDISP_FLG_NEEDFLUSH;
Expand Down Expand Up @@ -243,6 +228,7 @@ LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
}
# endif

# if GDISP_HARDWARE_BITFILLS
LLDSPEC void gdisp_lld_blit_area(GDisplay *g) {
uint8_t *buffer = (uint8_t *)g->p.ptr;
int linelength = g->p.cx;
Expand All @@ -268,6 +254,7 @@ LLDSPEC void gdisp_lld_blit_area(GDisplay *g) {
}
g->flags |= GDISP_FLG_NEEDFLUSH;
}
# endif

# if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL
LLDSPEC void gdisp_lld_control(GDisplay *g) {
Expand All @@ -279,16 +266,12 @@ LLDSPEC void gdisp_lld_control(GDisplay *g) {
case powerSleep:
case powerDeepSleep:
acquire_bus(g);
enter_cmd_mode(g);
write_cmd(g, ST7565_DISPLAY_OFF);
flush_cmd(g);
release_bus(g);
break;
case powerOn:
acquire_bus(g);
enter_cmd_mode(g);
write_cmd(g, ST7565_DISPLAY_ON);
flush_cmd(g);
release_bus(g);
break;
default:
Expand Down Expand Up @@ -318,12 +301,11 @@ LLDSPEC void gdisp_lld_control(GDisplay *g) {
return;

case GDISP_CONTROL_CONTRAST:
g->g.Contrast = (unsigned)g->p.ptr & 63;
if ((unsigned)g->p.ptr > 100) g->p.ptr = (void *)100;
acquire_bus(g);
enter_cmd_mode(g);
write_cmd2(g, ST7565_CONTRAST, g->g.Contrast);
flush_cmd(g);
write_cmd2(g, ST7565_CONTRAST, ((((unsigned)g->p.ptr) << 6) / 101) & 0x3F);
release_bus(g);
g->g.Contrast = (unsigned)g->p.ptr;
return;
}
}
Expand Down
2 changes: 0 additions & 2 deletions keyboards/at_at/660m/bootloader_defs.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* Address for jumping to bootloader on STM32 chips. */
/* It is chip dependent, the correct number can be looked up here (page 175):
* http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf
* This also requires a patch to chibios:
* <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch
*/
#define STM32_BOOTLOADER_ADDRESS 0x1FFFC800
16 changes: 16 additions & 0 deletions keyboards/boardrun/bizarre/bizarre.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "bizarre.h"
Loading

0 comments on commit f942bf0

Please sign in to comment.