mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
Bangle.js2: Lower bootloader LCD SPI bitrate (was out of spec, not all LCDs worked with it)
This commit is contained in:
parent
ec06ad5b6c
commit
2cf4ea3877
@ -2,6 +2,7 @@
|
||||
__FILE__ is now set correctly for apps (fixes 2v11 regression)
|
||||
Bangle.js: Ensure Bangle.getHealthStatus("day") resets at midnight (fix https://github.com/espruino/BangleApps/issues/1216)
|
||||
Bangle.js: Attempt to fix Bangle.buzz that occasionally doesn't stop
|
||||
Bangle.js2: Lower bootloader LCD SPI bitrate (was out of spec, not all LCDs worked with it)
|
||||
|
||||
2v11 : Bangle.js: Enable the Bangle.on('tap') event from the accelerometer by default
|
||||
Bangle.js: revert to (better) Kionix default thresholds for tap detect
|
||||
|
||||
@ -196,7 +196,7 @@ void lcdMemLCD_init(JsGraphics *gfx) {
|
||||
}
|
||||
|
||||
jshPinOutput(LCD_SPI_CS,0);
|
||||
jshPinOutput(LCD_SPI_SCK,0);
|
||||
jshPinOutput(LCD_SPI_SCK,1);
|
||||
jshPinOutput(LCD_SPI_MOSI,1);
|
||||
jshPinOutput(LCD_DISP,1);
|
||||
jshPinOutput(LCD_EXTCOMIN,1);
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
static void __attribute__((noinline)) nrf_gpio_pin_write_output(uint32_t pin, bool value)
|
||||
{
|
||||
nrf_gpio_pin_write(pin, value);
|
||||
nrf_gpio_cfg_output(pin);
|
||||
nrf_gpio_cfg_output(pin); // TODO: could use high drive for these pins (default is std)
|
||||
}
|
||||
|
||||
static void set_led_state(bool btn, bool progress)
|
||||
|
||||
@ -138,23 +138,36 @@ void lcd_pixel(int x, int y) {
|
||||
#define LCD_SPI_MOSI_CLEAR() (*(volatile uint32_t*)0x5000080C)=1<<(LCD_SPI_MOSI-32)
|
||||
#endif
|
||||
|
||||
// Not all LPM013M126 can be clocked at max speed so we must delay...
|
||||
#if defined(LCD_CONTROLLER_LPM013M126)
|
||||
#define SPI_WAIT() asm("nop");asm("nop");asm("nop");asm("nop");
|
||||
#else
|
||||
#define SPI_WAIT()
|
||||
#endif
|
||||
|
||||
void lcd_wr(int data) {
|
||||
for (int bit=7;bit>=0;bit--) {
|
||||
LCD_SPI_SCK_CLEAR();
|
||||
SPI_WAIT();
|
||||
if ((data>>bit)&1) LCD_SPI_MOSI_SET();
|
||||
else LCD_SPI_MOSI_CLEAR();
|
||||
SPI_WAIT();
|
||||
LCD_SPI_SCK_SET();
|
||||
SPI_WAIT();
|
||||
}
|
||||
}
|
||||
void lcd_wr16(bool allFF) {
|
||||
if (allFF) LCD_SPI_MOSI_SET();
|
||||
else LCD_SPI_MOSI_CLEAR();
|
||||
SPI_WAIT();
|
||||
for (int bit=0;bit<16;bit++) {
|
||||
LCD_SPI_SCK_CLEAR();
|
||||
SPI_WAIT();
|
||||
LCD_SPI_SCK_SET();
|
||||
SPI_WAIT();
|
||||
}
|
||||
}
|
||||
#else
|
||||
#else // not NRF52_SERIES
|
||||
void lcd_wr(int data) {
|
||||
for (int bit=7;bit>=0;bit--) {
|
||||
jshPinSetValue(LCD_SPI_SCK, 0 );
|
||||
@ -801,18 +814,22 @@ void lcd_flip() {
|
||||
|
||||
void lcd_init() {
|
||||
jshPinOutput(LCD_SPI_CS,0);
|
||||
jshPinOutput(LCD_SPI_SCK,0);
|
||||
jshPinOutput(LCD_SPI_SCK,1);
|
||||
jshPinOutput(LCD_SPI_MOSI,1);
|
||||
jshPinOutput(LCD_DISP,1);
|
||||
jshPinOutput(LCD_EXTCOMIN,1);
|
||||
jshPinOutput(LCD_BL, LCD_BL_ON); // backlight on
|
||||
jshDelayMicroseconds(10000);
|
||||
// force LCD to clear itself
|
||||
lcd_clear();
|
||||
lcd_clear();
|
||||
}
|
||||
void lcd_kill() {
|
||||
jshPinOutput(LCD_BL, !LCD_BL_ON); // backlight off
|
||||
jshPinOutput(LCD_DISP,0); // display off
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // LCD_CONTROLLER_LPM013M126
|
||||
|
||||
|
||||
void lcd_char(int x1, int y1, char ch) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user