-
• #2
Hi!
You should be able to do:
var HD44780 = require("HD44780").HD44780; connectSPI = function(spi, cs) { return new HD44780(function(x, c) { // ... }); };
That'll work even without touching the module - but if you get something working it'd be great if you could contribute your code so I can stick it in the main one :)
-
• #3
@Gordon, did you just change the module per this occasion? ...because when I look at it I see:
...straight out of the 'Header' of modules/HD44780.js:
////////////////////////////
.....
...If you have one of the LCDs with an I2C backpack, just use:
I2C1.setup({scl:B6, sda:B7}); var lcd = require("HD44780").connectI2C(I2C1); lcd.print("Hello World!");
You can specify device address following way:
require("HD44780").connectI2C(I2C1, 0x3F);
Otherwise try:
var lcd = require("HD44780").connect(A4,A5,A0,A1,A2,A3); lcd.print("Hello World!");
...
.....
////////////////////////////The implementation is:
exports.connectI2C = function(/*=I2C*/i2c, _addr) { return new HD44780(function(x, c) { var a = (x&0xF0) |8| ((c===undefined)?1:0); var b = ((x<<4)&0xF0) |8| ((c===undefined)?1:0); i2c.writeTo(_addr || 0x27, [a,a,a|4,a|4,a,a,b,b,b|4,b|4,b,b]); }); };
So there is a plain
.connect(...
and a.connectI2C(...
. -
• #4
... and right at the bottom there's
exports.HD44780 = HD44780;
- so you can access the HD44780 class directly :) I think this came up before when someone was looking at driving the display via a different kind of IO expander, and it got added there.
Hi guys,
I am planning to interface my Pico with a 20x4 character OLED display OLED-020N004B from Vishay (info here: https://www.vishay.com/displays/list/product-37706/). It seems to behave like a HD44780-like display: the built-in controller is a "OLED-0010", doc here: http://docs-europe.electrocomponents.com/webdocs/1401/0900766b814011cc.pdf
This controller has the ability to interract with 6800, 8080 and SPI interface. SPI seems to be mapped on DB7(MOSI), DB6(MISO), DB5(SCK) and E(CS).
I had a look at the HD44780 module (http://www.espruino.com/modules/HD44780.js); it does not seem to support SPI mode right now.
Does anyone have any idea of how I could add a
.connectSPI
method on this module?