btclock_v3/src/lib/shared.hpp

71 lines
2 KiB
C++
Raw Normal View History

2023-11-07 00:11:12 +00:00
#pragma once
#include <Adafruit_MCP23X17.h>
2023-11-07 20:26:15 +00:00
#include <ArduinoJson.h>
2023-11-07 00:11:12 +00:00
#include <Preferences.h>
2023-11-30 21:38:01 +00:00
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
2024-03-18 18:32:34 +00:00
#include <GxEPD2.h>
#include <GxEPD2_BW.h>
2023-11-13 19:02:58 +00:00
2023-11-30 21:56:50 +00:00
#include <mutex>
2023-11-30 21:38:01 +00:00
#include <utils.hpp>
2023-11-07 00:11:12 +00:00
#include "defaults.hpp"
extern Adafruit_MCP23X17 mcp1;
#ifdef IS_BTCLOCK_S3
extern Adafruit_MCP23X17 mcp2;
#endif
2023-11-07 00:11:12 +00:00
extern Preferences preferences;
2023-11-13 19:02:58 +00:00
extern std::mutex mcpMutex;
2023-11-07 20:26:15 +00:00
2024-03-18 18:32:34 +00:00
#ifdef VERSION_EPD_2_13
#define EPD_CLASS GxEPD2_213_B74
#endif
#ifdef VERSION_EPD_2_9
#define EPD_CLASS GxEPD2_290_T94
#endif
2023-11-07 20:26:15 +00:00
const PROGMEM int SCREEN_BLOCK_HEIGHT = 0;
2023-11-07 20:26:15 +00:00
const PROGMEM int SCREEN_TIME = 3;
const PROGMEM int SCREEN_HALVING_COUNTDOWN = 4;
const PROGMEM int SCREEN_BLOCK_FEE_RATE = 6;
const PROGMEM int SCREEN_SATS_PER_CURRENCY = 10;
const PROGMEM int SCREEN_BTC_TICKER = 20;
// const PROGMEM int SCREEN_BTC_TICKER_USD = 20;
// const PROGMEM int SCREEN_BTC_TICKER_EUR = 21;
// const PROGMEM int SCREEN_BTC_TICKER_GBP = 22;
// const PROGMEM int SCREEN_BTC_TICKER_JPY = 23;
// const PROGMEM int SCREEN_BTC_TICKER_AUD = 24;
// const PROGMEM int SCREEN_BTC_TICKER_CAD = 25;
const PROGMEM int SCREEN_MARKET_CAP = 30;
// const PROGMEM int SCREEN_MARKET_CAP_USD = 30;
// const PROGMEM int SCREEN_MARKET_CAP_EUR = 31;
// const PROGMEM int SCREEN_MARKET_CAP_GBP = 32;
// const PROGMEM int SCREEN_MARKET_CAP_JPY = 33;
// const PROGMEM int SCREEN_MARKET_CAP_AUD = 34;
// const PROGMEM int SCREEN_MARKET_CAP_CAD = 35;
2024-07-29 18:49:46 +00:00
const PROGMEM int SCREEN_BITAXE_HASHRATE = 80;
const PROGMEM int SCREEN_BITAXE_BESTDIFF = 81;
2023-11-07 20:26:15 +00:00
const PROGMEM int SCREEN_COUNTDOWN = 98;
const PROGMEM int SCREEN_CUSTOM = 99;
const int SCREEN_COUNT = 7;
2023-11-30 21:38:01 +00:00
const PROGMEM int screens[SCREEN_COUNT] = {
SCREEN_BLOCK_HEIGHT, SCREEN_SATS_PER_CURRENCY, SCREEN_BTC_TICKER,
SCREEN_TIME, SCREEN_HALVING_COUNTDOWN, SCREEN_MARKET_CAP,
SCREEN_BLOCK_FEE_RATE};
const int usPerSecond = 1000000;
const int usPerMinute = 60 * usPerSecond;
2023-11-07 20:26:15 +00:00
2024-07-29 18:49:46 +00:00
struct ScreenMapping {
int value;
const char* name;
};