Closed ArielIntel closed 1 year ago
Here is some light reading from Espressif : https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/i2s.html
Is there an option to enable I2S in this board for using it with Arduino IDE ?
I2S is useable in Arduino IDE, yes!
It is a mash-up of I2C and SPI in my opinion and you could use any T-Display S3, GPIO except for GPIO0
Thanks :)
On 10 Dec 2022, at 20:25, teastainGit @.***> wrote:
Here is some light reading from Espressif : https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/i2s.html
Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN. Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach handlowych.
Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.
@ArielIntel what did you need to do? I am trying to use the T-Display S3 with an I2C device just with the qwiic connector and the display seems to not see the device at all. Any advice would be appreciated.
@contractorwolf The qwiic port works OK, what device are you trying to connect to? Also: Are you using Arduino IDE?
@teastainGit I am trying to connect it to this keyboard via the qwiic connector: https://www.solder.party/docs/bbq20kbd/
And I have used that keyboard as an I2C keyboard with a Seeeduino Xiao (using Arduino IDE) without any issues. But I dont know what to think here, doesnt seem to see it. None of the Solder Party examples seem to work. I cant tell what I maybe missing? Any advice?
@contractorwolf With the newer ESP32s and especially the S3 I find that you need to replace Wire.begin(); with Wire.begin(43, 44); //SDA, SCL which is the qwiic connector port! Hope this helps! -Terry
Yeah thanks @teastainGit, but that is what I am trying, I even tried reversing it just in case, but it is like an i2c device isnt registered on those pins for some reason. I am really stumped. Here is some of my code in case you can see something that I am missing:
#include "Arduino.h"
#include "TFT_eSPI.h" /* Please use the TFT library provided in the library. */
#include "pin_config.h"
#include <BBQ10Keyboard.h>
#include "Wire.h"
const String projectName = "BlackTerminal";
int current = 0;
int maxVal = 255;
int delayVal = 200;
int linePosition = 0;
long targetTimeout = 0;
int period = 500;
int currentPage = 0;
int charactersPerLine = 16;
int displayCharacters = 2 * charactersPerLine;
// special character int values
int charaterLeftArrow = 17;
int cursorChar = 18;
int characterUpArrow = 26;
int characterDownArrow = 27;
int commandKeyUp = 6;
int commandKeySelect = 7;
int commandKeyDelete = 8;
int commandKeyEnter = 10;
int commandKeyBack = 17;
int commandKeyDown = 18;
String outgoingMessage = "";
String incomingMessage = "";
BBQ10Keyboard keyboard;
TFT_eSPI tft = TFT_eSPI();
int xpos = 0;
int ypos = 0;
int yLine = 25;
int textSize = 4;
void setup()
{
pinMode(PIN_POWER_ON, OUTPUT);
digitalWrite(PIN_POWER_ON, HIGH);
Serial.begin(9600);
Serial.println("Hello T-Display-S3");
tft.begin();
tft.setRotation(3);
tft.setSwapBytes(true);
delay(2000);
ledcSetup(0, 2000, 8);
ledcAttachPin(PIN_LCD_BL, 0);
ledcWrite(0, 120); // screen brightness 0-255
Wire.begin(43, 44); //SDA, SCL
// start keyboard comms
keyboard.begin();
keyboard.setBacklight(0.5f);
outgoingMessage.reserve(160);
incomingMessage.reserve(500);
tft.setTextSize(1);
tft.fillScreen(TFT_BLACK);
}
void loop()
{
checkForKeyboardMessages();
delay(200);
}
void SendMessageToScreen(uint16_t color, String message){
xpos = 0;
tft.setTextColor(color, TFT_BLACK);
int changeAmount = tft.drawString(message, xpos, ypos, textSize);
xpos += changeAmount;
ypos += yLine;
}
void checkForKeyboardMessages() {
const int keyCount = keyboard.keyCount();
Serial.print("KeyCount:");
Serial.println(keyCount);
// no keypresses found
if (keyCount == 0)
return;
//keypresses found
const BBQ10Keyboard::KeyEvent key = keyboard.keyEvent();
String state = "pressed";
// character keys
if (key.state == BBQ10Keyboard::StateRelease) {
if (!isCommandKey(key)) {
Serial.printf("character key: '%c' (dec %d, hex %02x) %s\r\n", key.key, key.key, key.key, state.c_str());
characterKeyPressed(key);
} else if(isCommandKey(key)){
//Serial.printf("command key: '%c' (dec %d, hex %02x) %s\r\n", key.key, key.key, key.key, state.c_str());
if (key.key == commandKeyUp) { // up button pressed
upCommandPressed();
} else if (key.key == commandKeySelect) { // select button pressed
Serial.println("cursor select");
} else if (key.key == commandKeyDelete) { // delete character button pressed
deleteCharacterPressed();
} else if (key.key == commandKeyEnter) { // enter key pressed
enterCommandPressed();
} else if (key.key == commandKeyBack) { // back button pressed
Serial.println("cursor back");
} else if (key.key == commandKeyDown) { // down button pressed
Serial.print("command key: ");
Serial.println(key.key);
downCommandPressed();
} else { // unknown
Serial.print("unknown command key: ");
Serial.println(key.key);
}
}
}
}
// KEYBOARD METHODS
bool isCommandKey(BBQ10Keyboard::KeyEvent key)
{
if(key.key == commandKeyUp
|| key.key == commandKeySelect
|| key.key == commandKeyDelete
|| key.key == commandKeyEnter
|| key.key == commandKeyBack
|| key.key == commandKeyDown) {
return true;
}
return false;
}
void characterKeyPressed(BBQ10Keyboard::KeyEvent key)
{
currentPage = 0;
outgoingMessage += key.key;
Serial.println(outgoingMessage);
}
void upCommandPressed()
{
if ((currentPage + 1) < (incomingMessage.length() / charactersPerLine)) currentPage++;
Serial.print("up");
Serial.print("len: ");
Serial.println(incomingMessage.length());
Serial.print("div: ");
Serial.println(incomingMessage.length() / charactersPerLine);
Serial.print("currentPage: ");
Serial.println(currentPage);
// sendMessage(incomingMessage, currentPage);
}
void downCommandPressed()
{
if (currentPage > 0) currentPage--;
Serial.print("down, currentPage: ");
}
void deleteCharacterPressed()
{
currentPage = 0;
outgoingMessage.remove(outgoingMessage.length() - 1);
Serial.println(outgoingMessage);
}
void enterCommandPressed()
{
Serial.print("keyboard message: \"");
Serial.print(outgoingMessage);
Serial.println("\"");
}
void sendTextToDefaultNumber(String message) {
Serial.print("SEND TEXT VIA KEYBOARD");
Serial.print(message);
Serial.println("COMPLETED");
}
This is an I2S (ess) issue for sound, not I2C! It is also a CLOSED issue, so few people will see it. I think you should raise a new Issue and get others to help. Having said that I looked at your library and header and they are declaring Wire.begin() which in 2023 is a pain in the ass. Back in the day Arduino and Adafruit tried to save you the confusion of new hobbyists trying to figure out which pins were I2C on which device, by looking at your board type. But NOW the ESP32 is all over the map. They often get it wrong and we have to declare our I2C with our known pins, 43, 44. I know you are doing that but the library or header may be overwriting your declaration of 43, 44 !!! So I would try to declare Wire.begin as late as possible in the setup. -Terry
Is there an option to enable I2S in this board for using it with Arduino IDE ?