2018-07-17 15:15:58 +02:00
|
|
|
#ifndef _DISPLAY_H
|
|
|
|
#define _DISPLAY_H
|
2018-07-15 14:28:05 +02:00
|
|
|
|
2021-03-31 16:20:48 +02:00
|
|
|
#include <libpax_api.h>
|
2018-12-22 14:37:47 +01:00
|
|
|
#include "cyclic.h"
|
2019-09-29 16:46:48 +02:00
|
|
|
#include "qrcode.h"
|
2021-03-31 21:43:51 +02:00
|
|
|
#include "power.h"
|
2022-02-07 15:38:15 +01:00
|
|
|
#include "timekeeper.h"
|
2020-03-29 12:10:42 +02:00
|
|
|
|
|
|
|
#if (HAS_DISPLAY) == 1
|
2020-05-09 23:38:51 +02:00
|
|
|
#include <OneBitDisplay.h>
|
2022-08-16 13:12:09 +02:00
|
|
|
extern ONE_BIT_DISPLAY *dp;
|
2020-03-29 12:10:42 +02:00
|
|
|
#elif (HAS_DISPLAY) == 2
|
2022-08-16 13:16:29 +02:00
|
|
|
#include <bb_spi_lcd.h>
|
|
|
|
extern BB_SPI_LCD *dp;
|
2020-03-29 12:10:42 +02:00
|
|
|
#endif
|
|
|
|
|
2020-03-11 23:47:16 +01:00
|
|
|
#define DISPLAY_PAGES (7) // number of paxcounter display pages
|
2022-07-17 18:07:39 +02:00
|
|
|
#define PLOTBUFFERSIZE (MY_DISPLAY_WIDTH * MY_DISPLAY_HEIGHT / 8)
|
2020-03-11 23:47:16 +01:00
|
|
|
|
2020-03-29 19:41:33 +02:00
|
|
|
// settings for OLED display library
|
|
|
|
#if (HAS_DISPLAY) == 1
|
2022-07-17 18:07:39 +02:00
|
|
|
#define MY_FONT_SMALL FONT_6x8
|
|
|
|
#define MY_FONT_NORMAL FONT_8x8
|
|
|
|
#define MY_FONT_LARGE FONT_16x32
|
|
|
|
#define MY_FONT_STRETCHED FONT_12x16
|
|
|
|
#define MY_DISPLAY_FIRSTLINE 30
|
|
|
|
|
2022-08-06 19:19:54 +02:00
|
|
|
#ifndef MY_DISPLAY_RST
|
|
|
|
#define MY_DISPLAY_RST NOT_A_PIN
|
|
|
|
#endif
|
|
|
|
|
2020-03-29 12:10:42 +02:00
|
|
|
#ifdef MY_DISPLAY_ADDR
|
|
|
|
#define OLED_ADDR MY_DISPLAY_ADDR
|
2020-03-17 22:31:34 +01:00
|
|
|
#else
|
2020-03-29 12:10:42 +02:00
|
|
|
#define OLED_ADDR -1
|
2020-03-17 22:31:34 +01:00
|
|
|
#endif
|
2022-08-06 19:19:54 +02:00
|
|
|
|
2020-03-29 19:41:33 +02:00
|
|
|
#ifndef OLED_FREQUENCY
|
|
|
|
#define OLED_FREQUENCY 400000L
|
|
|
|
#endif
|
2022-08-06 19:19:54 +02:00
|
|
|
|
2022-07-17 18:07:39 +02:00
|
|
|
#ifndef MY_DISPLAY_FGCOLOR
|
2022-08-14 16:49:30 +02:00
|
|
|
#define MY_DISPLAY_FGCOLOR 1 // OLED_WHITE
|
2022-07-17 18:07:39 +02:00
|
|
|
#endif
|
|
|
|
#ifndef MY_DISPLAY_BGCOLOR
|
2022-08-14 16:49:30 +02:00
|
|
|
#define MY_DISPLAY_BGCOLOR 0 // OLED_BLACK
|
2022-07-17 18:07:39 +02:00
|
|
|
#endif
|
2020-03-29 19:41:33 +02:00
|
|
|
|
|
|
|
// settings for TFT display library
|
|
|
|
#elif (HAS_DISPLAY == 2)
|
|
|
|
|
2022-08-16 13:12:09 +02:00
|
|
|
#define MY_FONT_SMALL 2
|
2020-03-29 19:41:33 +02:00
|
|
|
#define MY_FONT_NORMAL 2
|
2022-08-16 13:12:09 +02:00
|
|
|
#define MY_FONT_LARGE 2
|
|
|
|
#define MY_FONT_STRETCHED 2
|
2022-07-17 18:07:39 +02:00
|
|
|
#define MY_DISPLAY_FIRSTLINE 30
|
|
|
|
|
2022-08-16 13:12:09 +02:00
|
|
|
#ifndef TFT_FREQUENCY
|
|
|
|
#define TFT_FREQUENCY 400000L
|
|
|
|
#endif
|
|
|
|
|
2020-03-29 19:41:33 +02:00
|
|
|
#ifndef MY_DISPLAY_FGCOLOR
|
2022-08-16 13:16:29 +02:00
|
|
|
#define MY_DISPLAY_FGCOLOR TFT_YELLOW
|
2020-03-29 19:41:33 +02:00
|
|
|
#endif
|
|
|
|
#ifndef MY_DISPLAY_BGCOLOR
|
2022-08-16 13:16:29 +02:00
|
|
|
#define MY_DISPLAY_BGCOLOR TFT_BLACK
|
2022-08-04 13:52:39 +02:00
|
|
|
#endif
|
|
|
|
|
2020-03-29 19:41:33 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// setup display hardware type, default is OLED 128x64
|
|
|
|
#ifndef OLED_TYPE
|
|
|
|
#define OLED_TYPE OLED_128x64
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef MY_DISPLAY_INVERT
|
|
|
|
#define MY_DISPLAY_INVERT 0
|
|
|
|
#endif
|
2020-03-29 12:10:42 +02:00
|
|
|
|
|
|
|
#ifndef MY_DISPLAY_FLIP
|
|
|
|
#define MY_DISPLAY_FLIP 0
|
|
|
|
#endif
|
2020-03-11 23:47:16 +01:00
|
|
|
|
2020-03-29 12:10:42 +02:00
|
|
|
#ifndef MY_DISPLAY_WIDTH
|
|
|
|
#define MY_DISPLAY_WIDTH 128 // Width in pixels of OLED-display, must be 32X
|
|
|
|
#endif
|
|
|
|
#ifndef MY_DISPLAY_HEIGHT
|
|
|
|
#define MY_DISPLAY_HEIGHT 64 // Height in pixels of OLED-display, must be 64X
|
|
|
|
#endif
|
|
|
|
|
2020-03-11 23:47:16 +01:00
|
|
|
// settings for qr code generator
|
2020-04-06 17:40:45 +02:00
|
|
|
#define QR_VERSION 3 // 29 x 29px
|
2020-03-11 23:47:16 +01:00
|
|
|
|
2020-04-06 17:40:45 +02:00
|
|
|
const uint8_t QR_SCALEFACTOR = (MY_DISPLAY_HEIGHT - 4) / 29; // 4px borderlines
|
2021-03-31 21:43:51 +02:00
|
|
|
|
2022-07-17 18:07:39 +02:00
|
|
|
extern uint8_t DisplayIsOn;
|
2021-03-31 21:43:51 +02:00
|
|
|
extern hw_timer_t *displayIRQ;
|
2021-04-06 21:35:25 +02:00
|
|
|
extern uint8_t volatile channel; // wifi channel rotation counter
|
2019-02-23 21:51:24 +01:00
|
|
|
|
2020-03-29 12:10:42 +02:00
|
|
|
void dp_setup(int contrast = 0);
|
|
|
|
void dp_refresh(bool nextPage = false);
|
|
|
|
void dp_init(bool verbose = false);
|
|
|
|
void dp_shutdown(void);
|
2020-04-06 17:40:45 +02:00
|
|
|
void dp_setFont(int font, int inv = 0);
|
2022-07-17 18:07:39 +02:00
|
|
|
void dp_dump(uint8_t *pBuffer = NULL);
|
2020-03-29 12:10:42 +02:00
|
|
|
void dp_contrast(uint8_t contrast);
|
|
|
|
void dp_clear(void);
|
|
|
|
void dp_power(uint8_t screenon);
|
2019-10-01 13:02:30 +02:00
|
|
|
void dp_printqr(uint16_t offset_x, uint16_t offset_y, const char *Message);
|
2020-03-29 12:10:42 +02:00
|
|
|
void dp_scrollHorizontal(uint8_t *buf, const uint16_t width,
|
|
|
|
const uint16_t height, bool left = true);
|
|
|
|
void dp_scrollVertical(uint8_t *buf, const uint16_t width,
|
|
|
|
const uint16_t height, int offset = 0);
|
|
|
|
int dp_drawPixel(uint8_t *buf, const uint16_t x, const uint16_t y,
|
|
|
|
const uint8_t dot);
|
|
|
|
void dp_plotCurve(uint16_t count, bool reset);
|
|
|
|
void dp_rescaleBuffer(uint8_t *buf, const int factor);
|
2018-07-15 14:28:05 +02:00
|
|
|
|
|
|
|
#endif
|