LCD driver simplification, 8 bytes saved (ST7565)
This commit is contained in:
@@ -36,13 +36,6 @@
|
|||||||
|
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
|
|
||||||
#define delay_1us() _delay_us(1)
|
|
||||||
#define delay_2us() _delay_us(2)
|
|
||||||
void delay_1_5us(uint16_t ms)
|
|
||||||
{
|
|
||||||
for (uint16_t i=0; i<ms; i++) delay_1us();
|
|
||||||
}
|
|
||||||
|
|
||||||
void lcdSendCtl(uint8_t val)
|
void lcdSendCtl(uint8_t val)
|
||||||
{
|
{
|
||||||
PORTC_LCD_CTRL &= ~(1<<OUT_C_LCD_CS1);
|
PORTC_LCD_CTRL &= ~(1<<OUT_C_LCD_CS1);
|
||||||
@@ -126,12 +119,12 @@ inline void lcdInit()
|
|||||||
{
|
{
|
||||||
LCD_LOCK();
|
LCD_LOCK();
|
||||||
PORTC_LCD_CTRL &= ~(1<<OUT_C_LCD_RES); //LCD reset
|
PORTC_LCD_CTRL &= ~(1<<OUT_C_LCD_RES); //LCD reset
|
||||||
delay_2us();
|
_delay_us(2);
|
||||||
PORTC_LCD_CTRL |= (1<<OUT_C_LCD_RES); //LCD normal operation
|
PORTC_LCD_CTRL |= (1<<OUT_C_LCD_RES); //LCD normal operation
|
||||||
#ifdef LCD_ST7920
|
#ifdef LCD_ST7920
|
||||||
_delay_ms(40);
|
_delay_ms(40);
|
||||||
#else
|
#else
|
||||||
delay_1_5us(1500); //TODO : verify if can be set to 40 ms instead of 1.5 ms
|
_delay_us(1500);
|
||||||
#endif
|
#endif
|
||||||
for (uint8_t i=0; i<DIM(lcdInitSequence); i++) {
|
for (uint8_t i=0; i<DIM(lcdInitSequence); i++) {
|
||||||
lcdSendCtl(pgm_read_byte(&lcdInitSequence[i])) ;
|
lcdSendCtl(pgm_read_byte(&lcdInitSequence[i])) ;
|
||||||
@@ -149,7 +142,7 @@ inline void lcdInit()
|
|||||||
|
|
||||||
void lcdSetRefVolt(uint8_t val)
|
void lcdSetRefVolt(uint8_t val)
|
||||||
{
|
{
|
||||||
#ifndef LCD_ST7920 //No contrast setting in the ST7920 controller
|
#ifndef LCD_ST7920 //No contrast setting for ST7920
|
||||||
LCD_LOCK();
|
LCD_LOCK();
|
||||||
lcdSendCtl(0x81);
|
lcdSendCtl(0x81);
|
||||||
lcdSendCtl(val);
|
lcdSendCtl(val);
|
||||||
|
|||||||
Reference in New Issue
Block a user