I got the screen working with the new board but still no rotary encoder function.
This is the board I'm using -
https://wiki.seeedstudio.com/Wio-Lite-MG126/
Here is the schematic (download) -
https://files.seeedstudio.com/wiki/Wio-Lite-MG126/res/Wio%20Lite%20MG126.zip
Expander interrupt pin is pin D9
SDA/SCL is connected to expander
pins 7,6,5,4,3,2 are connected to the encoders
#include "Menu5_menu.h"
#include <IoAbstraction.h>
#include <IoAbstractionWire.h>
#include <TaskManagerIO.h>
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <SPI.h>
#include <Wire.h>
#define GFX_DC 13
#define GFX_CS 12
//#define GFX_RST 7
//#define GFX_MOSI 11
//#define GFX_MISO 12
//#define GFX_CLK 8 //sck
#define PWM_OUT1 5
#define PWM_OUT2 6
//#define ENABLE_DISABLE_BUTTON PIN_WIRE_SCL
//#define ROTARY2_CLK 7
//#define ROTARY2_DT 9
//#define ROTARY2_SW PIN_WIRE_SDA
IoAbstractionRef ioExpander = ioFrom8574(0x20);
// remember the last state of the IO expander switch so we can log any changes later
//uint8_t lastSwitchIoExp = 0;
//#define MAX_ROTARY_MODES 1
Adafruit_ST7735 gfx = Adafruit_ST7735(GFX_CS, GFX_DC, -1);
AdaColorGfxMenuConfig colorConfig;
void setup() {
//SerialUSB.begin(9600)
pinMode(PWM_OUT1,OUTPUT); // First output PWM
pinMode(PWM_OUT2,OUTPUT); // Second output PWM
ioDevicePinMode(ioExpander, 7, INPUT); //Slot 0 CLK
ioDevicePinMode(ioExpander, 6, INPUT); //Slot 0 DT
ioDevicePinMode(ioExpander, 5, INPUT); //Slot 0 SW
ioDevicePinMode(ioExpander, 4, INPUT); //Slot 1 CLK
ioDevicePinMode(ioExpander, 3, INPUT); //Slot 1 DT
ioDevicePinMode(ioExpander, 2, INPUT); //Slot 1 SW
prepareAdaMonoGfxConfigLoRes(&colorConfig);
gfx.initR(INITR_144GREENTAB); //Adafruit 1.44"
gfx.setRotation(1);
switches.initialiseInterrupt(ioFrom8754(0x20, 9), true);
Wire.begin();
setupMenu();
}
void loop() {
taskManager.runLoop();
}
In the menu file the setupMenu() looks like this
void setupMenu() {
menuPWMOut.setReadOnly(true);
menuResonanceSweep.setReadOnly(true);
menuPWMOutByPulseWidthOutput1.setReadOnly(true);
menuPWMOutByPulseWidthOutput2.setReadOnly(true);
renderer.setGraphicsDevice(&gfx, &colorConfig);
switches.initialiseInterrupt(ioExpander, true);
menuMgr.initForEncoder(&renderer, &menuPWMOut, 7, 6, 5);
remoteServer.begin(&SerialUSB, &applicationInfo);
}
I verified continuity on the expander pins. I know this encoder chip is active low but I don't understand how that ties into "switches.initialiseInterrupt(ioFrom8754(0x20, 9), true);" and the setting of the expander pins via ioDevicePinMode.
Still struggling here. Can I get another set of eyes on this please?