WIP driver for adafruit display
This commit is contained in:
parent
ed7a3e151f
commit
d9f03d0a2d
51
lib/matrix_orbital/AdafruitVfdDisplay.cpp
Normal file
51
lib/matrix_orbital/AdafruitVfdDisplay.cpp
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
#include "AdafruitVfdDisplay.hpp"
|
||||||
|
|
||||||
|
AdafruitVfdDisplay::AdafruitVfdDisplay(UART& lcdUart) : m_lcdUart{lcdUart} {}
|
||||||
|
|
||||||
|
|
||||||
|
void AdafruitVfdDisplay::createChar(uint8_t id, uint8_t* c) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdafruitVfdDisplay::drawBlinker() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdafruitVfdDisplay::clearBlinker() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdafruitVfdDisplay::begin() {
|
||||||
|
delay(500);
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdafruitVfdDisplay::clear() {
|
||||||
|
uint8_t clearCmd[] = {0xfe, 0x58};
|
||||||
|
m_lcdUart.write_raw(clearCmd, sizeof(clearCmd));
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdafruitVfdDisplay::show() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdafruitVfdDisplay::hide() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdafruitVfdDisplay::draw(uint8_t byte) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdafruitVfdDisplay::draw(const char* text) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdafruitVfdDisplay::setCursor(uint8_t col, uint8_t row) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdafruitVfdDisplay::setBacklight(bool enabled) {
|
||||||
|
uint8_t backlightCmd[] = {0xfe, 0x99, enabled ? 150 : 50};
|
||||||
|
m_lcdUart.write_raw(backlightCmd, sizeof(backlightCmd));
|
||||||
|
}
|
35
lib/matrix_orbital/AdafruitVfdDisplay.hpp
Normal file
35
lib/matrix_orbital/AdafruitVfdDisplay.hpp
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Implementation of LcdMenu::CharacterDisplayInterface
|
||||||
|
* For the Adafruit Character LCD Serial backpack. Which per their docs
|
||||||
|
* has a similar interface to the "Matrix Orbital Specification"
|
||||||
|
* @see https://learn.adafruit.com/usb-plus-serial-backpack/command-reference
|
||||||
|
*/
|
||||||
|
#ifndef __ADAFRUITVFDDISPINTERFACE_H__
|
||||||
|
#define __ADAFRUITVFDDISPINTERFACE_H__
|
||||||
|
|
||||||
|
#include <display/CharacterDisplayInterface.h>
|
||||||
|
|
||||||
|
class AdafruitVfdDisplay : public CharacterDisplayInterface {
|
||||||
|
public:
|
||||||
|
AdafruitVfdDisplay(UART& lcdUart);
|
||||||
|
|
||||||
|
// interface implementations
|
||||||
|
|
||||||
|
void createChar(uint8_t id, uint8_t* c) override;
|
||||||
|
void drawBlinker() override;
|
||||||
|
void clearBlinker() override;
|
||||||
|
void begin() override;
|
||||||
|
void clear() override;
|
||||||
|
void show() override;
|
||||||
|
void hide() override;
|
||||||
|
void draw(uint8_t byte) override;
|
||||||
|
void draw(const char* text) override;
|
||||||
|
void setCursor(uint8_t col, uint8_t row) override;
|
||||||
|
void setBacklight(bool enabled) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
UART m_lcdUart;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __ADAFRUITVFDDISPINTERFACE_H__ */
|
|
@ -15,3 +15,4 @@ framework = arduino
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
lib_deps =
|
lib_deps =
|
||||||
mathertel/OneButton@^2.6.1
|
mathertel/OneButton@^2.6.1
|
||||||
|
forntoh/LcdMenu@^5.6.0
|
||||||
|
|
Loading…
Reference in a new issue