Move pins out to separate include
This commit is contained in:
parent
0c2549d1df
commit
278055f585
2 changed files with 32 additions and 81 deletions
|
@ -14,4 +14,5 @@ board = pico32
|
|||
framework = arduino
|
||||
upload_port = /dev/ttyUSB0
|
||||
lib_deps =
|
||||
adafruit/Adafruit EPD@^4.5.3
|
||||
adafruit/Adafruit EPD@^4.5.3
|
||||
rlogiacco/CircularBuffer@^1.3.3
|
||||
|
|
110
src/main.cpp
110
src/main.cpp
|
@ -1,48 +1,24 @@
|
|||
/***************************************************
|
||||
Adafruit invests time and resources providing this open source code,
|
||||
please support Adafruit and open-source hardware by purchasing
|
||||
products from Adafruit!
|
||||
|
||||
Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||
MIT license, all text above must be included in any redistribution
|
||||
****************************************************/
|
||||
|
||||
#include "Adafruit_EPD.h"
|
||||
#include "Adafruit_SSD1675BX.h"
|
||||
//#include "icm20602.h"
|
||||
#include "badge_pins.h"
|
||||
|
||||
|
||||
#include <SPI.h>
|
||||
|
||||
//#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
|
||||
//#define VSPI FSPI
|
||||
//#endif
|
||||
|
||||
//static const int spiClk = 10000000;
|
||||
#include <Wire.h>
|
||||
|
||||
SPIClass SPI3(HSPI);
|
||||
|
||||
#define HSPI_MISO 12
|
||||
#define HSPI_MOSI 13
|
||||
#define HSPI_SCLK 14
|
||||
#define HSPI_SS 15
|
||||
|
||||
// DISPLAY
|
||||
#define DISPLAY_WIDTH ((int16_t)(296))
|
||||
#define DISPLAY_HEIGHT ((int16_t)(128))
|
||||
#define DISPLAY_COLOR_BLACK ((uint16_t)(0x0000))
|
||||
#define DISPLAY_COLOR_WHITE ((uint16_t)(0xffff))
|
||||
#define DISPLAY_COLOR_RED ((uint16_t)(0xf800))
|
||||
|
||||
|
||||
#define EPD_DC 25
|
||||
#define EPD_CS 27
|
||||
#define EPD_BUSY 35 // can set to -1 to not use a pin (will wait a fixed delay)
|
||||
#define SRAM_CS -1
|
||||
#define EPD_RESET 26 // can set to -1 and share with microcontroller Reset!
|
||||
#define EPD_SPI &SPI3
|
||||
|
||||
Adafruit_SSD1675BX display(DISPLAY_WIDTH, DISPLAY_HEIGHT, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY, EPD_SPI);
|
||||
|
||||
#define COLOR1 EPD_BLACK
|
||||
#define COLOR2 EPD_RED
|
||||
// IMU
|
||||
#define ESP32_I2C_IMU_ADDR ((char)0x68)
|
||||
|
||||
void testdrawtext(const char *text, uint16_t color) {
|
||||
display.setCursor(0, 0);
|
||||
|
@ -51,60 +27,34 @@ void testdrawtext(const char *text, uint16_t color) {
|
|||
display.print(text);
|
||||
}
|
||||
|
||||
|
||||
void setup() {
|
||||
// Debug serial port
|
||||
Serial.begin(115200);
|
||||
// while (!Serial) { delay(10); }
|
||||
Serial.println("Adafruit EPD test");
|
||||
// Serial.println("Setting up extra SPI bits");
|
||||
// vspi = new SPIClass(VSPI);
|
||||
// hspi = new SPIClass(HSPI);
|
||||
// vspi->begin();
|
||||
// hspi->begin(HSPI_SCLK, HSPI_MISO, HSPI_MOSI, HSPI_SS);
|
||||
// pinMode(hspi->pinSS(), OUTPUT); //HSPI SS);
|
||||
|
||||
display.setRotation(1);
|
||||
display.clearBuffer();
|
||||
display.begin();
|
||||
|
||||
// large block of text
|
||||
display.clearBuffer();
|
||||
testdrawtext(
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur "
|
||||
"adipiscing ante sed nibh tincidunt feugiat. Maecenas enim massa, "
|
||||
"fringilla sed malesuada et, malesuada sit amet turpis. Sed porttitor "
|
||||
"neque ut ante pretium vitae malesuada nunc bibendum. Nullam aliquet "
|
||||
"ultrices massa eu hendrerit. Ut sed nisi lorem. In vestibulum purus a "
|
||||
"tortor imperdiet posuere. ",
|
||||
COLOR1);
|
||||
display.display();
|
||||
|
||||
delay(5000);
|
||||
|
||||
display.clearBuffer();
|
||||
for (int16_t i = 0; i < display.width(); i += 4) {
|
||||
display.drawLine(0, 0, i, display.height() - 1, COLOR1);
|
||||
}
|
||||
|
||||
for (int16_t i = 0; i < display.height(); i += 4) {
|
||||
display.drawLine(display.width() - 1, 0, 0, i,
|
||||
COLOR2); // on grayscale this will be mid-gray
|
||||
}
|
||||
display.display();
|
||||
|
||||
|
||||
Serial.println("End of EPD Test");
|
||||
|
||||
display.setMode(Adafruit_SSD1675BX::kModeBlackWhiteRed);
|
||||
display.fillScreen(DISPLAY_COLOR_BLACK);
|
||||
display.display();
|
||||
display.fillScreen(DISPLAY_COLOR_RED);
|
||||
display.display();
|
||||
display.fillScreen(DISPLAY_COLOR_WHITE);
|
||||
display.display();
|
||||
Serial.println("BSides badge starting up!");
|
||||
|
||||
// ATMEL serial bridge
|
||||
Serial1.begin(115200, SERIAL_8N1, UART_RXD, UART_TXD);
|
||||
Serial.println("ATMEL Serial port started");
|
||||
|
||||
//Serial.println("I2C Bus starting");
|
||||
// Access IMU via I2C
|
||||
//Wire.begin(ESP_SDA, ESP_SCL);
|
||||
|
||||
|
||||
|
||||
// Set up Display
|
||||
Serial.print("Starting display... ");
|
||||
display.setRotation(0);
|
||||
display.clearBuffer();
|
||||
display.setMode(Adafruit_SSD1675BX::kModeBlackWhiteRed);
|
||||
display.begin();
|
||||
Serial.println("Done!");
|
||||
|
||||
// Connect to Wifi
|
||||
// Connect to MQTT Broker
|
||||
// Subscribe to MQTT Topics of interest
|
||||
|
||||
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
|
Loading…
Reference in a new issue