Added Dual LCD

This commit is contained in:
phdlee
2018-04-21 16:09:21 +09:00
parent 5611e1c0ff
commit 0aafe32e27
7 changed files with 838 additions and 30 deletions

View File

@@ -20,6 +20,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
**************************************************************************/
#include "ubitx.h"
//Common Defines *********************************************************
#define LCD_CLEARDISPLAY 0x01
@@ -153,27 +154,6 @@ void LCD1602_Init()
LCD_Command(LCD_ENTRYMODESET | LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT);
}
void LCD_Print(const char *c)
{
for (uint8_t i = 0; i < strlen(c); i++)
{
if (*(c + i) == 0x00) return;
LCD_Write(*(c + i));
}
}
void LCD_SetCursor(uint8_t col, uint8_t row)
{
LCD_Command(LCD_SETDDRAMADDR | (col + row * 0x40)); //0 : 0x00, 1 : 0x40, only for 16 x 2 lcd
}
void LCD_CreateChar(uint8_t location, uint8_t charmap[])
{
location &= 0x7; // we only have 8 locations 0-7
LCD_Command(LCD_SETCGRAMADDR | (location << 3));
for (int i=0; i<8; i++)
LCD_Write(charmap[i]);
}
#endif
//========================================================================
//End of TinyLCD Library by KD8CEC
@@ -262,7 +242,7 @@ void backlight(void) {
void LCD1602_Init()
{
//I2C Init
_Addr = I2C_DISPLAY_ADDRESS;
_Addr = I2C_LCD_MASTER_ADDRESS;
_cols = 16;
_rows = 2;
_backlightval = LCD_NOBACKLIGHT;
@@ -308,6 +288,7 @@ void LCD1602_Init()
backlight();
}
/*
void LCD_Print(const char *c)
{
for (uint8_t i = 0; i < strlen(c); i++)
@@ -329,6 +310,7 @@ void LCD_CreateChar(uint8_t location, uint8_t charmap[])
for (int i=0; i<8; i++)
LCD_Write(charmap[i]);
}
*/
#endif
//========================================================================
//End of I2CTinyLCD Library by KD8CEC
@@ -347,6 +329,29 @@ void LCD_CreateChar(uint8_t location, uint8_t charmap[])
char c[30], b[30];
char printBuff[2][17]; //mirrors what is showing on the two lines of the display
void LCD_Print(const char *c)
{
for (uint8_t i = 0; i < strlen(c); i++)
{
if (*(c + i) == 0x00) return;
LCD_Write(*(c + i));
}
}
void LCD_SetCursor(uint8_t col, uint8_t row)
{
LCD_Command(LCD_SETDDRAMADDR | (col + row * 0x40)); //0 : 0x00, 1 : 0x40, only for 16 x 2 lcd
}
void LCD_CreateChar(uint8_t location, uint8_t charmap[])
{
location &= 0x7; // we only have 8 locations 0-7
LCD_Command(LCD_SETCGRAMADDR | (location << 3));
for (int i=0; i<8; i++)
LCD_Write(charmap[i]);
}
void LCD_Init(void)
{
LCD1602_Init();
@@ -787,7 +792,6 @@ void idle_process()
if (((displayOption1 & 0x08) == 0x08 && (sdrModeOn == 0)) && (++checkCountSMeter > SMeterLatency))
{
int newSMeter;
checkCountSMeter = 0; //Reset Latency time
//VK2ETA S-Meter from MAX9814 TC pin / divide 4 by KD8CEC for reduce EEPromSize
newSMeter = analogRead(ANALOG_SMETER);
@@ -804,6 +808,7 @@ void idle_process()
}
DisplayMeter(0, scaledSMeter, 14);
checkCountSMeter = 0; //Reset Latency time
} //end of S-Meter
}