Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for RPI #43

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2a086e4
remove DOS line endings in source code
slogan621 Jun 21, 2020
5b0ebea
remove DOS line endings in samples
slogan621 Jun 21, 2020
d389b2a
Scaffolding: create base class, arduino and RPI derived classes
slogan621 Jun 22, 2020
95cb54a
further scaffolding, refactoring wip
slogan621 Jun 22, 2020
0c6a6c4
scaffolding - additional refactorings
slogan621 Jun 22, 2020
64ead09
scaffolding - automake support
slogan621 Jun 22, 2020
119d017
compiles on rpi, but surely not valid yet
slogan621 Jun 22, 2020
0e40517
implement compile time factory for pimpl class
slogan621 Jun 22, 2020
5cd457b
minor readme tweeks
slogan621 Jun 23, 2020
ab000ec
arduino impl wip
slogan621 Jun 27, 2020
639174e
some refactorings after trying to comple in Arduino IDE, still
slogan621 Jun 30, 2020
61aea5c
Arduino implementation up and running
slogan621 Jul 3, 2020
9452931
comment out Arduino-specific createChar for now, not being called and…
slogan621 Jul 4, 2020
8c32561
remove Serial.print
slogan621 Jul 4, 2020
2d2b168
fix classname copy paste errors in RPI impl class
slogan621 Jul 4, 2020
59ca7be
factor up the base #defines
slogan621 Jul 4, 2020
d9de2be
cpp version of CustomChars and README that can be used to compile
slogan621 Jul 4, 2020
0484e3e
update README
slogan621 Jul 4, 2020
dc7a74d
update README
slogan621 Jul 4, 2020
22d71fa
update README
slogan621 Jul 4, 2020
6640351
scaffolding for RPI/linux impl
slogan621 Jul 4, 2020
7cda24a
works on RPI (tested on RPI 3 Model B v 1.2)
slogan621 Jul 4, 2020
55b9bfb
helloworld example for raspberry PI
slogan621 Jul 4, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions ArduinoImpl.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include "ArduinoImpl.h"
#include <inttypes.h>

ArduinoImpl::ArduinoImpl(uint8_t lcd_Addr, uint8_t lcd_cols, uint8_t lcd_rows)
{
_Addr = lcd_Addr;
_cols = lcd_cols;
_rows = lcd_rows;
_backlightval = LCD_NOBACKLIGHT;
}

void ArduinoImpl::setBacklightVal(uint8_t val)
{
_backlightval = val;
}

void ArduinoImpl::delayMilliseconds(uint32_t val)
{
::delay(val);
}

void ArduinoImpl::delayMicroseconds(uint32_t val)
{
::delayMicroseconds(val);
}

void ArduinoImpl::init_priv()
{
Serial.print("ArduinoImpl::init_priv\n");
Wire.begin();
}

void ArduinoImpl::expanderWrite(uint8_t _data)
{
Wire.beginTransmission(_Addr);
printIIC((int)(_data) | _backlightval);
Wire.endTransmission();
}
33 changes: 33 additions & 0 deletions ArduinoImpl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef _ARDUINOIMPL_H_
#define _ARDUINOIMPL_H_

#include "LCI2CImpl.h"
#include "LiquidCrystal_I2C.h"

#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#define printIIC(args) Wire.write(args)
#else
#include "WProgram.h"
#define printIIC(args) Wire.send(args)
#endif

#include "Wire.h"

class ArduinoImpl : public LCI2CImpl {
public:
ArduinoImpl(uint8_t lcd_Addr, uint8_t lcd_cols, uint8_t lcd_rows);
virtual ~ArduinoImpl() {};
virtual void init_priv();
virtual void setBacklightVal(uint8_t val);
virtual void delayMilliseconds(uint32_t val);
virtual void delayMicroseconds(uint32_t val);
virtual void expanderWrite(uint8_t _data);
private:
uint8_t _Addr;
uint8_t _cols;
uint8_t _rows;
uint8_t _backlightval;
};

#endif
9 changes: 9 additions & 0 deletions LCI2CImpl.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "LCI2CImpl.h"
#include <inttypes.h>

#if 0
LCI2CImpl::LCI2CImpl(uint8_t lcd_Addr,uint8_t lcd_cols,uint8_t lcd_rows)
{
}
#endif

17 changes: 17 additions & 0 deletions LCI2CImpl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef _LCI2CIMPL_H_
#define _LCI2CIMPL_H_

#include <inttypes.h>
#include <stddef.h>

class LCI2CImpl {
public:
virtual ~LCI2CImpl() {};
virtual void init_priv() = 0;
virtual void setBacklightVal(uint8_t backlightval) = 0;
virtual void expanderWrite(uint8_t _data) = 0;
virtual void delayMilliseconds(uint32_t delay) = 0;
virtual void delayMicroseconds(uint32_t delay) = 0;
};

#endif
Loading