Jon Trinder 2023-09-04 14:11:42 +08:00 zatwierdzone przez GitHub
commit c3af0230ab
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
12 zmienionych plików z 673 dodań i 8 usunięć

Wyświetl plik

@ -1353,6 +1353,8 @@ Recent Update History
2021.12.17.01
Merged pull request 119 https://github.com/k3ng/k3ng_cw_keyer/pull/119/ Definable startup text (define HI_TEXT) - Thanks, ON6ZQ
2022.03.07 GM0HYY version to add St7032 LCD via I2C
Documentation: https://github.com/k3ng/k3ng_cw_keyer/wiki
Support: https://groups.io/g/radioartisan ( Please do not email K3NG directly for support. Thanks )
@ -1610,6 +1612,10 @@ If you offer a hardware kit using this software, show your appreciation by sendi
#include "SSD1306AsciiWire.h"
#endif
#if defined(FEATURE_LCD_ST7032)
#include <ST7032_asukiaaa.h>
#endif
#if defined(FEATURE_TRAINING_COMMAND_LINE_INTERFACE)
// #include <BasicTerm.h>
#endif
@ -2052,6 +2058,10 @@ byte send_buffer_status = SERIAL_SEND_BUFFER_NORMAL;
SSD1306AsciiWire lcd;
#endif
#if defined(FEATURE_LCD_ST7032)
ST7032_asukiaaa lcd;
#endif
#if defined(FEATURE_USB_KEYBOARD) || defined(FEATURE_USB_MOUSE)
USB Usb;
uint32_t next_time;
@ -18370,6 +18380,11 @@ void initialize_display(){
lcd.begin(LCD_COLUMNS, LCD_ROWS);
#endif
#endif
#ifdef FEATURE_LCD_ST7032
lcd.begin(LCD_COLUMNS, LCD_ROWS); // columns and rows
lcd.setContrast(30);
#endif
#ifdef FEATURE_LCD_ADAFRUIT_I2C
lcd.setBacklight(lcdcolor);

Wyświetl plik

@ -1,6 +1,6 @@
#if defined(FEATURE_LCD_4BIT) || defined(FEATURE_LCD_8BIT) || defined(FEATURE_LCD_ADAFRUIT_I2C) || defined(FEATURE_LCD_ADAFRUIT_BACKPACK) || defined(FEATURE_LCD_YDv1) ||defined(FEATURE_LCD1602_N07DH) || defined(FEATURE_LCD_SAINSMART_I2C) || defined(FEATURE_LCD_FABO_PCF8574) || defined(FEATURE_LCD_MATHERTEL_PCF8574) || defined(FEATURE_LCD_HD44780) || defined(FEATURE_LCD_I2C_FDEBRABANDER) || defined(FEATURE_LCD_TWILIQUIDCRYSTAL) || defined(FEATURE_OLED_SSD1306)
#define FEATURE_DISPLAY
#if defined(FEATURE_LCD_4BIT) || defined(FEATURE_LCD_ST7032) || defined(FEATURE_LCD_8BIT) || defined(FEATURE_LCD_ADAFRUIT_I2C) || defined(FEATURE_LCD_ADAFRUIT_BACKPACK) || defined(FEATURE_LCD_YDv1) || defined(FEATURE_LCD1602_N07DH) || defined(FEATURE_LCD_SAINSMART_I2C) || defined(FEATURE_LCD_FABO_PCF8574) || defined(FEATURE_LCD_MATHERTEL_PCF8574) || defined(FEATURE_LCD_HD44780) || defined(FEATURE_LCD_I2C_FDEBRABANDER) || defined(FEATURE_LCD_TWILIQUIDCRYSTAL) || defined(FEATURE_OLED_SSD1306)
#define FEATURE_DISPLAY
#endif
#if defined(FEATURE_COMMAND_LINE_INTERFACE_ON_SECONDARY_PORT) && !defined(FEATURE_COMMAND_LINE_INTERFACE)

Wyświetl plik

@ -4,7 +4,7 @@
// #define FEATURE_BUTTONS
// #define FEATURE_COMMAND_MODE
// #define FEATURE_COMMAND_LINE_INTERFACE // Command Line Interface functionality
#define FEATURE_COMMAND_LINE_INTERFACE // Command Line Interface functionality
// #define FEATURE_MEMORIES // on the Arduino Due, you must have FEATURE_EEPROM_E24C1024 and E24C1024 EEPROM hardware in order to compile this
// #define FEATURE_MEMORY_MACROS
// #define FEATURE_WINKEY_EMULATION // disabling Automatic Software Reset is highly recommended (see documentation)
@ -14,7 +14,7 @@
// #define FEATURE_POTENTIOMETER // do not enable unless you have a potentiometer connected, otherwise noise will falsely trigger wpm changes
// #define FEATURE_SIDETONE_SWITCH // adds switch control for the sidetone output. requires an external toggle switch (assigned to an arduino pin - see keyer_pin_settings.h).
// #define FEATURE_SIDETONE_NEWTONE // Use the NewTone library, ~1k smaller code size than the standard tone library. Uses timer1 (pins 9 or 10) https://bitbucket.org/teckel12/arduino-new-tone/wiki/Home
// #define FEATURE_SERIAL_HELP
#define FEATURE_SERIAL_HELP
// #define FEATURE_HELL // Hellscreiber Mode
// #define FEATURE_PS2_KEYBOARD // Use a PS2 keyboard to send code - Change keyboard layout (non-US) in K3NG_PS2Keyboard.h. Additional options below.
// #define FEATURE_USB_KEYBOARD // Use a USB keyboard to send code - Uncomment three lines in k3ng_keyer.ino (search for note_usb_uncomment_lines)
@ -35,6 +35,7 @@
// #define FEATURE_LCD_MATHERTEL_PCF8574 // https://github.com/mathertel/LiquidCrystal_PCF8574
// #define FEATURE_LCD_I2C_FDEBRABANDER // https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library
// #define FEATURE_LCD_HD44780
#define FEATURE_LCD_ST7032 //uses library https://github.com/asukiaaa/ST7032_asukiaaa added GM0HYY
// #define FEATURE_OLED_SSD1306 // https://github.com/greiman/SSD1306Ascii
// #define FEATURE_CW_DECODER // https://github.com/k3ng/k3ng_cw_keyer/wiki/385-Feature:-CW-Decoder
// #define FEATURE_SLEEP // go to sleep after x minutes to conserve battery power (not compatible with Arduino DUE, may have mixed results with Mega and Mega ADK)
@ -49,10 +50,10 @@
// #define FEATURE_PTT_INTERLOCK
// #define FEATURE_QLF
// #define FEATURE_EEPROM_E24C1024
// #define FEATURE_STRAIGHT_KEY
#define FEATURE_STRAIGHT_KEY
// #define FEATURE_DYNAMIC_DAH_TO_DIT_RATIO
// #define FEATURE_PADDLE_ECHO // you may also need to comment out line 19 in the file keyer_dependencies.h
// #define FEATURE_STRAIGHT_KEY_ECHO
#define FEATURE_PADDLE_ECHO // you may also need to comment out line 19 in the file keyer_dependencies.h
#define FEATURE_STRAIGHT_KEY_ECHO
// #define FEATURE_AMERICAN_MORSE
// #define FEATURE_4x4_KEYPAD // code contributed by Jack, W0XR - documentation: https://github.com/k3ng/k3ng_cw_keyer/wiki/380-Feature:-Keypad
// #define FEATURE_3x4_KEYPAD // code contributed by Jack, W0XR - documentation: https://github.com/k3ng/k3ng_cw_keyer/wiki/380-Feature:-Keypad

Wyświetl plik

@ -94,7 +94,7 @@ FEATURE_SIDETONE_SWITCH
#endif //FEATURE_PTT_INTERLOCK
#ifdef FEATURE_STRAIGHT_KEY
#define pin_straight_key 52
#define pin_straight_key 3 //was 52 jjt
#endif //FEATURE_STRAIGHT_KEY
// FEATURE_CW_DECODER & OPTION_CW_DECODER_GOERTZEL_AUDIO_DETECTOR

Wyświetl plik

@ -0,0 +1,82 @@
# ST7032_asukiaaa
A library to control ST7032 on a LiquidCrystal.
This library was forked from [tomozh/arduino_ST7032](https://github.com/tomozh/arduino_ST7032).
# Install
## Arduino IDE
You can install via library manager.
Search `ST7032` on the library manager
## PlatformIO
Add this library to dependencies on `platformio.ini`.
```
lib_deps =
ST7032_asukiaaa
```
# Connection
ST7032 | Arduino
-------|--------
VDD | 3V3
RES | 3V3
SDA* | SDA(A4 for Uno)
SCL* | SCL(A5 for Uno)
GND | GND
*... 10Kohm pull-up is needed.
You can check SDA and SCL for your board on [Wire page](https://www.arduino.cc/en/reference/wire).
# Usage
## Hello world
See [HelloWorld](./examples/HelloWorld/HelloWorld.ino).
```c
#include <ST7032_asukiaaa.h>
ST7032_asukiaaa lcd;
void setup() {
lcd.begin(16, 2); // LCD columns and rows.
lcd.setContrast(40);
// If lcd become black, reduced value for contrast
// lcd.setContrast(10);
lcd.print("hello, world!");
}
void loop() {
lcd.setCursor(0, 1);
lcd.print(millis()/1000);
}
```
## Set slave address
You can specify slave address for a LCD.
```c
ST7032_asukiaaa lcd(0x3E);
```
## Set wire
You can set customized wire.(See [setWire](./examples/setWire/setWire.ino))
```c
#if defined(ESP32)
Wire.begin(25, 26); // SDA, SCL
lcd.setWire(&Wire);
#endif
```
See [examples](./examples) to know other usage.
# License
MIT
# References
- [I2C液晶のArduinoライブラリ – ST7032](http://ore-kb.net/archives/195)
- [tomozh/arduino_ST7032](https://github.com/tomozh/arduino_ST7032)

Wyświetl plik

@ -0,0 +1,18 @@
#include <ST7032_asukiaaa.h>
ST7032_asukiaaa lcd;
void setup() {
lcd.begin(16, 2); // columns and rows
lcd.setContrast(30);
// If lcd become black, try reduced value for contrast
// lcd.setContrast(10);
lcd.print("hello!");
}
void loop() {
lcd.setCursor(0, 1);
lcd.print(millis()/1000);
}

Wyświetl plik

@ -0,0 +1,85 @@
/*
ST7032 I2C LCD Controler - Icon Display Example
2013/05/11 tomozh@gmail.com
------------------------
Arduino ST7032
------------------------
3.3V --+-- VDD
+-- RST
A4(SDA) --*-- SDA
A5(SCL) --*-- SCL
GND ----- GND
*... 10Kohm pull-up
------------------------
*/
#include <ST7032_asukiaaa.h>
#define NELEMS(arg) (sizeof(arg) / sizeof((arg)[0]))
typedef struct tagICON_MAP {
byte addr;
byte pat;
}ICON_MAP;
static const ICON_MAP iconMap[] = {
{ 0x00, (1<<4) }, // 0
{ 0x02, (1<<4) }, // 1
{ 0x04, (1<<4) }, // 2
{ 0x06, (1<<4) }, // 3
{ 0x07, (1<<4) }, // 4
{ 0x07, (1<<3) }, // 5
{ 0x09, (1<<4) }, // 6
{ 0x0B, (1<<4) }, // 7
{ 0x0D, (1<<4) }, // 8
{ 0x0D, (1<<3) }, // 9
{ 0x0D, (1<<2) }, // 10
{ 0x0D, (1<<1) }, // 11
{ 0x0F, (1<<4) }, // 12
};
static byte iconTmp[16];
bool showIcon = true;
ST7032_asukiaaa lcd;
static void setIndexedIcon(uint8_t index, bool show) {
if((0 <= index) && (index < NELEMS(iconMap))) {
const ICON_MAP* pMap = &iconMap[index];
byte* pTmp = &iconTmp[pMap->addr];
if(show) {
*pTmp |= pMap->pat;
} else {
*pTmp &= ~pMap->pat;
}
lcd.setIcon(pMap->addr, *pTmp);
}
}
void setup(){
lcd.begin(16, 2, LCD_5x8DOTS);
lcd.setContrast(30);
lcd.print("ST7032 ICON TEST");
}
void loop(){
int i;
for(i = 0; i < NELEMS(iconMap); i++) {
setIndexedIcon(i, showIcon);
lcd.setCursor(0, 1);
lcd.print("No.");
lcd.print(i);
lcd.print(" ");
delay(500);
}
while(1){}
showIcon = !showIcon;
}

Wyświetl plik

@ -0,0 +1,18 @@
#include <ST7032_asukiaaa.h>
ST7032_asukiaaa lcd;
void setup() {
#if defined(ESP32)
Wire.begin(21, 22); // SDA, SCL
lcd.setWire(&Wire);
#endif
lcd.begin(16, 2);
lcd.setContrast(30);
lcd.print("hello, world!");
}
void loop() {
lcd.setCursor(0, 1);
lcd.print(millis()/1000);
}

Wyświetl plik

@ -0,0 +1,43 @@
#######################################
# Syntax Coloring Map For ST7032
#######################################
#######################################
# Datatypes (KEYWORD1)
#######################################
ST7032_asukiaaa KEYWORD1
#######################################
# Methods and Functions (KEYWORD2)
#######################################
autoscroll KEYWORD2
begin KEYWORD2
blink KEYWORD2
clear KEYWORD2
command KEYWORD2
createChar KEYWORD2
cursor KEYWORD2
display KEYWORD2
home KEYWORD2
leftToRight KEYWORD2
noAutoscroll KEYWORD2
noBlink KEYWORD2
noCursor KEYWORD2
noDisplay KEYWORD2
rightToLeft KEYWORD2
scrollDisplayLeft KEYWORD2
scrollDisplayRight KEYWORD2
setContrast KEYWORD2
setCursor KEYWORD2
setIcon KEYWORD2
setWire KEYWORD2
######################################
# Instances (KEYWORD2)
#######################################
#######################################
# Constants (LITERAL1)
#######################################

Wyświetl plik

@ -0,0 +1,10 @@
name=ST7032_asukiaaa
version=1.0.5
author=tomozh <tomozh@gmail.com>, Asuki Kono <asukiaaa@gmail.com>
maintainer=Asuki Kono <asukiaaa@gmail.com>
sentence=This library controls ST7032 on LCD.
paragraph=This library can control LCDs that using ST7032. Ex: SB1602B, SB0802G, AQM0802A-RN-GBW, AQM1602 and so on.
category=Display
url=https://github.com/asukiaaa/ST7032_asukiaaa
architectures=*
includes=ST7032_asukiaaa.h

Wyświetl plik

@ -0,0 +1,246 @@
/*
ST7032_asukiaaa.cpp - Arduino LiquidCrystal compatible library
Original source is Arduino LiquidCrystal liblary
Author: tomozh@gmail.com
License: MIT
History:
2014.10.13 bit7BON
2014.08.23 I2C
2013.05.21 1st release
------------------------
Arduino ST7032i
------------------------
3.3V --+-- VDD
+-- -RES
A4(SDA) --*-- SDA
A5(SCL) --*-- SCL
GND ----- GND
*... 10Kohm pull-up
------------------------
*/
#include <Arduino.h>
#include "ST7032_asukiaaa.h"
// private methods
void ST7032_asukiaaa::setDisplayControl(uint8_t setBit) {
_displaycontrol |= setBit;
command(LCD_DISPLAYCONTROL | _displaycontrol);
}
void ST7032_asukiaaa::resetDisplayControl(uint8_t resetBit) {
_displaycontrol &= ~resetBit;
command(LCD_DISPLAYCONTROL | _displaycontrol);
}
void ST7032_asukiaaa::setEntryMode(uint8_t setBit) {
_displaymode |= setBit;
command(LCD_ENTRYMODESET | _displaymode);
}
void ST7032_asukiaaa::resetEntryMode(uint8_t resetBit) {
_displaymode &= ~resetBit;
command(LCD_ENTRYMODESET | _displaymode);
}
void ST7032_asukiaaa::normalFunctionSet() {
command(LCD_FUNCTIONSET | _displayfunction);
}
void ST7032_asukiaaa::extendFunctionSet() {
command(LCD_FUNCTIONSET | _displayfunction | LCD_EX_INSTRUCTION);
}
// public methods
ST7032_asukiaaa::ST7032_asukiaaa(int i2c_addr)
: _displaycontrol(0x00)
, _displaymode(0x00)
, _i2c_addr((uint8_t)i2c_addr)
{
// begin(16, 1);
thisWire = NULL;
}
void ST7032_asukiaaa::setWire(TwoWire* wire) {
thisWire = wire;
}
void ST7032_asukiaaa::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) {
_displayfunction = LCD_8BITMODE | LCD_1LINE | LCD_5x8DOTS;
if (lines > 1) {
_displayfunction |= LCD_2LINE;
}
_numlines = lines;
_currline = 0;
// for some 1 line displays you can select a 10 pixel high font
if ((dotsize != 0) && (lines == 1)) {
_displayfunction |= LCD_5x10DOTS;
}
if (thisWire == NULL) {
thisWire = &Wire;
thisWire->begin();
}
delay(40); // Wait time >40ms After VDD stable
// finally, set # lines, font size, etc.
normalFunctionSet();
extendFunctionSet();
command(LCD_EX_SETBIASOSC | LCD_BIAS_1_5 | LCD_OSC_183HZ); // 1/5bias, OSC=183Hz@3.0V
command(LCD_EX_FOLLOWERCONTROL | LCD_FOLLOWER_ON | LCD_RAB_2_00); // internal follower circuit is turn on
delay(200); // Wait time >200ms (for power stable)
normalFunctionSet();
// turn the display on with no cursor or blinking default
// display();
_displaycontrol = 0x00;//LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF;
setDisplayControl(LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF);
// clear it off
clear();
// Initialize to default text direction (for romance languages)
// command(LCD_ENTRYMODESET | _displaymode);
_displaymode = 0x00;//LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT;
setEntryMode(LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT);
setContrast(30);
}
void ST7032_asukiaaa::setContrast(uint8_t cont)
{
extendFunctionSet();
command(LCD_EX_CONTRASTSETL | (cont & 0x0f)); // Contrast set
command(LCD_EX_POWICONCONTRASTH | LCD_ICON_ON | LCD_BOOST_ON | ((cont >> 4) & 0x03)); // Power, ICON, Contrast control
normalFunctionSet();
}
void ST7032_asukiaaa::setIcon(uint8_t addr, uint8_t bit) {
extendFunctionSet();
command(LCD_EX_SETICONRAMADDR | (addr & 0x0f)); // ICON address
write(bit);
normalFunctionSet();
}
/********** high level commands, for the user! */
void ST7032_asukiaaa::clear()
{
command(LCD_CLEARDISPLAY); // clear display, set cursor position to zero
delayMicroseconds(2000); // this command takes a long time!
}
void ST7032_asukiaaa::home()
{
command(LCD_RETURNHOME); // set cursor position to zero
delayMicroseconds(2000); // this command takes a long time!
}
void ST7032_asukiaaa::setCursor(uint8_t col, uint8_t row)
{
const int row_offsets[] = { 0x00, 0x40, 0x14, 0x54 };
if ( row > _numlines ) {
row = _numlines-1; // we count rows starting w/0
}
command(LCD_SETDDRAMADDR | (col + row_offsets[row]));
}
// Turn the display on/off (quickly)
void ST7032_asukiaaa::noDisplay() {
resetDisplayControl(LCD_DISPLAYON);
}
void ST7032_asukiaaa::display() {
setDisplayControl(LCD_DISPLAYON);
}
// Turns the underline cursor on/off
void ST7032_asukiaaa::noCursor() {
resetDisplayControl(LCD_CURSORON);
}
void ST7032_asukiaaa::cursor() {
setDisplayControl(LCD_CURSORON);
}
// Turn on and off the blinking cursor
void ST7032_asukiaaa::noBlink() {
resetDisplayControl(LCD_BLINKON);
}
void ST7032_asukiaaa::blink() {
setDisplayControl(LCD_BLINKON);
}
// These commands scroll the display without changing the RAM
void ST7032_asukiaaa::scrollDisplayLeft(void) {
command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVELEFT);
}
void ST7032_asukiaaa::scrollDisplayRight(void) {
command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVERIGHT);
}
// This is for text that flows Left to Right
void ST7032_asukiaaa::leftToRight(void) {
setEntryMode(LCD_ENTRYLEFT);
}
// This is for text that flows Right to Left
void ST7032_asukiaaa::rightToLeft(void) {
resetEntryMode(LCD_ENTRYLEFT);
}
// This will 'right justify' text from the cursor
void ST7032_asukiaaa::autoscroll(void) {
setEntryMode(LCD_ENTRYSHIFTINCREMENT);
}
// This will 'left justify' text from the cursor
void ST7032_asukiaaa::noAutoscroll(void) {
resetEntryMode(LCD_ENTRYSHIFTINCREMENT);
}
// Allows us to fill the first 8 CGRAM locations
// with custom characters
void ST7032_asukiaaa::createChar(uint8_t location, uint8_t charmap[]) {
location &= 0x7; // we only have 8 locations 0-7
command(LCD_SETCGRAMADDR | (location << 3));
for (int i=0; i<8; i++) {
write(charmap[i]);
}
}
/*********** mid level commands, for sending data/cmds */
void ST7032_asukiaaa::command(uint8_t value) {
thisWire->beginTransmission(_i2c_addr);
thisWire->write((uint8_t)0x00);
thisWire->write(value);
thisWire->endTransmission();
delayMicroseconds(27); // >26.3us
}
size_t ST7032_asukiaaa::write(uint8_t value) {
thisWire->beginTransmission(_i2c_addr);
thisWire->write((uint8_t)0x40);
thisWire->write(value);
thisWire->endTransmission();
delayMicroseconds(27); // >26.3us
return 1;
}

Wyświetl plik

@ -0,0 +1,147 @@
#ifndef __ST7032_ASUKIAAA_H__
#define __ST7032_ASUKIAAA_H__
#include <stdint.h>
#include <Print.h>
#include <Wire.h>
#define ST7032_I2C_DEFAULT_ADDR 0x3E
// commands
#define LCD_CLEARDISPLAY 0x01
#define LCD_RETURNHOME 0x02
#define LCD_ENTRYMODESET 0x04
#define LCD_DISPLAYCONTROL 0x08
#define LCD_CURSORSHIFT 0x10
#define LCD_FUNCTIONSET 0x20
#define LCD_SETCGRAMADDR 0x40
#define LCD_SETDDRAMADDR 0x80
#define LCD_EX_SETBIASOSC 0x10 // Bias selection / Internal OSC frequency adjust
#define LCD_EX_SETICONRAMADDR 0x40 // Set ICON RAM address
#define LCD_EX_POWICONCONTRASTH 0x50 // Power / ICON control / Contrast set(high byte)
#define LCD_EX_FOLLOWERCONTROL 0x60 // Follower control
#define LCD_EX_CONTRASTSETL 0x70 // Contrast set(low byte)
// flags for display entry mode
#define LCD_ENTRYRIGHT 0x00
#define LCD_ENTRYLEFT 0x02
#define LCD_ENTRYSHIFTINCREMENT 0x01
#define LCD_ENTRYSHIFTDECREMENT 0x00
// flags for display on/off control
#define LCD_DISPLAYON 0x04
#define LCD_DISPLAYOFF 0x00
#define LCD_CURSORON 0x02
#define LCD_CURSOROFF 0x00
#define LCD_BLINKON 0x01
#define LCD_BLINKOFF 0x00
// flags for display/cursor shift
#define LCD_DISPLAYMOVE 0x08
#define LCD_CURSORMOVE 0x00
#define LCD_MOVERIGHT 0x04
#define LCD_MOVELEFT 0x00
// flags for function set
#define LCD_8BITMODE 0x10
#define LCD_4BITMODE 0x00
#define LCD_2LINE 0x08
#define LCD_1LINE 0x00
#define LCD_5x10DOTS 0x04
#define LCD_5x8DOTS 0x00
#define LCD_EX_INSTRUCTION 0x01 // IS: instruction table select
// flags for Bias selection
#define LCD_BIAS_1_4 0x08 // bias will be 1/4
#define LCD_BIAS_1_5 0x00 // bias will be 1/5
// flags Power / ICON control / Contrast set(high byte)
#define LCD_ICON_ON 0x08 // ICON display on
#define LCD_ICON_OFF 0x00 // ICON display off
#define LCD_BOOST_ON 0x04 // booster circuit is turn on
#define LCD_BOOST_OFF 0x00 // booster circuit is turn off
#define LCD_OSC_122HZ 0x00 // 122Hz@3.0V
#define LCD_OSC_131HZ 0x01 // 131Hz@3.0V
#define LCD_OSC_144HZ 0x02 // 144Hz@3.0V
#define LCD_OSC_161HZ 0x03 // 161Hz@3.0V
#define LCD_OSC_183HZ 0x04 // 183Hz@3.0V
#define LCD_OSC_221HZ 0x05 // 221Hz@3.0V
#define LCD_OSC_274HZ 0x06 // 274Hz@3.0V
#define LCD_OSC_347HZ 0x07 // 347Hz@3.0V
// flags Follower control
#define LCD_FOLLOWER_ON 0x08 // internal follower circuit is turn on
#define LCD_FOLLOWER_OFF 0x00 // internal follower circuit is turn off
#define LCD_RAB_1_00 0x00 // 1+(Rb/Ra)=1.00
#define LCD_RAB_1_25 0x01 // 1+(Rb/Ra)=1.25
#define LCD_RAB_1_50 0x02 // 1+(Rb/Ra)=1.50
#define LCD_RAB_1_80 0x03 // 1+(Rb/Ra)=1.80
#define LCD_RAB_2_00 0x04 // 1+(Rb/Ra)=2.00
#define LCD_RAB_2_50 0x05 // 1+(Rb/Ra)=2.50
#define LCD_RAB_3_00 0x06 // 1+(Rb/Ra)=3.00
#define LCD_RAB_3_75 0x07 // 1+(Rb/Ra)=3.75
class ST7032_asukiaaa : public Print {
public:
ST7032_asukiaaa(int i2c_addr = ST7032_I2C_DEFAULT_ADDR);
void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS);
void setWire(TwoWire* wire);
void setContrast(uint8_t cont);
void setIcon(uint8_t addr, uint8_t bit);
void clear();
void home();
void noDisplay();
void display();
void noBlink();
void blink();
void noCursor();
void cursor();
void scrollDisplayLeft();
void scrollDisplayRight();
void leftToRight();
void rightToLeft();
void autoscroll();
void noAutoscroll();
void createChar(uint8_t location, uint8_t charmap[]);
void setCursor(uint8_t col, uint8_t row);
virtual size_t write(uint8_t value);
void command(uint8_t value);
private:
void setDisplayControl(uint8_t setBit);
void resetDisplayControl(uint8_t resetBit);
void setEntryMode(uint8_t setBit);
void resetEntryMode(uint8_t resetBit);
void normalFunctionSet();
void extendFunctionSet();
// void send(uint8_t, uint8_t);
/*
uint8_t _rs_pin; // LOW: command. HIGH: character.
uint8_t _rw_pin; // LOW: write to LCD. HIGH: read from LCD.
uint8_t _enable_pin; // activated by a HIGH pulse.
uint8_t _data_pins[8];
*/
TwoWire* thisWire;
uint8_t _displayfunction;
uint8_t _displaycontrol;
uint8_t _displaymode;
// uint8_t _iconfunction;
uint8_t _initialized;
uint8_t _numlines;
uint8_t _currline;
uint8_t _i2c_addr;
};
#endif // __ST7032_H__