adopted .gitignore file

This commit is contained in:
Jens Noack 2025-02-25 19:33:56 +01:00
parent b15cf8d365
commit 519e15036f
8 changed files with 196 additions and 317 deletions

View file

@ -14,8 +14,19 @@ class EpaperDisplay
private:
GxEPD2_DISPLAY_CLASS *epDisplay;
typedef struct s_qrdata
{
uint16_t current_y;
uint16_t current_x;
uint16_t start_x;
uint16_t start_y;
uint16_t module_size;
uint16_t qr_size;
} t_qrdata;
public:
const uint8_t QR_VERSION = 15; // 20 is standard. 6 for simpler QR code, but does not always work.
EpaperDisplay(uint8_t DSPLY_PIN_CS, uint8_t DSPLY_PIN_DC, uint8_t DSPLY_PIN_RST, uint8_t DSPLY_PIN_BUSY);
~EpaperDisplay();
void init();
@ -25,10 +36,13 @@ class EpaperDisplay
void updateInsertedAmount(const char*);
void cleanScreen();
uint16_t xCenterText(const char* text);
void drawXCenteredText(const char* text, uint8_t textSize, uint16_t y, uint16_t fgColor, uint16_t bgColor );
void drawText(const char* text, uint8_t textSize, uint16_t x, uint16_t y, uint16_t fgColor, uint16_t bgColor );
void drawText(const char* text, uint16_t x, uint16_t y);
void updateText(const char* text, uint16_t x, uint16_t y);
void updateText(const char* text, uint8_t textSize, uint16_t x, uint16_t y, uint16_t fgColor, uint16_t bgColor);
void qrCode(const char* content);
};

View file

@ -0,0 +1,22 @@
#ifndef BLESKOMAT_UTIL_H
#define BLESKOMAT_UTIL_H
// Lnurluril.h/cpp code basically taken form Bleskomat util code: https://github.com/bleskomat/bleskomat-diy and simplyfied to our needs.
// Thank you!
#include <Arduino.h>
#include <lnurl.h>
#include <chrono>
#include <cstring>
#include <string>
namespace lnurlutil {
std::string createQrContent (const double accumulatedValue);
std::string createSignedLnurlWithdraw(const double &amount);
std::string lnurlEncode(const std::string &text);
std::string toUpperCase(std::string s);
std::string urlEncode(const std::string &value);
std::string floatToStringWithPrecision(const float &value, const unsigned short &precision = 6);
}
#endif

View file

@ -1,100 +1,4 @@
#ifndef MAIN_H
#define MAIN_H
#include <Arduino.h>
#include <GxEPD2_BW.h>
#include <Fonts/FreeMonoBold9pt7b.h>
#include "qrcode.h"
#include "Bitcoin.h"
#include <stdlib.h>
#include <Hash.h>
#include <ctype.h>
#include <stdio.h>
// ########################################
// ########### USER ACTION ###########
// ########################################
// Generate and copy in LNbits with the LNURLDevice extension the string for the ATM and paste it here:
const char* lnurlDeviceString = "https://legend.lnbits.com/lnurldevice/api/v1/lnurl/idexample,keyexample,EUR";
// #################### EXAMPLE: https://legend.lnbits.com/lnurldevice/api/v1/lnurl/idexample,keyexample,EUR
// ########################################
// ########################################
// ########################################
// Activate for debugging over Serial (1), deactivate in production use (0)
#define DEBUG_MODE 1
#define COIN_PIN 17
#define PULSE_TIMEOUT 200
const uint8_t LED_BUTTON_PIN = 21; // old: 13 | new: 21
const uint8_t BUTTON_PIN = 32;
#define MOSFET_PIN 16 // old: 12 | new: 16
#define QR_VERSION 6 // 20 is standard. 6 for simpler QR code, but does not always work.
const uint8_t DSPLY_PIN_CS = 26;
const uint8_t DSPLY_PIN_DC = 25;
const uint8_t DSPLY_PIN_RST = 33;
const uint8_t DSPLY_PIN_BUSY = 27;
constexpr unsigned int COINS[] = { 1, 2, 5, 10, 20, 50, 100, 200};
constexpr size_t COINS_COUNT = sizeof(COINS) / sizeof(COINS[0]);
const unsigned long COIN_PULSE_WIDTH_MS = 45;
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;
extern String baseURLATM;
extern String secretATM;
extern String currencyATM;
// put function declarations here:
void clean_screen();
void initialize_display();
void to_upper(char* arr);
void qr_withdrawl_screen(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();
String getValue(String data, char separator, int index);
void display_sleep();
void test_macro();
// Waveshare 1.54 inch e-ink display functions
void home_screen_waveshare_1_54();
void show_inserted_amount_waveshare_1_54(String amount_in_euro);
void qr_withdrawl_screen_waveshare_1_54(const char* qr_content);
void clean_screen_waveshare_1_54();
// Waveshare 2.7 inch e-ink display functions
void home_screen_waveshare_2_7();
void show_inserted_amount_waveshare_2_7(String amount_in_euro);
void qr_withdrawl_screen_waveshare_2_7(const char* qr_content);
void clean_screen_waveshare_2_7();
// Waveshare 2.13 inch e-ink display (250x122) functions
void home_screen_waveshare_2_13();
void show_inserted_amount_waveshare_2_13(String amount_in_euro);
void qr_withdrawl_screen_waveshare_2_13(const char* qr_content);
void clean_screen_waveshare_2_13();
// Waveshare 2.13 inch e-ink display (D) flex (yellow) (212x104) functions
void home_screen_waveshare_2_13_flex();
void show_inserted_amount_waveshare_2_13_flex(String amount_in_euro);
void qr_withdrawl_screen_waveshare_2_13_flex(const char* qr_content);
void clean_screen_waveshare_2_13_flex();
#endif