-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
978 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
// Display Library example for SPI e-paper panels from Dalian Good Display and boards from Waveshare. | ||
// Requires HW SPI and Adafruit_GFX. Caution: the e-paper panels require 3.3V supply AND data lines! | ||
// | ||
// Display Library based on Demo Example from Good Display: http://www.e-paper-display.com/download_list/downloadcategoryid=34&isMode=false.html | ||
// | ||
// Author: Jean-Marc Zingg | ||
// | ||
// Version: see library.properties | ||
// | ||
// Library: https://github.com/ZinggJM/GxEPD2 | ||
|
||
// Supporting Arduino Forum Topics: | ||
// Waveshare e-paper displays with SPI: http://forum.arduino.cc/index.php?topic=487007.0 | ||
// Good Display ePaper for Arduino: https://forum.arduino.cc/index.php?topic=436411.0 | ||
|
||
#define GxEPD2_102_IS_BW true | ||
#define GxEPD2_150_BN_IS_BW true | ||
#define GxEPD2_154_IS_BW true | ||
#define GxEPD2_154_D67_IS_BW true | ||
#define GxEPD2_154_T8_IS_BW true | ||
#define GxEPD2_154_M09_IS_BW true | ||
#define GxEPD2_154_M10_IS_BW true | ||
#define GxEPD2_154_GDEY0154D67_IS_BW true | ||
#define GxEPD2_213_IS_BW true | ||
#define GxEPD2_213_B72_IS_BW true | ||
#define GxEPD2_213_B73_IS_BW true | ||
#define GxEPD2_213_B74_IS_BW true | ||
#define GxEPD2_213_flex_IS_BW true | ||
#define GxEPD2_213_M21_IS_BW true | ||
#define GxEPD2_213_T5D_IS_BW true | ||
#define GxEPD2_213_BN_IS_BW true | ||
#define GxEPD2_213_GDEY0213B74_IS_BW true | ||
#define GxEPD2_260_IS_BW true | ||
#define GxEPD2_260_M01_IS_BW true | ||
#define GxEPD2_266_BN_IS_BW true | ||
#define GxEPD2_266_GDEY0266T90_IS_BW true | ||
#define GxEPD2_270_IS_BW true | ||
#define GxEPD2_270_GDEY027T91_IS_BW true | ||
#define GxEPD2_290_IS_BW true | ||
#define GxEPD2_290_T5_IS_BW true | ||
#define GxEPD2_290_T5D_IS_BW true | ||
#define GxEPD2_290_I6FD_IS_BW true | ||
#define GxEPD2_290_T94_IS_BW true | ||
#define GxEPD2_290_T94_V2_IS_BW true | ||
#define GxEPD2_290_BS_IS_BW true | ||
#define GxEPD2_290_M06_IS_BW true | ||
#define GxEPD2_290_GDEY029T94_IS_BW true | ||
#define GxEPD2_371_IS_BW true | ||
#define GxEPD2_370_TC1_IS_BW true | ||
#define GxEPD2_420_IS_BW true | ||
#define GxEPD2_420_M01_IS_BW true | ||
#define GxEPD2_420_GDEY042T91_IS_BW true | ||
#define GxEPD2_583_IS_BW true | ||
#define GxEPD2_583_T8_IS_BW true | ||
#define GxEPD2_583_GDEQ0583T31_IS_BW true | ||
#define GxEPD2_750_IS_BW true | ||
#define GxEPD2_750_T7_IS_BW true | ||
#define GxEPD2_750_YT7_IS_BW true | ||
#define GxEPD2_1160_T91_IS_BW true | ||
#define GxEPD2_1248_IS_BW true | ||
#define GxEPD2_it60_IS_BW true | ||
#define GxEPD2_it60_1448x1072_IS_BW true | ||
#define GxEPD2_it78_1872x1404_IS_BW true | ||
#define GxEPD2_it103_1872x1404_IS_BW true | ||
// 3-color e-papers | ||
#define GxEPD2_154c_IS_3C true | ||
#define GxEPD2_154_Z90c_IS_3C true | ||
#define GxEPD2_213c_IS_3C true | ||
#define GxEPD2_213_Z19c_IS_3C true | ||
#define GxEPD2_213_Z98c_IS_3C true | ||
#define GxEPD2_266c_IS_3C true | ||
#define GxEPD2_270c_IS_3C true | ||
#define GxEPD2_290c_IS_3C true | ||
#define GxEPD2_290_Z13c_IS_3C true | ||
#define GxEPD2_290_C90c_IS_3C true | ||
#define GxEPD2_420c_IS_3C true | ||
#define GxEPD2_420c_Z21_IS_3C true | ||
#define GxEPD2_583c_IS_3C true | ||
#define GxEPD2_583c_Z83_IS_3C true | ||
#define GxEPD2_750c_IS_3C true | ||
#define GxEPD2_750c_Z08_IS_3C true | ||
#define GxEPD2_750c_Z90_IS_3C true | ||
#define GxEPD2_1248c_IS_3C true | ||
// 4-color e-paper | ||
#define GxEPD2_437c_IS_4C true | ||
// 7-color e-paper | ||
#define GxEPD2_565c_IS_7C true | ||
#define GxEPD2_730c_GDEY073D46_IS_7C true | ||
|
||
#if defined(GxEPD2_DISPLAY_CLASS) && defined(GxEPD2_DRIVER_CLASS) | ||
#define IS_GxEPD2_DRIVER(c, x) (c##x) | ||
#define IS_GxEPD2_DRIVER_BW(x) IS_GxEPD2_DRIVER(x, _IS_BW) | ||
#define IS_GxEPD2_DRIVER_3C(x) IS_GxEPD2_DRIVER(x, _IS_3C) | ||
#define IS_GxEPD2_DRIVER_4C(x) IS_GxEPD2_DRIVER(x, _IS_4C) | ||
#define IS_GxEPD2_DRIVER_7C(x) IS_GxEPD2_DRIVER(x, _IS_7C) | ||
#if IS_GxEPD2_BW(GxEPD2_DISPLAY_CLASS) && IS_GxEPD2_DRIVER_3C(GxEPD2_DRIVER_CLASS) | ||
#error "GxEPD2_BW used with 3-color driver class" | ||
#endif | ||
#if IS_GxEPD2_3C(GxEPD2_DISPLAY_CLASS) && IS_GxEPD2_DRIVER_BW(GxEPD2_DRIVER_CLASS) | ||
#error "GxEPD2_3C used with b/w driver class" | ||
#endif | ||
#if !IS_GxEPD2_DRIVER_BW(GxEPD2_DRIVER_CLASS) && !IS_GxEPD2_DRIVER_3C(GxEPD2_DRIVER_CLASS) && !IS_GxEPD2_DRIVER_4C(GxEPD2_DRIVER_CLASS) && !IS_GxEPD2_DRIVER_7C(GxEPD2_DRIVER_CLASS) | ||
#error "neither BW nor 3C nor 4C nor 7C kind defined for driver class (error in GxEPD2_selection_check.h)" | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// Display Library example for SPI e-paper panels from Dalian Good Display and boards from Waveshare. | ||
// Requires HW SPI and Adafruit_GFX. Caution: the e-paper panels require 3.3V supply AND data lines! | ||
// | ||
// Display Library based on Demo Example from Good Display: http://www.e-paper-display.com/download_list/downloadcategoryid=34&isMode=false.html | ||
// | ||
// Author: Jean-Marc Zingg | ||
// | ||
// Version: see library.properties | ||
// | ||
// Library: https://github.com/ZinggJM/GxEPD2 | ||
|
||
// Supporting Arduino Forum Topics: | ||
// Waveshare e-paper displays with SPI: http://forum.arduino.cc/index.php?topic=487007.0 | ||
// Good Display ePaper for Arduino: https://forum.arduino.cc/index.php?topic=436411.0 | ||
|
||
// mapping suggestion from Waveshare SPI e-Paper to Wemos D1 mini | ||
// BUSY -> D2, RST -> D4, DC -> D3, CS -> D8, CLK -> D5, DIN -> D7, GND -> GND, 3.3V -> 3.3V | ||
// NOTE: connect 3.3k pull-down from D8 to GND if your board or shield has level converters | ||
// NOTE for ESP8266: using SS (GPIO15) for CS may cause boot mode problems, use different pin in case, or 4k7 pull-down | ||
// NOTE: connect 1k pull-up from D4 (RST) to 3.3V if your board or shield has the "clever" reset circuit, or use a different pin | ||
|
||
// mapping suggestion from Waveshare SPI e-Paper to generic ESP8266 | ||
// BUSY -> GPIO4, RST -> GPIO2, DC -> GPIO0, CS -> GPIO15, CLK -> GPIO14, DIN -> GPIO13, GND -> GND, 3.3V -> 3.3V | ||
// NOTE: connect 3.3k pull-down from GPIO15 to GND if your board or shield has level converters | ||
// NOTE for ESP8266: using SS (GPIO15) for CS may cause boot mode problems, use different pin in case, or 3.3k pull-down | ||
// NOTE: connect 1k pull-up from GPIO2 (RST) to 3.3V if your board or shield has the "clever" reset circuit, or use a different pin | ||
|
||
// mapping of Waveshare e-Paper ESP8266 Driver Board, new version | ||
// BUSY -> GPIO5, RST -> GPIO2, DC -> GPIO4, CS -> GPIO15, CLK -> GPIO14, DIN -> GPIO13, GND -> GND, 3.3V -> 3.3V | ||
// NOTE for ESP8266: using SS (GPIO15) for CS may cause boot mode problems, add a 3.3k pull-down in case | ||
// the e-Paper ESP8266 Driver Board should have no boot mode issue, as it doesn't use level converters | ||
|
||
// mapping of Waveshare e-Paper ESP8266 Driver Board, old version | ||
// BUSY -> GPIO16, RST -> GPIO5, DC -> GPIO4, CS -> GPIO15, CLK -> GPIO14, DIN -> GPIO13, GND -> GND, 3.3V -> 3.3V | ||
// NOTE for ESP8266: using SS (GPIO15) for CS may cause boot mode problems, add a 3.3k pull-down in case | ||
// the e-Paper ESP8266 Driver Board should have no boot mode issue, as it doesn't use level converters | ||
|
||
// mapping suggestion for ESP32, e.g. LOLIN32, see .../variants/.../pins_arduino.h for your board | ||
// NOTE: there are variants with different pins for SPI ! CHECK SPI PINS OF YOUR BOARD | ||
// BUSY -> 4, RST -> 16, DC -> 17, CS -> SS(5), CLK -> SCK(18), DIN -> MOSI(23), GND -> GND, 3.3V -> 3.3V | ||
|
||
// mapping of Waveshare ESP32 Driver Board | ||
// BUSY -> 25, RST -> 26, DC -> 27, CS-> 15, CLK -> 13, DIN -> 14 | ||
// NOTE: this board uses "unusual" SPI pins and requires re-mapping of HW SPI to these pins in SPIClass | ||
// see example GxEPD2_WS_ESP32_Driver.ino, it shows how this can be done easily | ||
|
||
// mapping suggestion for ESP32, e.g. LOLIN32 D32 PRO | ||
// BUSY -> 15, RST -> 2, DC -> 0, CS -> 5, CLK -> SCK(18), DIN -> MOSI(23), GND -> GND, 3.3V -> 3.3V | ||
// note: use explicit value for CS, as SS is re-defined to TF_CS(4) in pins_arduino.h for Board: "LOLIN D32 PRO" | ||
|
||
// mapping suggestion for ESP32, e.g. TTGO T8 ESP32-WROVER | ||
// BUSY -> 4, RST -> 0, DC -> 2, CS -> SS(5), CLK -> SCK(18), DIN -> MOSI(23), GND -> GND, 3.3V -> 3.3V | ||
// for use with Board: "ESP32 Dev Module": | ||
|
||
// new mapping suggestion for STM32F1, e.g. STM32F103C8T6 "BluePill" | ||
// BUSY -> A1, RST -> A2, DC -> A3, CS-> A4, CLK -> A5, DIN -> A7 | ||
|
||
// mapping suggestion for AVR, UNO, NANO etc. | ||
// BUSY -> 7, RST -> 9, DC -> 8, CS-> 10, CLK -> 13, DIN -> 11 | ||
|
||
// mapping suggestion for AVR, Arduino Micro, Leonardo | ||
// note: on Leonardo board HW SPI pins are on 6-pin ICSP header | ||
// BUSY -> 7, RST -> 9, DC -> 8, CS-> 10, CLK -> 15, DIN -> 16 | ||
|
||
// mapping of Waveshare Universal e-Paper Raw Panel Driver Shield for Arduino / NUCLEO | ||
// BUSY -> 7, RST -> 8, DC -> 9, CS-> 10, CLK -> 13, DIN -> 11 | ||
|
||
// mapping suggestion for Arduino MEGA | ||
// BUSY -> 7, RST -> 9, DC -> 8, CS-> 53, CLK -> 52, DIN -> 51 | ||
|
||
// mapping suggestion for Arduino DUE, note: pin 77 is on board pin 10, SS is 10 | ||
// BUSY -> 7, RST -> 9, DC -> 8, CS-> 10, CLK -> 76, DIN -> 75 | ||
// SPI pins are on 6 pin 2x3 SPI header, no SS on SPI header! | ||
|
||
// mapping suggestion for Arduino MKR1000 or MKRZERO | ||
// note: can't use SS on MKR1000: is defined as 24, should be 4 | ||
// BUSY -> 5, RST -> 6, DC -> 7, CS-> 4, CLK -> 9, DIN -> 8 | ||
|
||
// mapping suggestion for Arduino Nano RP2040 Connect | ||
// BUSY -> 7, RST -> 9, DC -> 8, CS-> 10, CLK -> 13, DIN -> 11 | ||
|
||
// mapping suggestion for Raspberry Pi Pico RP2040 | ||
// BUSY -> 7, RST -> 9, DC -> 8, CS-> 5, CLK -> 2, DIN -> 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
This directory is intended for project header files. | ||
|
||
A header file is a file containing C declarations and macro definitions | ||
to be shared between several project source files. You request the use of a | ||
header file in your project source file (C, C++, etc) located in `src` folder | ||
by including it, with the C preprocessing directive `#include'. | ||
|
||
```src/main.c | ||
|
||
#include "header.h" | ||
|
||
int main (void) | ||
{ | ||
... | ||
} | ||
``` | ||
|
||
Including a header file produces the same results as copying the header file | ||
into each source file that needs it. Such copying would be time-consuming | ||
and error-prone. With a header file, the related declarations appear | ||
in only one place. If they need to be changed, they can be changed in one | ||
place, and programs that include the header file will automatically use the | ||
new version when next recompiled. The header file eliminates the labor of | ||
finding and changing all the copies as well as the risk that a failure to | ||
find one copy will result in inconsistencies within a program. | ||
|
||
In C, the usual convention is to give header files names that end with `.h'. | ||
It is most portable to use only letters, digits, dashes, and underscores in | ||
header file names, and at most one dot. | ||
|
||
Read more about using header files in official GCC documentation: | ||
|
||
* Include Syntax | ||
* Include Operation | ||
* Once-Only Headers | ||
* Computed Includes | ||
|
||
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#ifndef LIGHTNING_ATM_H | ||
# define LIGHTNING_ATM_H | ||
|
||
#include <Arduino.h> | ||
#include <GxEPD2_BW.h> | ||
#include <Fonts/FreeMonoBold9pt7b.h> | ||
#include "bitmaps/Bitmaps200x200.h" | ||
#include "qrcode.h" | ||
#include "Bitcoin.h" | ||
#include <stdlib.h> | ||
#include <Hash.h> | ||
#include <ctype.h> | ||
|
||
// select the display class and display driver class in the following file (new style): | ||
#include "GxEPD2_display_selection_new_style.h" | ||
|
||
//Generate the URL and secret in LNBITS with the LNURLDevice Extension: | ||
String baseURLATM = "https://legend.lnbits.com/lnurldevice/api/v1/lnurl/234i8"; | ||
String secretATM = "d4RQVjJZQ7ubqvLfLQHCvk"; | ||
String currencyATM = "EUR"; | ||
|
||
#define COIN_PIN 17 | ||
#define PULSE_TIMEOUT 200 | ||
#define LED_BUTTON_PIN 13 | ||
#define BUTTON_PIN 32 | ||
#define MOSFET_PIN 12 | ||
|
||
typedef struct s_qrdata { | ||
uint8_t current_y; | ||
uint8_t current_x; | ||
uint8_t start_x; | ||
uint8_t start_y; | ||
uint8_t module_size; | ||
uint8_t qr_size; | ||
} t_qrdata; | ||
|
||
// put function declarations here: | ||
void clean_screen(); | ||
void to_upper(char *arr); | ||
void qr_withdrawl_screen(String top_message, String bottom_message, const char *qr_content); | ||
char *makeLNURL(float total); | ||
int xor_encrypt(uint8_t *output, size_t outlen, uint8_t *key, size_t keylen, uint8_t *nonce, size_t nonce_len, uint64_t pin, uint64_t amount_in_cents); | ||
void show_inserted_amount(int amount_in_cents); | ||
String get_amount_string(int amount_in_cents); | ||
unsigned int detect_coin(); | ||
void home_screen(); | ||
void IRAM_ATTR button_pressed_itr(); | ||
void wait_for_user_to_scan(); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
This directory is intended for project specific (private) libraries. | ||
PlatformIO will compile them to static libraries and link into executable file. | ||
|
||
The source code of each library should be placed in a an own separate directory | ||
("lib/your_library_name/[here are source files]"). | ||
|
||
For example, see a structure of the following two libraries `Foo` and `Bar`: | ||
|
||
|--lib | ||
| | | ||
| |--Bar | ||
| | |--docs | ||
| | |--examples | ||
| | |--src | ||
| | |- Bar.c | ||
| | |- Bar.h | ||
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html | ||
| | | ||
| |--Foo | ||
| | |- Foo.c | ||
| | |- Foo.h | ||
| | | ||
| |- README --> THIS FILE | ||
| | ||
|- platformio.ini | ||
|--src | ||
|- main.c | ||
|
||
and a contents of `src/main.c`: | ||
``` | ||
#include <Foo.h> | ||
#include <Bar.h> | ||
|
||
int main (void) | ||
{ | ||
... | ||
} | ||
|
||
``` | ||
|
||
PlatformIO Library Dependency Finder will find automatically dependent | ||
libraries scanning project source files. | ||
|
||
More information about PlatformIO Library Dependency Finder | ||
- https://docs.platformio.org/page/librarymanager/ldf.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
; PlatformIO Project Configuration File | ||
; | ||
; Build options: build flags, source filter | ||
; Upload options: custom upload port, speed and extra flags | ||
; Library options: dependencies, extra library storages | ||
; Advanced options: extra scripting | ||
; | ||
; Please visit documentation for the other options and examples | ||
; https://docs.platformio.org/page/projectconf.html | ||
|
||
[env:esp32dev] | ||
platform = espressif32 | ||
board = esp32dev | ||
framework = arduino | ||
monitor_speed = 9600 | ||
lib_deps = | ||
zinggjm/GxEPD2@^1.5.2 | ||
ricmoo/QRCode@^0.0.1 | ||
stepansnigirev/uBitcoin@^0.2.0 |
Oops, something went wrong.