GFX fixes
This commit is contained in:
parent
dc7dc45820
commit
446d0f2d8d
6 changed files with 51 additions and 48 deletions
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"files.associations": {
|
||||
"ios": "cpp"
|
||||
"ios": "cpp",
|
||||
"cstddef": "cpp"
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
#include <Encoder.h>
|
||||
#include <Arduino.h>
|
||||
//#include "src/MortseUi.h"
|
||||
#include "src/MortseUi.h"
|
||||
|
||||
const byte MorseTable[] = {0b00000000,0,0b00010010,0,0,0,0,0b00011110,0b10110110,0b00101101,0,0b10101010,0b00110011,0b00100001,0b00010101,0b10110010,0b10111111,0b10101111,0b10100111,0b10100011,0b10100001,0b10100000,0b10110000,0b10111000,0b10111100,0b10111111,0b00111000,0b00101010,0,0b10110001,0,0b00001100,0b00011010,0b01000001,0b10001000,0b10001010,0b01100100,0b00100000,0b10000010,0b01100110,0b10000000,0b01000000,0b10000111,0b01100101,0b10000100,0b01000011,0b01000010,0b01100111,0b10000110,0b10001101,0b01100010,0b01100000,0b00100001,0b01100001,0b10000001,0b01100011,0b10001001,0b10001011,0b10001100,0b10110110,0,0b00101101,0,0b00001101,0b00011110,0b01000001,0b10001000,0b10001010,0b01100100,0b00100000,0b10000010,0b01100110,0b10000000,0b01000000,0b10000111,0b01100101,0b10000100,0b01000011,0b01000010,0b01100111,0b10000110,0b10001101,0b01100010,0b01100000,0b00100001,0b01100001,0b10000001,0b01100011,0b10001001,0b10001011,0b10001100,0b10110110,0,0b00101101,0};
|
||||
|
||||
|
@ -176,7 +176,7 @@ void loop() {
|
|||
|
||||
//Insert Beat Output here!
|
||||
char outputChar = TestText[Channel1Index];
|
||||
if (outputChar == '/0'){
|
||||
if (outputChar == '\0'){
|
||||
Channel1Index = 0;
|
||||
outputChar = TestText[Channel1Index];
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#include "MortseGfx.h"
|
||||
|
||||
|
||||
byte MortseGfx::cursor_x = 0;
|
||||
byte MortseGfx::cursor_y = 0;
|
||||
enum cursorState MortseGfx::cursor_state = hidden;
|
||||
|
||||
|
||||
void MortseGfx::MortseGfx(){
|
||||
|
||||
MortseGfx::MortseGfx(){
|
||||
cursor_x = 0;
|
||||
cursor_y = 0;
|
||||
cursor_state = hidden;
|
||||
}
|
||||
|
||||
void MortseGfx::MoveCursor(byte row, byte column){
|
||||
|
@ -23,5 +23,5 @@ void MortseGfx::ClearChar(byte row, byte column){
|
|||
}
|
||||
|
||||
void MortseGfx::SetCursorState(cursorState state){
|
||||
|
||||
|
||||
}
|
|
@ -2,10 +2,10 @@
|
|||
#define MORTSE_GFX_H
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <SPI.h>
|
||||
#include <Wire.h>
|
||||
#include <Adafruit_GFX.h>
|
||||
#include <Adafruit_SSD1306.h>
|
||||
//#include <SPI.h>
|
||||
//#include <Wire.h>
|
||||
//#include <Adafruit_GFX.h>
|
||||
//#include <Adafruit_SSD1306.h>
|
||||
|
||||
#define SCREEN_WIDTH 128 // OLED display width, in pixels
|
||||
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
|
||||
|
@ -26,6 +26,13 @@
|
|||
#define LOGO_WIDTH 16
|
||||
//static const unsigned char PROGMEM
|
||||
|
||||
|
||||
enum cursorState {
|
||||
hidden,
|
||||
below
|
||||
};
|
||||
|
||||
|
||||
class MortseGfx
|
||||
{
|
||||
private:
|
||||
|
@ -35,8 +42,7 @@ class MortseGfx
|
|||
|
||||
|
||||
public:
|
||||
|
||||
void MortseGfx();
|
||||
MortseGfx();
|
||||
|
||||
void MoveCursor(byte row, byte column);
|
||||
|
||||
|
@ -47,11 +53,6 @@ class MortseGfx
|
|||
void SetCursorState(cursorState state);
|
||||
|
||||
|
||||
}
|
||||
|
||||
enum cursorState {
|
||||
hidden,
|
||||
below
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -2,33 +2,32 @@
|
|||
|
||||
#include "MortseUi.h"
|
||||
|
||||
|
||||
//Private Variables
|
||||
unsigned long MortseUI::nextCursorFlash = 0;
|
||||
MortseGfx MortseUI::_gfx();
|
||||
|
||||
enum cursorState MortseUI::_cursorStyle = below;
|
||||
bool MortseUI::_cursor_visible = true;
|
||||
|
||||
byte MortseUI::_cursorLine = 0;
|
||||
byte MortseUI::_cursorPosition = 0;
|
||||
byte MortseUI::_cursorLine_buff = 0;
|
||||
byte MortseUI::_cursorPosition_buff = 0;
|
||||
bool MortseUI::_updateCursor = false;
|
||||
|
||||
char MortseUI::_line1[LINE_LENGTH];
|
||||
char MortseUI::_line2[LINE_LENGTH];
|
||||
char MortseUI::_line1_buff[LINE_LENGTH];
|
||||
char MortseUI::_line2_buff[LINE_LENGTH];
|
||||
bool MortseUI::_updateLine1 = false;
|
||||
bool MortseUI::_updateLine2 = false;
|
||||
|
||||
//Public Methods
|
||||
|
||||
/// @brief Constructor for Mortse UI
|
||||
void MortseUi::MortseUi(){
|
||||
|
||||
MortseUI::MortseUI(byte port)
|
||||
{
|
||||
_nextCursorFlash = 0;
|
||||
_gfx = new MortseGfx();
|
||||
|
||||
_cursorStyle = below;
|
||||
_cursor_visible = true;
|
||||
|
||||
_cursorLine = 0;
|
||||
_cursorPosition = 0;
|
||||
_cursorLine_buff = 0;
|
||||
_cursorPosition_buff = 0;
|
||||
_updateCursor = false;
|
||||
|
||||
_line1[LINE_LENGTH];
|
||||
_line2[LINE_LENGTH];
|
||||
_line1_buff[LINE_LENGTH];
|
||||
_line2_buff[LINE_LENGTH];
|
||||
_updateLine1 = false;
|
||||
_updateLine2 = false;
|
||||
|
||||
this->_incrementCursor();
|
||||
this ->_cursor = visible_blink;
|
||||
|
||||
//Initialize lines to be blank
|
||||
for(int ix = 0; ix < LINE_LENGTH; ix++){
|
||||
|
@ -105,4 +104,6 @@ void MortseUi::_updateLine(byte *lineRef, byte *lineBuff, byte lineNo){
|
|||
_gfx->SetChar(lineNo, ix, lineRef[ix]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef MORTSE_UI_H
|
||||
#define MORTSE_UI_H
|
||||
|
||||
#define CURSOR_DELAY_MS 500;
|
||||
#define LINE_LENGTH 16;
|
||||
#define CURSOR_DELAY_MS 500
|
||||
#define LINE_LENGTH 16
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "MortseGfx.h"
|
||||
|
@ -11,7 +11,7 @@ class MortseUI{
|
|||
|
||||
private:
|
||||
//Graphics Library
|
||||
MortseGfx _gfx();
|
||||
MortseGfx *_gfx();
|
||||
|
||||
//Cursor State
|
||||
enum cursorState _cursorStyle;
|
||||
|
@ -70,6 +70,6 @@ class MortseUI{
|
|||
/// @brief Lets the graphics library know that the cursor position should be updated on the screen
|
||||
void UpdateCursor();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue