2020-09-29 19:58:01 +02:00
|
|
|
// Copyright 2020 Lukas Haubaum
|
|
|
|
//
|
|
|
|
// Licensed under the GNU Affero General Public License, Version 3;
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
|
|
|
|
// https://www.gnu.org/licenses/agpl-3.0.html
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
*
|
|
|
|
* @brief interface for display
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#ifndef _display_H_
|
|
|
|
#define _display_H_
|
|
|
|
|
|
|
|
#include "esp_system.h"
|
|
|
|
|
2020-12-12 14:26:08 +01:00
|
|
|
#define DISPLAY_COLUMNS 8
|
|
|
|
|
|
|
|
#define BLACK 0x0000
|
|
|
|
#define WHITE 0xffff
|
|
|
|
#define RED 0xf800
|
|
|
|
#define GREEN 0x07e0
|
|
|
|
#define BLUE 0x001f
|
|
|
|
#define GRAY 0x8c51
|
|
|
|
#define YELLOW 0xFFE0
|
|
|
|
#define CYAN 0x07FF
|
|
|
|
#define PURPLE 0xF81F
|
|
|
|
|
2020-09-29 19:58:01 +02:00
|
|
|
/**
|
2020-12-17 10:21:10 +01:00
|
|
|
* @brief initalize display
|
2020-09-29 19:58:01 +02:00
|
|
|
*
|
2020-12-17 10:21:10 +01:00
|
|
|
* MUST BE DEFINED DEVICE SPECIFIC
|
2020-09-29 19:58:01 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
void display_start(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief clear the display
|
2020-12-17 10:21:10 +01:00
|
|
|
*
|
|
|
|
* MUST BE DEFINED DEVICE SPECIFIC
|
2020-09-29 19:58:01 +02:00
|
|
|
*
|
|
|
|
* @param[in] line the line to clear
|
|
|
|
* @param[in] invert if true, image is inverted
|
|
|
|
*/
|
2020-12-12 14:26:08 +01:00
|
|
|
void display_clear_line(uint8_t line, bool invert);
|
2020-09-29 19:58:01 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief clear the display
|
2020-12-17 10:21:10 +01:00
|
|
|
*
|
|
|
|
* MUST BE DEFINED DEVICE SPECIFIC
|
2020-09-29 19:58:01 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
void display_clear(void);
|
|
|
|
|
|
|
|
/**
|
2020-12-12 14:26:08 +01:00
|
|
|
* @brief set display on or off
|
2020-12-17 10:21:10 +01:00
|
|
|
*
|
|
|
|
* MUST BE DEFINED DEVICE SPECIFIC
|
2020-09-29 19:58:01 +02:00
|
|
|
*
|
|
|
|
* @param[in] on true if display on, false if display off
|
|
|
|
*/
|
|
|
|
void display_on(bool on);
|
|
|
|
|
2020-12-12 14:26:08 +01:00
|
|
|
/**
|
|
|
|
* @brief set display flipped or not
|
|
|
|
*
|
2020-12-17 10:21:10 +01:00
|
|
|
* MUST BE DEFINED DEVICE SPECIFIC
|
|
|
|
*
|
2020-12-12 14:26:08 +01:00
|
|
|
* @param[in] on true display is flipped
|
|
|
|
*/
|
|
|
|
void display_flipped(bool flipped);
|
|
|
|
|
2020-09-29 19:58:01 +02:00
|
|
|
/**
|
|
|
|
* @brief write raw bytes to display line at starting column
|
|
|
|
*
|
2020-12-17 10:21:10 +01:00
|
|
|
* MUST BE DEFINED DEVICE SPECIFIC
|
|
|
|
*
|
2020-09-29 19:58:01 +02:00
|
|
|
* @param[in] data bytes to display
|
|
|
|
* @param[in] length length of data
|
|
|
|
* @param[in] line the line to write to
|
|
|
|
* @param[in] offset number of offset chars to start
|
|
|
|
* @param[in] invert if true, image is inverted
|
|
|
|
*/
|
|
|
|
void display_data(uint8_t *data, size_t length, uint8_t line, uint8_t offset, bool invert);
|
|
|
|
|
2020-12-17 10:21:10 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void display_utf8_to_ascii(char *input, char *output);
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
uint8_t *display_text_to_data(char *text, size_t text_length, size_t *length);
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
uint8_t *display_text_to_data(char *text, size_t text_length, size_t *length);
|
|
|
|
|
2020-09-29 19:58:01 +02:00
|
|
|
/**
|
|
|
|
* @brief write chars to display
|
|
|
|
*
|
|
|
|
* @param[in] text text to display
|
|
|
|
* @param[in] length length of text
|
|
|
|
* @param[in] line the line to write to
|
|
|
|
* @param[in] offset number of offset chars to start
|
|
|
|
* @param[in] invert if true, image is inverted
|
|
|
|
*/
|
|
|
|
void display_chars(char *text, size_t length, uint8_t line, uint8_t offset, bool invert);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief write text to display line at starting column
|
|
|
|
*
|
|
|
|
* @param[in] text text to display
|
|
|
|
* @param[in] line the line to write to
|
|
|
|
* @param[in] offset number of offset chars to start
|
|
|
|
* @param[in] invert if true, image is inverted
|
|
|
|
*/
|
|
|
|
void display_text_line_column(char *text, uint8_t line, uint8_t offset, bool invert);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief write text to display line
|
|
|
|
*
|
|
|
|
* @param[in] text text to display
|
|
|
|
* @param[in] line the line to write to
|
|
|
|
* @param[in] invert if true, image is inverted
|
|
|
|
*/
|
|
|
|
void display_text_line(char *text, uint8_t line, bool invert);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief display a button element
|
|
|
|
*
|
|
|
|
* @param[in] text button text
|
|
|
|
* @param[in] selected is button selected
|
|
|
|
* @param[in] primary is button primary
|
|
|
|
*/
|
|
|
|
void display_set_button(char *text, bool selected, bool primary);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief display a menu headline
|
|
|
|
*
|
|
|
|
* @param[in] text headline text
|
|
|
|
* @param[in] arrows if left right arrows should be displays
|
|
|
|
* @param[in] line line the line to write to
|
|
|
|
*/
|
|
|
|
void display_menu_headline(char *text, bool arrows, uint8_t line);
|
|
|
|
|
2020-12-12 14:26:08 +01:00
|
|
|
/**
|
|
|
|
* @brief set current color for colored displays
|
|
|
|
*
|
|
|
|
* @param[in] color the color to set
|
|
|
|
*/
|
|
|
|
void display_set_color(uint16_t color);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief set current color for colored displays
|
|
|
|
*
|
|
|
|
* @return the current color
|
|
|
|
*/
|
|
|
|
uint16_t display_get_color(void);
|
|
|
|
|
2020-09-29 19:58:01 +02:00
|
|
|
#endif
|