1
0

Remove TFT_lib as a submodule and add as components again

This commit is contained in:
Christian Loch 2020-04-20 12:39:01 +02:00
parent 1cb397c98a
commit 206c00c10f
27 changed files with 9839 additions and 324 deletions

7
.gitmodules vendored
View File

@ -1,7 +0,0 @@
[submodule "components/ucglib"]
path = components/ucglib
url = https://github.com/olikraus/ucglib.git
branch = master
[submodule "components/ESP32_TFT_library"]
path = components/ESP32_TFT_library
url = https://github.com/jeremyjh/ESP32_TFT_library.git

View File

@ -3,6 +3,4 @@
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
set(EXTRA_COMPONENT_DIRS
externals/ESP32_TFT_library/components)
project(app-template)

View File

@ -1,3 +1,3 @@
idf_component_register(SRCS "esp32_ucglib_hal.c" "display.c"
idf_component_register(SRCS "display.c"
INCLUDE_DIRS "."
REQUIRES ucglib driver tft)
REQUIRES tft)

View File

@ -1,290 +0,0 @@
#include "esp32_ucglib_hal.h"
static spi_device_handle_t spi_hdl;
static ucg_esp32_hal_t pins;
static uint8_t* buffer_1 = 0;
static uint8_t* buffer_2 = 0;
static uint8_t* buffer_3 = 0;
int16_t ucg_esp32_hal(ucg_t *ucg, int16_t msg, uint16_t arg, uint8_t *data) {
//ESP_LOGI("hal", "spi_byte_cb: Received a msg: %d, arg: %d, arg_ptr: %p",
// msg, arg, data);
switch (msg) {
case UCG_COM_MSG_POWER_UP:
//ESP_LOGI("hal", "UCG_COM_MSG_POWER_UP");
/* "data" is a pointer to ucg_com_info_t structure with the following information: */
/* ((ucg_com_info_t *)data)->serial_clk_speed value in nanoseconds */
/* ((ucg_com_info_t *)data)->parallel_clk_speed value in nanoseconds */
/* "arg" is not used */
/* This message is sent once at the uC startup and for power up. */
/* setup i/o or do any other setup */
;
buffer_1 = (uint8_t*) heap_caps_malloc(1, MALLOC_CAP_DMA);
buffer_2 = (uint8_t*) heap_caps_malloc(1, MALLOC_CAP_DMA);
buffer_3 = (uint8_t*) heap_caps_malloc(1, MALLOC_CAP_DMA);
pins.clk = GPIO_NUM_18;
pins.cs = GPIO_NUM_17;
pins.dc = GPIO_NUM_2;
pins.mosi = GPIO_NUM_23;
pins.reset = GPIO_NUM_14;
gpio_config_t gp_config;
gp_config.intr_type = GPIO_INTR_DISABLE;
gp_config.mode = GPIO_MODE_OUTPUT;
gp_config.pin_bit_mask = ((1ULL << pins.reset) | (1ULL << pins.cs) | (1ULL << pins.dc));
gp_config.pull_down_en = GPIO_PULLDOWN_ENABLE;
gp_config.pull_up_en = GPIO_PULLUP_DISABLE;
gpio_config(&gp_config);
spi_bus_config_t* bus_config;
bus_config = heap_caps_calloc(1, sizeof(spi_bus_config_t), MALLOC_CAP_8BIT);
bus_config->mosi_io_num = pins.mosi;
bus_config->miso_io_num = -1;
bus_config->sclk_io_num = pins.clk;
bus_config->quadwp_io_num = -1;
bus_config->quadhd_io_num = -1;
bus_config->max_transfer_sz = 4094;
bus_config->flags = 0;
bus_config->intr_flags = 0;
esp_err_t err = spi_bus_initialize(VSPI_HOST, bus_config, 1);
if (err != ESP_OK) {
ESP_LOGE("hal", "Could not initialize spi bus...");
switch (err) {
case ESP_ERR_INVALID_ARG:
ESP_LOGE("hal", "ESP_ERR_INVALID_ARG");
break;
case ESP_ERR_INVALID_STATE:
ESP_LOGE("hal", "ESP_ERR_INVALID_STATE");
break;
case ESP_ERR_NO_MEM:
ESP_LOGE("hal", "ESP_ERR_NO_MEM");
break;
default:
ESP_LOGE("hal", "Unknown err!");
}
}
ESP_LOGI("hal", "successfully init bus!");
spi_device_interface_config_t* dev_config;
dev_config = heap_caps_calloc(1, sizeof(spi_device_interface_config_t), MALLOC_CAP_8BIT);
dev_config->address_bits = 0;
dev_config->command_bits = 0;
dev_config->dummy_bits = 0;
dev_config->mode = 0;
dev_config->duty_cycle_pos = 0;
dev_config->cs_ena_posttrans = 0;
dev_config->cs_ena_pretrans = 0;
dev_config->clock_speed_hz = SPI_MASTER_FREQ_40M;
dev_config->spics_io_num = pins.cs;
dev_config->queue_size = 200;
dev_config->flags = 0;
dev_config->pre_cb = NULL;
dev_config->post_cb = NULL;
err = spi_bus_add_device(VSPI_HOST, dev_config, &spi_hdl);
if (err != ESP_OK) {
ESP_LOGE("hal", "Could not initialize spi bus...");
switch (err) {
case ESP_ERR_INVALID_ARG:
ESP_LOGE("hal", "ESP_ERR_INVALID_ARG");
break;
case ESP_ERR_INVALID_STATE:
ESP_LOGE("hal", "ESP_ERR_INVALID_STATE");
break;
case ESP_ERR_NO_MEM:
ESP_LOGE("hal", "ESP_ERR_NO_MEM");
break;
default:
ESP_LOGE("hal", "Unknown err!");
}
}
ESP_LOGI("hal", "successfully init bus device!");
break;
case UCG_COM_MSG_POWER_DOWN:
//ESP_LOGI("hal", "UCG_COM_MSG_POWER_DOWN");
/* "data" and "arg" are not used*/
/* This message is sent for a power down request */
spi_bus_remove_device(spi_hdl);
spi_bus_free(HSPI_HOST);
heap_caps_free(buffer_1);
heap_caps_free(buffer_2);
heap_caps_free(buffer_3);
break;
case UCG_COM_MSG_DELAY:
//ESP_LOGI("hal", "UCG_COM_MSG_DELAY");
/* "data" is not used */
/* "arg" contains the number of microseconds for the delay */
/* By receiving this message, the following code should delay by */
/* "arg" microseconds. One microsecond is 0.000001 second */
//vTaskDelay(arg / portTICK_PERIOD_MS / 100);
break;
case UCG_COM_MSG_CHANGE_RESET_LINE:
//ESP_LOGI("hal", "UCG_COM_MSG_CHANGE_RESET_LINE");
/* "data" is not used */
/* "arg" = 1: set the reset output line to 1 */
/* "arg" = 0: set the reset output line to 0 */
gpio_set_level(pins.reset, arg);
break;
case UCG_COM_MSG_CHANGE_CD_LINE:
//ESP_LOGI("hal", "UCG_COM_MSG_CHANGE_CD_LINE");
/* "ucg->com_status" bit 0 contains the old level for the CD line */
/* "data" is not used */
/* "arg" = 1: set the command/data (a0) output line to 1 */
/* "arg" = 0: set the command/data (a0) output line to 0 */
gpio_set_level(pins.dc, arg);
break;
case UCG_COM_MSG_CHANGE_CS_LINE:
//ESP_LOGI("hal", "UCG_COM_MSG_CHANGE_CS_LINE");
/* "ucg->com_status" bit 1 contains the old level for the CS line */
/* "data" is not used */
/* "arg" = 1: set the chipselect output line to 1 */
/* "arg" = 0: set the chipselect output line to 0 */
gpio_set_level(pins.cs, arg);
break;
case UCG_COM_MSG_SEND_BYTE:
//ESP_LOGI("hal", "UCG_COM_MSG_SEND_BYTE");
/* "data" is not used */
/* "arg" contains one byte, which should be sent to the display */
/* The current status of the CD line is available */
/* in bit 0 of u8g->com_status */
;
*buffer_1 = (uint8_t) arg;
spi_transaction_t transaction;
transaction.addr = 0;
transaction.cmd = 0;
transaction.length = 8;
transaction.rxlength = 0;
transaction.tx_buffer = buffer_1;
transaction.rx_buffer = NULL;
transaction.flags = SPI_TRANS_USE_RXDATA ;
spi_device_transmit(spi_hdl, &transaction);
break;
case UCG_COM_MSG_REPEAT_1_BYTE:
{
ESP_LOGW("hal", "UCG_COM_MSG_REPEAT_1_BYTE");
/* "data[0]" contains one byte */
/* repeat sending the byte in data[0] "arg" times */
/* The current status of the CD line is available */
/* in bit 0 of u8g->com_status */
//spi_transaction_t transaction;
//transaction.length = 8;
//transaction.tx_buffer = data[0];
//transaction.flags = SPI_TRANS_USE_TXDATA;
//int i;
//for (i = 0; i < arg; i++) {
// spi_device_polling_transmit(spi_hdl, &transaction);
//}
break;
}
case UCG_COM_MSG_REPEAT_2_BYTES:
{
ESP_LOGW("hal", "UCG_COM_MSG_REPEAT_2_BYTES");
// spi_transaction_t transaction1;
// transaction.flags = SPI_TRANS_USE_TXDATA;
// transaction.length = 8;
// transaction.tx_buffer = data[0];
// spi_transaction_t transaction2;
// transaction2.flags = SPI_TRANS_USE_TXDATA;
// transaction2.length = 8;
// transaction2.tx_buffer = data[1];
// int i;
// for (i = 0; i < arg; i++) {
// spi_device_polling_transmit(spi_hdl, &transaction1);
// spi_device_polling_transmit(spi_hdl, &transaction2);
// }
/* "data[0]" contains first byte */
/* "data[1]" contains second byte */
/* repeat sending the two bytes "arg" times */
/* The current status of the CD line is available */
/* in bit 0 of u8g->com_status */
break;
}
case UCG_COM_MSG_REPEAT_3_BYTES:
{
//ESP_LOGI("hal", "UCG_COM_MSG_REPEAT_3_BYTES");
/* "data[0]" contains first byte */
/* "data[1]" contains second byte */
/* "data[2]" contains third byte */
/* repeat sending the three bytes "arg" times */
/* The current status of the CD line is available */
/* in bit 0 of u8g->com_status */
buffer_3[0] = data[0];
buffer_3[1] = data[1];
buffer_3[2] = data[2];
spi_transaction_t transaction;
transaction.addr = 0;
transaction.cmd = 0;
transaction.length = 3*8;
transaction.rxlength = 0;
transaction.tx_buffer = buffer_3;
transaction.rx_buffer = NULL;
transaction.flags = SPI_TRANS_USE_RXDATA ;
int i;
for (i = 0; i < arg; i++) {
spi_device_transmit(spi_hdl, &transaction);
}
// spi_transaction_t transaction1;
// transaction1.flags = SPI_TRANS_USE_TXDATA ;
// transaction1.length = 8;
// transaction1.tx_buffer = &data[0];
// spi_transaction_t transaction2;
// transaction2.flags = SPI_TRANS_USE_TXDATA ;
// transaction2.length = 8;
// transaction2.tx_buffer = &data[1];
// spi_transaction_t transaction3;
// transaction3.flags = SPI_TRANS_USE_TXDATA ;
// transaction3.length = 8;
// transaction3.tx_buffer = &data[2];
// int i;
// for (i = 0; i < arg; i++) {
// spi_device_polling_transmit(spi_hdl, &transaction1);
// spi_device_polling_transmit(spi_hdl, &transaction2);
// spi_device_polling_transmit(spi_hdl, &transaction3);
// }
break;
}
case UCG_COM_MSG_SEND_STR:
{
ESP_LOGW("hal", "UCG_COM_MSG_SEND_STR");
/* "data" is an array with "arg" bytes */
/* send "arg" bytes to the display */
spi_transaction_t transaction1;
transaction1.flags = SPI_TRANS_USE_RXDATA | SPI_TRANS_USE_TXDATA ;
transaction1.length = 8*arg;
transaction1.tx_buffer = &data[0];
spi_device_polling_transmit(spi_hdl, &transaction1);
break;
}
case UCG_COM_MSG_SEND_CD_DATA_SEQUENCE:
{
//ESP_LOGW("hal", "UCG_COM_MSG_SEND_CD_DATA_SEQUENCE");
/* "data" is a pointer to two bytes, which contain the cd line */
/* status and display data */
/* "arg" contains the number of these two byte tuples which need to */
/* be analysed and sent. Bellow is a example sequence */
/* The content of bit 0 in u8g->com_status is undefined for this message */
while (arg > 0) {
if (*data != 0) {
if (*data == 1) {
/* set CD (=D/C=A0) line to low */
} else {
/* set CD (=D/C=A0) line to high */
}
}
data++;
/* send *data to the display */
data++;
arg--;
}
break;
}
}
return 1;
}

View File

@ -1,22 +0,0 @@
#ifndef ESP32_UCGLIB_HAL_H
#define ESP32_UCGLIB_HAL_H
#include <ucg.h>
#include "driver/gpio.h"
#include "driver/spi_master.h"
#include "driver/i2c.h"
#include "esp_intr_alloc.h"
#include <esp_log.h>
typedef struct {
gpio_num_t clk;
gpio_num_t mosi;
gpio_num_t cs;
gpio_num_t reset;
gpio_num_t dc;
} ucg_esp32_hal_t ;
int16_t ucg_esp32_hal(ucg_t *ucg, int16_t msg, uint16_t arg, uint8_t *data);
#endif /* ESP32_UCGLIB_HAL_H */

View File

@ -0,0 +1,2 @@
FILE(GLOB SOURCES *.c)
idf_component_register(SRCS ${SOURCES} INCLUDE_DIRS ".")

View File

@ -0,0 +1,7 @@
#
# Main Makefile. This is basically the same as a component makefile.
#
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
COMPONENT_SRCDIRS := .
COMPONENT_ADD_INCLUDEDIRS := .

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,354 @@
// Copyright 2010-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// 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.
#ifndef _DRIVER_SPI_MASTER_LOBO_H_
#define _DRIVER_SPI_MASTER_LOBO_H_
#include "esp_err.h"
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
#include "soc/spi_struct.h"
#include "esp_intr_alloc.h"
#include "esp32/rom/lldesc.h"
#ifdef __cplusplus
extern "C"
{
#endif
//Maximum amount of bytes that can be put in one DMA descriptor
#define SPI_MAX_DMA_LEN (4096-4)
/**
* @brief Enum with the three SPI peripherals that are software-accessible in it
*/
typedef enum {
TFT_SPI_HOST=0, ///< SPI1, SPI; Cannot be used in this driver!
TFT_HSPI_HOST=1, ///< SPI2, HSPI
TFT_VSPI_HOST=2 ///< SPI3, VSPI
} spi_lobo_host_device_t;
/**
* @brief This is a configuration structure for a SPI bus.
*
* You can use this structure to specify the GPIO pins of the bus. Normally, the driver will use the
* GPIO matrix to route the signals. An exception is made when all signals either can be routed through
* the IO_MUX or are -1. In that case, the IO_MUX is used, allowing for >40MHz speeds.
*/
typedef struct {
int mosi_io_num; ///< GPIO pin for Master Out Slave In (=spi_d) signal, or -1 if not used.
int miso_io_num; ///< GPIO pin for Master In Slave Out (=spi_q) signal, or -1 if not used.
int sclk_io_num; ///< GPIO pin for Spi CLocK signal, or -1 if not used.
int quadwp_io_num; ///< GPIO pin for WP (Write Protect) signal which is used as D2 in 4-bit communication modes, or -1 if not used.
int quadhd_io_num; ///< GPIO pin for HD (HolD) signal which is used as D3 in 4-bit communication modes, or -1 if not used.
int max_transfer_sz; ///< Maximum transfer size, in bytes. Defaults to 4094 if 0.
} spi_lobo_bus_config_t;
#define LB_SPI_DEVICE_TXBIT_LSBFIRST (1<<0) ///< Transmit command/address/data LSB first instead of the default MSB first
#define LB_SPI_DEVICE_RXBIT_LSBFIRST (1<<1) ///< Receive data LSB first instead of the default MSB first
#define LB_SPI_DEVICE_BIT_LSBFIRST (SPI_TXBIT_LSBFIRST|SPI_RXBIT_LSBFIRST); ///< Transmit and receive LSB first
#define LB_SPI_DEVICE_3WIRE (1<<2) ///< Use spiq for both sending and receiving data
#define LB_SPI_DEVICE_POSITIVE_CS (1<<3) ///< Make CS positive during a transaction instead of negative
#define LB_SPI_DEVICE_HALFDUPLEX (1<<4) ///< Transmit data before receiving it, instead of simultaneously
#define LB_SPI_DEVICE_CLK_AS_CS (1<<5) ///< Output clock on CS line if CS is active
#define SPI_ERR_OTHER_CONFIG 7001
typedef struct spi_lobo_transaction_t spi_lobo_transaction_t;
typedef void(*spi_lobo_transaction_cb_t)(spi_lobo_transaction_t *trans);
/**
* @brief This is a configuration for a SPI slave device that is connected to one of the SPI buses.
*/
typedef struct {
uint8_t command_bits; ///< Amount of bits in command phase (0-16)
uint8_t address_bits; ///< Amount of bits in address phase (0-64)
uint8_t dummy_bits; ///< Amount of dummy bits to insert between address and data phase
uint8_t mode; ///< SPI mode (0-3)
uint8_t duty_cycle_pos; ///< Duty cycle of positive clock, in 1/256th increments (128 = 50%/50% duty). Setting this to 0 (=not setting it) is equivalent to setting this to 128.
uint8_t cs_ena_pretrans; ///< Amount of SPI bit-cycles the cs should be activated before the transmission (0-16). This only works on half-duplex transactions.
uint8_t cs_ena_posttrans; ///< Amount of SPI bit-cycles the cs should stay active after the transmission (0-16)
int clock_speed_hz; ///< Clock speed, in Hz
int spics_io_num; ///< CS GPIO pin for this device, handled by hardware; set to -1 if not used
int spics_ext_io_num; ///< CS GPIO pin for this device, handled by software (spi_lobo_device_select/spi_lobo_device_deselect); only used if spics_io_num=-1
uint32_t flags; ///< Bitwise OR of LB_SPI_DEVICE_* flags
spi_lobo_transaction_cb_t pre_cb; ///< Callback to be called before a transmission is started. This callback from 'spi_lobo_transfer_data' function.
spi_lobo_transaction_cb_t post_cb; ///< Callback to be called after a transmission has completed. This callback from 'spi_lobo_transfer_data' function.
uint8_t selected; ///< **INTERNAL** 1 if the device's CS pin is active
} spi_lobo_device_interface_config_t;
#define LB_SPI_TRANS_MODE_DIO (1<<0) ///< Transmit/receive data in 2-bit mode
#define LB_SPI_TRANS_MODE_QIO (1<<1) ///< Transmit/receive data in 4-bit mode
#define LB_SPI_TRANS_MODE_DIOQIO_ADDR (1<<2) ///< Also transmit address in mode selected by SPI_MODE_DIO/SPI_MODE_QIO
#define LB_SPI_TRANS_USE_RXDATA (1<<3) ///< Receive into rx_data member of spi_lobo_transaction_t instead into memory at rx_buffer.
#define LB_SPI_TRANS_USE_TXDATA (1<<4) ///< Transmit tx_data member of spi_lobo_transaction_t instead of data at tx_buffer. Do not set tx_buffer when using this.
/**
* This structure describes one SPI transmission
*/
struct spi_lobo_transaction_t {
uint32_t flags; ///< Bitwise OR of LB_SPI_TRANS_* flags
uint16_t command; ///< Command data. Specific length was given when device was added to the bus.
uint64_t address; ///< Address. Specific length was given when device was added to the bus.
size_t length; ///< Total data length to be transmitted to the device, in bits; if 0, no data is transmitted
size_t rxlength; ///< Total data length to be received from the device, in bits; if 0, no data is received
void *user; ///< User-defined variable. Can be used to store eg transaction ID or data to be used by pre_cb and/or post_cb callbacks.
union {
const void *tx_buffer; ///< Pointer to transmit buffer, or NULL for no MOSI phase
uint8_t tx_data[4]; ///< If SPI_USE_TXDATA is set, data set here is sent directly from this variable.
};
union {
void *rx_buffer; ///< Pointer to receive buffer, or NULL for no MISO phase
uint8_t rx_data[4]; ///< If SPI_USE_RXDATA is set, data is received directly to this variable
};
};
#define NO_CS 3 // Number of CS pins per SPI host
#define NO_DEV 6 // Number of spi devices per SPI host; more than 3 devices can be attached to the same bus if using software CS's
#define SPI_SEMAPHORE_WAIT 2000 // Time in ms to wait for SPI mutex
typedef struct spi_lobo_device_t spi_lobo_device_t;
typedef struct {
spi_lobo_device_t *device[NO_DEV];
intr_handle_t intr;
spi_dev_t *hw;
//spi_lobo_transaction_t *cur_trans;
int cur_device;
lldesc_t *dmadesc_tx;
lldesc_t *dmadesc_rx;
bool no_gpio_matrix;
int dma_chan;
int max_transfer_sz;
QueueHandle_t spi_lobo_bus_mutex;
spi_lobo_bus_config_t cur_bus_config;
} spi_lobo_host_t;
struct spi_lobo_device_t {
spi_lobo_device_interface_config_t cfg;
spi_lobo_host_t *host;
spi_lobo_bus_config_t bus_config;
spi_lobo_host_device_t host_dev;
};
typedef spi_lobo_device_t* spi_lobo_device_handle_t; ///< Handle for a device on a SPI bus
typedef spi_lobo_host_t* spi_lobo_host_handle_t;
typedef spi_lobo_device_interface_config_t* spi_lobo_device_interface_config_handle_t;
/**
* @brief Add a device. This allocates a CS line for the device, allocates memory for the device structure and hooks
* up the CS pin to whatever is specified.
*
* This initializes the internal structures for a device, plus allocates a CS pin on the indicated SPI master
* peripheral and routes it to the indicated GPIO. All SPI master devices have three hw CS pins and can thus control
* up to three devices. Software handled CS pin can also be used for additional devices on the same SPI bus.
*
* ### If selected SPI host device bus is not yet initialized, it is initialized first with 'bus_config' function ###
*
* @note While in general, speeds up to 80MHz on the dedicated SPI pins and 40MHz on GPIO-matrix-routed pins are
* supported, full-duplex transfers routed over the GPIO matrix only support speeds up to 26MHz.
*
* @param host SPI peripheral to allocate device on (HSPI or VSPI)
* @param dev_config SPI interface protocol config for the device
* @param bus_config Pointer to a spi_lobo_bus_config_t struct specifying how the host device bus should be initialized
* @param handle Pointer to variable to hold the device handle
* @return
* - ESP_ERR_INVALID_ARG if parameter is invalid
* - ESP_ERR_NOT_FOUND if host doesn't have any free CS slots
* - ESP_ERR_NO_MEM if out of memory
* - ESP_OK on success
*/
esp_err_t spi_lobo_bus_add_device(spi_lobo_host_device_t host, spi_lobo_bus_config_t *bus_config, spi_lobo_device_interface_config_t *dev_config, spi_lobo_device_handle_t *handle);
/**
* @brief Remove a device from the SPI bus. If after removal no other device is attached to the spi bus device, it is freed.
*
* @param handle Device handle to free
* @return
* - ESP_ERR_INVALID_ARG if parameter is invalid
* - ESP_ERR_INVALID_STATE if device already is freed
* - ESP_OK on success
*/
esp_err_t spi_lobo_bus_remove_device(spi_lobo_device_handle_t handle);
/**
* @brief Return the actuall SPI bus speed for the spi device in Hz
*
* Some frequencies cannot be set, for example 30000000 will actually set SPI clock to 26666666 Hz
*
* @param handle Device handle obtained using spi_lobo_bus_add_device
*
* @return
* - actuall SPI clock
*/
uint32_t spi_lobo_get_speed(spi_lobo_device_handle_t handle);
/**
* @brief Set the new clock speed for the device, return the actuall SPI bus speed set, in Hz
* This function can be used after the device is initialized
*
* Some frequencies cannot be set, for example 30000000 will actually set SPI clock to 26666666 Hz
*
* @param handle Device handle obtained using spi_lobo_bus_add_device
* @param speed New device spi clock to be set in Hz
*
* @return
* - actuall SPI clock
* - 0 if speed cannot be set
*/
uint32_t spi_lobo_set_speed(spi_lobo_device_handle_t handle, uint32_t speed);
/**
* @brief Select spi device for transmission
*
* It configures spi bus with selected spi device parameters if previously selected device was different than the current
* If device's spics_io_num=-1 and spics_ext_io_num > 0 'spics_ext_io_num' pin is set to active state (low)
*
* spi bus device's semaphore is taken before selecting the device
*
* @param handle Device handle obtained using spi_lobo_bus_add_device
* @param force configure spi bus even if the previous device was the same
*
* @return
* - ESP_ERR_INVALID_ARG if parameter is invalid
* - ESP_OK on success
*/
esp_err_t spi_lobo_device_select(spi_lobo_device_handle_t handle, int force);
/**
* @brief De-select spi device
*
* If device's spics_io_num=-1 and spics_ext_io_num > 0 'spics_ext_io_num' pin is set to inactive state (high)
*
* spi bus device's semaphore is given after selecting the device
*
* @param handle Device handle obtained using spi_lobo_bus_add_device
*
* @return
* - ESP_ERR_INVALID_ARG if parameter is invalid
* - ESP_OK on success
*/
esp_err_t spi_lobo_device_deselect(spi_lobo_device_handle_t handle);
/**
* @brief Check if spi bus uses native spi pins
*
* @param handle Device handle obtained using spi_lobo_bus_add_device
*
* @return
* - true if native spi pins are used
* - false if spi pins are routed through gpio matrix
*/
bool spi_lobo_uses_native_pins(spi_lobo_device_handle_t handle);
/**
* @brief Get spi bus native spi pins
*
* @param handle Device handle obtained using spi_lobo_bus_add_device
*
* @return
* places spi bus native pins in provided pointers
*/
void spi_lobo_get_native_pins(int host, int *sdi, int *sdo, int *sck);
/**
* @brief Transimit and receive data to/from spi device based on transaction data
*
* TRANSMIT 8-bit data to spi device from 'trans->tx_buffer' or 'trans->tx_data' (trans->lenght/8 bytes)
* and RECEIVE data to 'trans->rx_buffer' or 'trans->rx_data' (trans->rx_length/8 bytes)
* Lengths must be 8-bit multiples!
* If trans->rx_buffer is NULL or trans->rx_length is 0, only transmits data
* If trans->tx_buffer is NULL or trans->length is 0, only receives data
* If the device is in duplex mode (LB_SPI_DEVICE_HALFDUPLEX flag NOT set), data are transmitted and received simultaneously.
* If the device is in half duplex mode (LB_SPI_DEVICE_HALFDUPLEX flag IS set), data are received after transmission
* 'address', 'command' and 'dummy bits' are transmitted before data phase IF set in device's configuration
* and IF 'trans->length' and 'trans->rx_length' are NOT both 0
* If device was not previously selected, it will be selected before transmission and deselected after transmission.
*
* @param handle Device handle obtained using spi_lobo_bus_add_device
*
* @param trans Pointer to variable containing the description of the transaction that is executed
*
* @return
* - ESP_ERR_INVALID_ARG if parameter is invalid
* - ESP error code if device cannot be selected
* - ESP_OK on success
*
*/
esp_err_t spi_lobo_transfer_data(spi_lobo_device_handle_t handle, spi_lobo_transaction_t *trans);
/*
* SPI transactions uses the semaphore (taken in select function) to protect the transfer
*/
esp_err_t spi_lobo_device_TakeSemaphore(spi_lobo_device_handle_t handle);
void spi_lobo_device_GiveSemaphore(spi_lobo_device_handle_t handle);
/**
* @brief Setup a DMA link chain
*
* This routine will set up a chain of linked DMA descriptors in the array pointed to by
* ``dmadesc``. Enough DMA descriptors will be used to fit the buffer of ``len`` bytes in, and the
* descriptors will point to the corresponding positions in ``buffer`` and linked together. The
* end result is that feeding ``dmadesc[0]`` into DMA hardware results in the entirety ``len`` bytes
* of ``data`` being read or written.
*
* @param dmadesc Pointer to array of DMA descriptors big enough to be able to convey ``len`` bytes
* @param len Length of buffer
* @param data Data buffer to use for DMA transfer
* @param isrx True if data is to be written into ``data``, false if it's to be read from ``data``.
*/
void spi_lobo_setup_dma_desc_links(lldesc_t *dmadesc, int len, const uint8_t *data, bool isrx);
/**
* @brief Check if a DMA reset is requested but has not completed yet
*
* @return True when a DMA reset is requested but hasn't completed yet. False otherwise.
*/
bool spi_lobo_dmaworkaround_reset_in_progress();
/**
* @brief Mark a DMA channel as idle.
*
* A call to this function tells the workaround logic that this channel will
* not be affected by a global SPI DMA reset.
*/
void spi_lobo_dmaworkaround_idle(int dmachan);
/**
* @brief Mark a DMA channel as active.
*
* A call to this function tells the workaround logic that this channel will
* be affected by a global SPI DMA reset, and a reset like that should not be attempted.
*/
void spi_lobo_dmaworkaround_transfer_active(int dmachan);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,4 @@
FILE(GLOB SOURCES *.c)
idf_component_register(SRCS ${SOURCES}
INCLUDE_DIRS "."
REQUIRES spidriver)

View File

@ -0,0 +1,333 @@
// Default font
// ========================================================================
// This comes with no warranty, implied or otherwise
// This data structure was designed to support Proportional fonts
// fonts. Individual characters do not have to be multiples of 8 bits wide.
// Any width is fine and does not need to be fixed.
// The data bits are packed to minimize data requirements, but the tradeoff
// is that a header is required per character.
// Header Format:
// ------------------------------------------------
// Character Width (Used as a marker to indicate use this format. i.e.: = 0x00)
// Character Height
// First Character (Reserved. 0x00)
// Number Of Characters (Reserved. 0x00)
// Individual Character Format:
// ----------------------------
// Character Code
// Adjusted Y Offset (start Y of visible pixels)
// Width (width of the visible pixels)
// Height (height of the visible pixels)
// xOffset (start X of visible pixels)
// xDelta (the distance to move the cursor. Effective width of the character.)
// Data[n]
// NOTE: You can remove any of these characters if they are not needed in
// your application. The first character number in each Glyph indicates
// the ASCII character code. Therefore, these do not have to be sequential.
// Just remove all the content for a particular character to save space.
// ========================================================================
// dejavu
// Point Size : 12
// Memory usage : 1158 bytes
// # characters : 95
const unsigned char tft_DefaultFont[] =
{
0x00, 0x0B, 0x86, 0x04,
// ' '
0x20,0x0A,0x00,0x00,0x00,0x04,
// '!'
0x21,0x01,0x01,0x09,0x02,0x05,
0xFD,0x80,
// '"'
0x22,0x01,0x03,0x03,0x01,0x05,
0xB6,0x80,
// '#'
0x23,0x02,0x08,0x08,0x01,0x0A,
0x12,0x14,0x7F,0x24,0x24,0xFE,0x28,0x48,
// '$'
0x24,0x01,0x06,0x0B,0x02,0x08,
0x21,0xCA,0xA8,0xE0,0xE2,0xAA,0x70,0x82,0x00,
// '%'
0x25,0x01,0x0A,0x09,0x00,0x0B,
0x61,0x24,0x89,0x22,0x50,0x6D,0x82,0x91,0x24,0x49,0x21,0x80,
// '&'
0x26,0x01,0x09,0x09,0x01,0x0A,
0x30,0x24,0x10,0x0C,0x05,0x14,0x4A,0x19,0x8C,0x7B,0x00,
// '''
0x27,0x01,0x01,0x03,0x01,0x03,
0xE0,
// '('
0x28,0x00,0x03,0x0B,0x01,0x05,
0x69,0x49,0x24,0x48,0x80,
// ')'
0x29,0x00,0x03,0x0B,0x01,0x05,
0x89,0x12,0x49,0x4A,0x00,
// '*'
0x2A,0x01,0x05,0x06,0x01,0x06,
0x25,0x5C,0xEA,0x90,
// '+'
0x2B,0x03,0x07,0x07,0x01,0x0A,
0x10,0x20,0x47,0xF1,0x02,0x04,0x00,
// ','
0x2C,0x08,0x01,0x03,0x01,0x04,
0xE0,
// '-'
0x2D,0x06,0x03,0x01,0x01,0x04,
0xE0,
// '.'
0x2E,0x08,0x01,0x02,0x01,0x04,
0xC0,
// '/'
0x2F,0x01,0x04,0x0A,0x00,0x04,
0x11,0x22,0x24,0x44,0x88,
// '0'
0x30,0x01,0x06,0x09,0x01,0x08,
0x79,0x28,0x61,0x86,0x18,0x52,0x78,
// '1'
0x31,0x01,0x05,0x09,0x01,0x08,
0xE1,0x08,0x42,0x10,0x84,0xF8,
// '2'
0x32,0x01,0x07,0x09,0x01,0x08,
0x79,0x18,0x10,0x20,0x82,0x08,0x20,0xFC,
// '3'
0x33,0x01,0x06,0x09,0x01,0x08,
0x7A,0x10,0x41,0x38,0x30,0x63,0x78,
// '4'
0x34,0x01,0x06,0x09,0x01,0x08,
0x18,0x62,0x92,0x4A,0x2F,0xC2,0x08,
// '5'
0x35,0x01,0x06,0x09,0x01,0x08,
0xFA,0x08,0x3C,0x0C,0x10,0x63,0x78,
// '6'
0x36,0x01,0x06,0x09,0x01,0x08,
0x39,0x18,0x3E,0xCE,0x18,0x53,0x78,
// '7'
0x37,0x01,0x06,0x09,0x01,0x08,
0xFC,0x10,0x82,0x10,0x42,0x08,0x40,
// '8'
0x38,0x01,0x06,0x09,0x01,0x08,
0x7B,0x38,0x73,0x7B,0x38,0x73,0x78,
// '9'
0x39,0x01,0x06,0x09,0x01,0x08,
0x7B,0x28,0x61,0xCD,0xD0,0x62,0x70,
// ':'
0x3A,0x04,0x01,0x06,0x01,0x04,
0xCC,
// ';'
0x3B,0x04,0x01,0x07,0x01,0x04,
0xCE,
// '<'
0x3C,0x03,0x08,0x06,0x01,0x0A,
0x03,0x1E,0xE0,0xE0,0x1E,0x03,
// '='
0x3D,0x05,0x08,0x03,0x01,0x0A,
0xFF,0x00,0xFF,
// '>'
0x3E,0x03,0x08,0x06,0x01,0x0A,
0xC0,0x78,0x07,0x07,0x78,0xC0,
// '?'
0x3F,0x01,0x05,0x09,0x00,0x06,
0x74,0x42,0x22,0x10,0x04,0x20,
// '@'
0x40,0x01,0x0B,0x0B,0x01,0x0D,
0x1F,0x06,0x19,0x01,0x46,0x99,0x13,0x22,0x64,0x54,0x6C,0x40,0x04,0x10,0x7C,0x00,
// 'A'
0x41,0x01,0x08,0x09,0x00,0x08,
0x18,0x18,0x24,0x24,0x24,0x42,0x7E,0x42,0x81,
// 'B'
0x42,0x01,0x06,0x09,0x01,0x08,
0xFA,0x18,0x61,0xFA,0x18,0x61,0xF8,
// 'C'
0x43,0x01,0x06,0x09,0x01,0x08,
0x39,0x18,0x20,0x82,0x08,0x11,0x38,
// 'D'
0x44,0x01,0x07,0x09,0x01,0x09,
0xF9,0x0A,0x0C,0x18,0x30,0x60,0xC2,0xF8,
// 'E'
0x45,0x01,0x06,0x09,0x01,0x08,
0xFE,0x08,0x20,0xFE,0x08,0x20,0xFC,
// 'F'
0x46,0x01,0x05,0x09,0x01,0x07,
0xFC,0x21,0x0F,0xC2,0x10,0x80,
// 'G'
0x47,0x01,0x07,0x09,0x01,0x09,
0x3C,0x86,0x04,0x08,0xF0,0x60,0xA1,0x3C,
// 'H'
0x48,0x01,0x07,0x09,0x01,0x09,
0x83,0x06,0x0C,0x1F,0xF0,0x60,0xC1,0x82,
// 'I'
0x49,0x01,0x01,0x09,0x01,0x03,
0xFF,0x80,
// 'J'
0x4A,0x01,0x03,0x0B,0xFF,0x03,
0x24,0x92,0x49,0x27,0x00,
// 'K'
0x4B,0x01,0x07,0x09,0x01,0x07,
0x85,0x12,0x45,0x0C,0x14,0x24,0x44,0x84,
// 'L'
0x4C,0x01,0x05,0x09,0x01,0x06,
0x84,0x21,0x08,0x42,0x10,0xF8,
// 'M'
0x4D,0x01,0x08,0x09,0x01,0x0A,
0x81,0xC3,0xC3,0xA5,0xA5,0x99,0x99,0x81,0x81,
// 'N'
0x4E,0x01,0x07,0x09,0x01,0x09,
0xC3,0x86,0x8D,0x19,0x31,0x62,0xC3,0x86,
// 'O'
0x4F,0x01,0x07,0x09,0x01,0x09,
0x38,0x8A,0x0C,0x18,0x30,0x60,0xA2,0x38,
// 'P'
0x50,0x01,0x06,0x09,0x01,0x08,
0xFA,0x38,0x63,0xFA,0x08,0x20,0x80,
// 'Q'
0x51,0x01,0x07,0x0B,0x01,0x09,
0x38,0x8A,0x0C,0x18,0x30,0x60,0xA2,0x38,0x10,0x10,
// 'R'
0x52,0x01,0x07,0x09,0x01,0x08,
0xF9,0x1A,0x14,0x6F,0x91,0x21,0x42,0x82,
// 'S'
0x53,0x01,0x06,0x09,0x01,0x08,
0x7B,0x18,0x30,0x78,0x30,0x63,0x78,
// 'T'
0x54,0x01,0x07,0x09,0x00,0x07,
0xFE,0x20,0x40,0x81,0x02,0x04,0x08,0x10,
// 'U'
0x55,0x01,0x07,0x09,0x01,0x09,
0x83,0x06,0x0C,0x18,0x30,0x60,0xA2,0x38,
// 'V'
0x56,0x01,0x0A,0x09,0xFF,0x08,
0x40,0x90,0x22,0x10,0x84,0x21,0x04,0x81,0x20,0x30,0x0C,0x00,
// 'W'
0x57,0x01,0x0B,0x09,0x00,0x0B,
0x84,0x28,0x89,0x11,0x27,0x22,0xA8,0x55,0x0E,0xE0,0x88,0x11,0x00,
// 'X'
0x58,0x01,0x07,0x09,0x00,0x07,
0xC6,0x88,0xA1,0xC1,0x07,0x0A,0x22,0x82,
// 'Y'
0x59,0x01,0x07,0x09,0x00,0x07,
0x82,0x89,0x11,0x43,0x82,0x04,0x08,0x10,
// 'Z'
0x5A,0x01,0x07,0x09,0x01,0x09,
0xFE,0x04,0x10,0x41,0x04,0x10,0x40,0xFE,
// '['
0x5B,0x01,0x02,0x0B,0x02,0x05,
0xEA,0xAA,0xAC,
// '\'
0x5C,0x01,0x04,0x0A,0x00,0x04,
0x88,0x44,0x42,0x22,0x11,
// ']'
0x5D,0x01,0x02,0x0B,0x01,0x05,
0xD5,0x55,0x5C,
// '^'
0x5E,0x01,0x08,0x03,0x01,0x0A,
0x18,0x24,0x42,
// '_'
0x5F,0x0C,0x06,0x01,0x00,0x06,
0xFC,
// '`'
0x60,0x00,0x03,0x02,0x01,0x06,
0x44,
// 'a'
0x61,0x03,0x06,0x07,0x01,0x08,
0x7A,0x30,0x5F,0x86,0x37,0x40,
// 'b'
0x62,0x00,0x06,0x0A,0x01,0x08,
0x82,0x08,0x2E,0xCA,0x18,0x61,0xCE,0xE0,
// 'c'
0x63,0x03,0x05,0x07,0x01,0x07,
0x72,0x61,0x08,0x25,0xC0,
// 'd'
0x64,0x00,0x06,0x0A,0x01,0x08,
0x04,0x10,0x5D,0xCE,0x18,0x61,0xCD,0xD0,
// 'e'
0x65,0x03,0x06,0x07,0x01,0x08,
0x39,0x38,0x7F,0x81,0x13,0x80,
// 'f'
0x66,0x00,0x04,0x0A,0x00,0x04,
0x34,0x4F,0x44,0x44,0x44,
// 'g'
0x67,0x03,0x06,0x0A,0x01,0x08,
0x77,0x38,0x61,0x87,0x37,0x41,0x4C,0xE0,
// 'h'
0x68,0x00,0x06,0x0A,0x01,0x08,
0x82,0x08,0x2E,0xC6,0x18,0x61,0x86,0x10,
// 'i'
0x69,0x01,0x01,0x09,0x01,0x03,
0xBF,0x80,
// 'j'
0x6A,0x01,0x02,0x0C,0x00,0x03,
0x45,0x55,0x56,
// 'k'
0x6B,0x00,0x06,0x0A,0x01,0x07,
0x82,0x08,0x22,0x92,0x8E,0x28,0x92,0x20,
// 'l'
0x6C,0x00,0x01,0x0A,0x01,0x03,
0xFF,0xC0,
// 'm'
0x6D,0x03,0x09,0x07,0x01,0x0B,
0xB3,0x66,0x62,0x31,0x18,0x8C,0x46,0x22,
// 'n'
0x6E,0x03,0x06,0x07,0x01,0x08,
0xBB,0x18,0x61,0x86,0x18,0x40,
// 'o'
0x6F,0x03,0x06,0x07,0x01,0x08,
0x7B,0x38,0x61,0x87,0x37,0x80,
// 'p'
0x70,0x03,0x06,0x0A,0x01,0x08,
0xBB,0x28,0x61,0x87,0x3B,0xA0,0x82,0x00,
// 'q'
0x71,0x03,0x06,0x0A,0x01,0x08,
0x77,0x38,0x61,0x87,0x37,0x41,0x04,0x10,
// 'r'
0x72,0x03,0x04,0x07,0x01,0x05,
0xBC,0x88,0x88,0x80,
// 's'
0x73,0x03,0x06,0x07,0x01,0x07,
0x72,0x28,0x1C,0x0A,0x27,0x00,
// 't'
0x74,0x01,0x04,0x09,0x00,0x05,
0x44,0xF4,0x44,0x44,0x30,
// 'u'
0x75,0x03,0x06,0x07,0x01,0x08,
0x86,0x18,0x61,0x86,0x37,0x40,
// 'v'
0x76,0x03,0x08,0x07,0xFF,0x06,
0x42,0x42,0x24,0x24,0x24,0x18,0x18,
// 'w'
0x77,0x03,0x09,0x07,0x00,0x09,
0x88,0xC4,0x57,0x4A,0xA5,0x51,0x10,0x88,
// 'x'
0x78,0x03,0x06,0x07,0x00,0x06,
0x85,0x24,0x8C,0x49,0x28,0x40,
// 'y'
0x79,0x03,0x08,0x0A,0xFF,0x06,
0x42,0x42,0x24,0x24,0x14,0x18,0x08,0x08,0x10,0x60,
// 'z'
0x7A,0x03,0x05,0x07,0x00,0x05,
0xF8,0x44,0x44,0x43,0xE0,
// '{'
0x7B,0x01,0x05,0x0B,0x02,0x08,
0x19,0x08,0x42,0x60,0x84,0x21,0x06,
// '|'
0x7C,0x01,0x01,0x0C,0x02,0x04,
0xFF,0xF0,
// '}'
0x7D,0x01,0x05,0x0B,0x01,0x08,
0xC1,0x08,0x42,0x0C,0x84,0x21,0x30,
// '~'
0x7E,0x04,0x08,0x03,0x01,0x0A,
0x00,0x71,0x8E,
// Terminator
0xFF
};

View File

@ -0,0 +1,322 @@
// ============================================================================
// Proportional font Header Format:
// ------------------------------------------------
// Character Width (Used as a marker to indicate use this format. i.e.: = 0x00)
// Character Height
// First Character (Reserved. 0x00)
// Number Of Characters (Reserved. 0x00)
// Individual Character Format:
// ----------------------------
// Character Code
// Adjusted Y Offset
// Width
// Height
// xOffset
// xDelta (the distance to move the cursor. Effective width of the character.)
// Data[n]
// NOTE: You can remove any of these characters if they are not needed in
// your application. The first character number in each Glyph indicates
// the ASCII character code. Therefore, these do not have to be sequential.
// Just remove all the content for a particular character to save space.
// ============================================================================
// DejaVuSans
// Point Size : 18
// Memory usage : 1828 bytes
// # characters : 95
const unsigned char tft_Dejavu18[] =
{
0x00, 0x12, 0x00, 0x00,
// ' '
0x20,0x0E,0x00,0x00,0x00,0x06,
// '!'
0x21,0x01,0x02,0x0D,0x03,0x07,
0xFF,0xFF,0xC3,0xC0,
// '"'
0x22,0x01,0x06,0x05,0x01,0x08,
0xCF,0x3C,0xF3,0xCC,
// '#'
0x23,0x00,0x0C,0x0E,0x01,0x0F,
0x04,0x40,0x44,0x0C,0xC0,0xC8,0x7F,0xF7,0xFF,0x09,0x81,0x90,0xFF,0xEF,0xFE,0x13,0x03,0x30,0x32,0x02,0x20,
// '$'
0x24,0x00,0x0A,0x11,0x01,0x0B,
0x08,0x02,0x03,0xE1,0xFC,0xE9,0x32,0x0F,0x81,0xF8,0x0F,0x02,0x60,0x9A,0x2E,0xFF,0x1F,0x80,0x80,0x20,0x08,0x00,
// '%'
0x25,0x01,0x0F,0x0D,0x01,0x11,
0x78,0x10,0x90,0x43,0x31,0x86,0x62,0x0C,0xC8,0x19,0x10,0x1E,0x4F,0x01,0x12,0x02,0x66,0x08,0xCC,0x31,0x98,0x41,0x21,0x03,0xC0,
// '&'
0x26,0x01,0x0C,0x0D,0x01,0x0D,
0x0F,0x01,0xF8,0x30,0x83,0x00,0x38,0x03,0xC0,0x7E,0x6C,0x76,0xC3,0xCC,0x18,0xE1,0xC7,0xFE,0x3E,0x70,
// '''
0x27,0x01,0x02,0x05,0x01,0x04,
0xFF,0xC0,
// '('
0x28,0x00,0x04,0x10,0x02,0x07,
0x32,0x66,0x4C,0xCC,0xCC,0xC4,0x66,0x23,
// ')'
0x29,0x00,0x04,0x10,0x01,0x07,
0xC4,0x66,0x23,0x33,0x33,0x32,0x66,0x4C,
// '*'
0x2A,0x01,0x07,0x08,0x01,0x09,
0x11,0x25,0x51,0xC3,0x8A,0xA4,0x88,
// '+'
0x2B,0x02,0x0C,0x0C,0x02,0x0F,
0x06,0x00,0x60,0x06,0x00,0x60,0x06,0x0F,0xFF,0xFF,0xF0,0x60,0x06,0x00,0x60,0x06,0x00,0x60,
// ','
0x2C,0x0C,0x03,0x04,0x01,0x06,
0x6D,0x40,
// '-'
0x2D,0x08,0x05,0x02,0x01,0x07,
0xFF,0xC0,
// '.'
0x2E,0x0C,0x02,0x02,0x02,0x06,
0xF0,
// '/'
0x2F,0x01,0x06,0x0F,0x00,0x06,
0x0C,0x31,0x86,0x18,0xE3,0x0C,0x31,0xC6,0x18,0x63,0x0C,0x00,
// '0'
0x30,0x01,0x09,0x0D,0x01,0x0B,
0x3E,0x3F,0x98,0xD8,0x3C,0x1E,0x0F,0x07,0x83,0xC1,0xE0,0xD8,0xCF,0xE3,0xE0,
// '1'
0x31,0x01,0x08,0x0D,0x02,0x0B,
0x38,0xF8,0xD8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0xFF,
// '2'
0x32,0x01,0x09,0x0D,0x01,0x0B,
0x7C,0x7F,0x21,0xC0,0x60,0x30,0x30,0x18,0x18,0x18,0x18,0x18,0x1F,0xEF,0xF0,
// '3'
0x33,0x01,0x09,0x0D,0x01,0x0B,
0x7E,0x7F,0xA0,0xE0,0x30,0x39,0xF0,0xFC,0x07,0x01,0x80,0xE0,0xFF,0xE7,0xE0,
// '4'
0x34,0x01,0x0A,0x0D,0x01,0x0B,
0x07,0x01,0xC0,0xB0,0x6C,0x13,0x08,0xC6,0x31,0x0C,0xFF,0xFF,0xF0,0x30,0x0C,0x03,0x00,
// '5'
0x35,0x01,0x08,0x0D,0x01,0x0B,
0x7E,0x7E,0x60,0x60,0x7C,0x7E,0x47,0x03,0x03,0x03,0x87,0xFE,0x7C,
// '6'
0x36,0x01,0x09,0x0D,0x01,0x0B,
0x1E,0x1F,0x9C,0x5C,0x0C,0x06,0xF3,0xFD,0xC7,0xC1,0xE0,0xD8,0xEF,0xE1,0xE0,
// '7'
0x37,0x01,0x08,0x0D,0x01,0x0B,
0xFF,0xFF,0x06,0x06,0x06,0x0E,0x0C,0x0C,0x1C,0x18,0x18,0x38,0x30,
// '8'
0x38,0x01,0x09,0x0D,0x01,0x0B,
0x3E,0x3F,0xB8,0xF8,0x3E,0x39,0xF1,0xFD,0xC7,0xC1,0xE0,0xF8,0xEF,0xE3,0xE0,
// '9'
0x39,0x01,0x09,0x0D,0x01,0x0B,
0x3C,0x3F,0xB8,0xD8,0x3C,0x1F,0x1D,0xFE,0x7B,0x01,0x81,0xD1,0xCF,0xC3,0xC0,
// ':'
0x3A,0x05,0x02,0x09,0x02,0x06,
0xF0,0x03,0xC0,
// ';'
0x3B,0x05,0x03,0x0B,0x01,0x06,
0x6C,0x00,0x03,0x6A,0x00,
// '<'
0x3C,0x04,0x0B,0x0A,0x02,0x0F,
0x00,0x20,0x3C,0x1F,0x1F,0x0F,0x81,0xF0,0x0F,0x80,0x3E,0x01,0xE0,0x04,
// '='
0x3D,0x05,0x0B,0x06,0x02,0x0F,
0xFF,0xFF,0xFC,0x00,0x00,0x0F,0xFF,0xFF,0xC0,
// '>'
0x3E,0x04,0x0B,0x0A,0x02,0x0F,
0x80,0x1E,0x01,0xF0,0x07,0xC0,0x3E,0x07,0xC3,0xE3,0xE0,0xF0,0x10,0x00,
// '?'
0x3F,0x01,0x07,0x0D,0x01,0x0A,
0x79,0xFA,0x38,0x30,0x61,0x86,0x18,0x30,0x60,0x01,0x83,0x00,
// '@'
0x40,0x01,0x10,0x10,0x01,0x12,
0x07,0xE0,0x1F,0xF8,0x3C,0x1C,0x70,0x06,0x60,0x07,0xE3,0x63,0xC7,0xE3,0xC6,0x63,0xC6,0x66,0xC7,0xFC,0xE3,0x70,0x60,0x00,0x70,0x00,0x3C,0x30,0x1F,0xF0,0x07,0xC0,
// 'A'
0x41,0x01,0x0C,0x0D,0x00,0x0C,
0x06,0x00,0x60,0x0F,0x00,0xF0,0x19,0x81,0x98,0x19,0x83,0x0C,0x3F,0xC7,0xFE,0x60,0x66,0x06,0xC0,0x30,
// 'B'
0x42,0x01,0x09,0x0D,0x02,0x0C,
0xFC,0x7F,0xB0,0xD8,0x6C,0x37,0xF3,0xF9,0x86,0xC1,0xE0,0xF0,0xFF,0xEF,0xE0,
// 'C'
0x43,0x01,0x0B,0x0D,0x01,0x0D,
0x0F,0xC7,0xFD,0xC0,0xB0,0x0C,0x01,0x80,0x30,0x06,0x00,0xC0,0x0C,0x01,0xC0,0x9F,0xF0,0xFC,
// 'D'
0x44,0x01,0x0B,0x0D,0x02,0x0E,
0xFE,0x1F,0xF3,0x07,0x60,0x6C,0x07,0x80,0xF0,0x1E,0x03,0xC0,0x78,0x1B,0x07,0x7F,0xCF,0xE0,
// 'E'
0x45,0x01,0x08,0x0D,0x02,0x0B,
0xFF,0xFF,0xC0,0xC0,0xC0,0xFF,0xFF,0xC0,0xC0,0xC0,0xC0,0xFF,0xFF,
// 'F'
0x46,0x01,0x08,0x0D,0x02,0x0A,
0xFF,0xFF,0xC0,0xC0,0xC0,0xFE,0xFE,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,
// 'G'
0x47,0x01,0x0B,0x0D,0x01,0x0E,
0x0F,0xC7,0xFD,0xC0,0xB0,0x0C,0x01,0x87,0xF0,0xFE,0x03,0xC0,0x6C,0x0D,0xC1,0x9F,0xE0,0xF8,
// 'H'
0x48,0x01,0x0A,0x0D,0x02,0x0E,
0xC0,0xF0,0x3C,0x0F,0x03,0xC0,0xFF,0xFF,0xFF,0x03,0xC0,0xF0,0x3C,0x0F,0x03,0xC0,0xC0,
// 'I'
0x49,0x01,0x02,0x0D,0x02,0x06,
0xFF,0xFF,0xFF,0xC0,
// 'J'
0x4A,0x01,0x05,0x11,0xFF,0x06,
0x18,0xC6,0x31,0x8C,0x63,0x18,0xC6,0x31,0x8C,0xFE,0xE0,
// 'K'
0x4B,0x01,0x0B,0x0D,0x02,0x0C,
0xC1,0x98,0x63,0x18,0x66,0x0D,0x81,0xE0,0x3C,0x06,0xC0,0xCC,0x18,0xC3,0x0C,0x60,0xCC,0x0C,
// 'L'
0x4C,0x01,0x08,0x0D,0x02,0x0A,
0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xFF,0xFF,
// 'M'
0x4D,0x01,0x0C,0x0D,0x02,0x10,
0xE0,0x7F,0x0F,0xF0,0xFD,0x8B,0xD9,0xBD,0x9B,0xCF,0x3C,0xF3,0xC6,0x3C,0x63,0xC0,0x3C,0x03,0xC0,0x30,
// 'N'
0x4E,0x01,0x0A,0x0D,0x02,0x0E,
0xE0,0xF8,0x3F,0x0F,0xC3,0xD8,0xF6,0x3C,0xCF,0x1B,0xC6,0xF0,0xFC,0x3F,0x07,0xC1,0xC0,
// 'O'
0x4F,0x01,0x0C,0x0D,0x01,0x0E,
0x1F,0x83,0xFC,0x70,0xE6,0x06,0xC0,0x3C,0x03,0xC0,0x3C,0x03,0xC0,0x36,0x06,0x70,0xE3,0xFC,0x1F,0x80,
// 'P'
0x50,0x01,0x08,0x0D,0x02,0x0B,
0xFC,0xFE,0xC7,0xC3,0xC3,0xC7,0xFE,0xFC,0xC0,0xC0,0xC0,0xC0,0xC0,
// 'Q'
0x51,0x01,0x0C,0x0F,0x01,0x0E,
0x1F,0x83,0xFC,0x70,0xE6,0x06,0xC0,0x3C,0x03,0xC0,0x3C,0x03,0xC0,0x36,0x06,0x70,0xE3,0xFC,0x1F,0x80,0x18,0x00,0xC0,
// 'R'
0x52,0x01,0x0A,0x0D,0x02,0x0D,
0xFC,0x3F,0x8C,0x73,0x0C,0xC3,0x31,0xCF,0xE3,0xF0,0xC6,0x30,0xCC,0x33,0x06,0xC1,0xC0,
// 'S'
0x53,0x01,0x0A,0x0D,0x01,0x0B,
0x3E,0x1F,0xCE,0x13,0x00,0xC0,0x1F,0x03,0xF0,0x0E,0x01,0x80,0x68,0x3B,0xFC,0x7E,0x00,
// 'T'
0x54,0x01,0x0C,0x0D,0x00,0x0C,
0xFF,0xFF,0xFF,0x06,0x00,0x60,0x06,0x00,0x60,0x06,0x00,0x60,0x06,0x00,0x60,0x06,0x00,0x60,0x06,0x00,
// 'U'
0x55,0x01,0x0A,0x0D,0x02,0x0E,
0xC0,0xF0,0x3C,0x0F,0x03,0xC0,0xF0,0x3C,0x0F,0x03,0xC0,0xF0,0x36,0x19,0xFE,0x1E,0x00,
// 'V'
0x56,0x01,0x0C,0x0D,0x00,0x0C,
0xC0,0x36,0x06,0x60,0x66,0x06,0x30,0xC3,0x0C,0x19,0x81,0x98,0x19,0x80,0xF0,0x0F,0x00,0x60,0x06,0x00,
// 'W'
0x57,0x01,0x11,0x0D,0x01,0x13,
0xC1,0xC1,0xE0,0xE0,0xD8,0xF8,0xCC,0x6C,0x66,0x36,0x33,0x1B,0x18,0xD8,0xD8,0x6C,0x6C,0x36,0x36,0x1F,0x1F,0x07,0x07,0x03,0x83,0x81,0xC1,0xC0,
// 'X'
0x58,0x01,0x0B,0x0D,0x01,0x0D,
0x70,0xE6,0x18,0xE6,0x0D,0xC0,0xF0,0x1C,0x03,0x80,0x78,0x1B,0x07,0x30,0xC7,0x30,0x6E,0x0E,
// 'Y'
0x59,0x01,0x0C,0x0D,0x00,0x0C,
0xE0,0x76,0x06,0x30,0xC1,0x98,0x19,0x80,0xF0,0x06,0x00,0x60,0x06,0x00,0x60,0x06,0x00,0x60,0x06,0x00,
// 'Z'
0x5A,0x01,0x0B,0x0D,0x01,0x0D,
0xFF,0xFF,0xFC,0x07,0x01,0xC0,0x30,0x0E,0x03,0x80,0xE0,0x18,0x06,0x01,0xC0,0x7F,0xFF,0xFE,
// '['
0x5B,0x00,0x04,0x10,0x01,0x07,
0xFF,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xFF,
// '\'
0x5C,0x01,0x06,0x0F,0x00,0x06,
0xC3,0x06,0x18,0x61,0xC3,0x0C,0x30,0xE1,0x86,0x18,0x30,0xC0,
// ']'
0x5D,0x00,0x04,0x10,0x02,0x07,
0xFF,0x33,0x33,0x33,0x33,0x33,0x33,0xFF,
// '^'
0x5E,0x01,0x0B,0x05,0x02,0x0F,
0x0E,0x03,0xE0,0xC6,0x30,0x6C,0x06,
// '_'
0x5F,0x10,0x09,0x02,0x00,0x09,
0xFF,0xFF,0xC0,
// '`'
0x60,0x00,0x04,0x03,0x02,0x09,
0xC6,0x30,
// 'a'
0x61,0x04,0x08,0x0A,0x01,0x0A,
0x3C,0x7E,0x47,0x03,0x3F,0xFF,0xC3,0xC7,0xFF,0x7B,
// 'b'
0x62,0x00,0x09,0x0E,0x02,0x0B,
0xC0,0x60,0x30,0x18,0x0D,0xE7,0xFB,0x8F,0x83,0xC1,0xE0,0xF0,0x7C,0x7F,0xF6,0xF0,
// 'c'
0x63,0x04,0x08,0x0A,0x01,0x09,
0x1E,0x7F,0x61,0xC0,0xC0,0xC0,0xC0,0x61,0x7F,0x1E,
// 'd'
0x64,0x00,0x09,0x0E,0x01,0x0B,
0x01,0x80,0xC0,0x60,0x33,0xDB,0xFF,0x8F,0x83,0xC1,0xE0,0xF0,0x7C,0x77,0xF9,0xEC,
// 'e'
0x65,0x04,0x0A,0x0A,0x01,0x0B,
0x1F,0x1F,0xE6,0x1F,0x03,0xFF,0xFF,0xFC,0x01,0x81,0x7F,0xC7,0xE0,
// 'f'
0x66,0x00,0x07,0x0E,0x00,0x06,
0x1E,0x7C,0xC1,0x8F,0xFF,0xCC,0x18,0x30,0x60,0xC1,0x83,0x06,0x00,
// 'g'
0x67,0x04,0x09,0x0E,0x01,0x0B,
0x3D,0xBF,0xF8,0xF8,0x3C,0x1E,0x0F,0x07,0xC7,0x7F,0x9E,0xC0,0x68,0x67,0xF1,0xF0,
// 'h'
0x68,0x00,0x08,0x0E,0x02,0x0B,
0xC0,0xC0,0xC0,0xC0,0xDE,0xFE,0xE7,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,
// 'i'
0x69,0x00,0x02,0x0E,0x02,0x05,
0xF0,0xFF,0xFF,0xF0,
// 'j'
0x6A,0x00,0x04,0x12,0x00,0x05,
0x33,0x00,0x33,0x33,0x33,0x33,0x33,0x33,0xEC,
// 'k'
0x6B,0x00,0x09,0x0E,0x02,0x0A,
0xC0,0x60,0x30,0x18,0x0C,0x36,0x33,0x31,0xB0,0xF0,0x78,0x36,0x19,0x8C,0x66,0x18,
// 'l'
0x6C,0x00,0x02,0x0E,0x02,0x05,
0xFF,0xFF,0xFF,0xF0,
// 'm'
0x6D,0x04,0x0E,0x0A,0x02,0x11,
0xDC,0x7B,0xFB,0xEE,0x79,0xF0,0xC3,0xC3,0x0F,0x0C,0x3C,0x30,0xF0,0xC3,0xC3,0x0F,0x0C,0x30,
// 'n'
0x6E,0x04,0x08,0x0A,0x02,0x0B,
0xDE,0xFE,0xE7,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,
// 'o'
0x6F,0x04,0x0A,0x0A,0x01,0x0B,
0x1E,0x1F,0xE6,0x1B,0x03,0xC0,0xF0,0x3C,0x0D,0x86,0x7F,0x87,0x80,
// 'p'
0x70,0x04,0x09,0x0E,0x02,0x0B,
0xDE,0x7F,0xB8,0xF8,0x3C,0x1E,0x0F,0x07,0xC7,0xFF,0x6F,0x30,0x18,0x0C,0x06,0x00,
// 'q'
0x71,0x04,0x09,0x0E,0x01,0x0B,
0x3D,0xBF,0xF8,0xF8,0x3C,0x1E,0x0F,0x07,0xC7,0x7F,0x9E,0xC0,0x60,0x30,0x18,0x0C,
// 'r'
0x72,0x04,0x06,0x0A,0x02,0x08,
0xDF,0xFE,0x30,0xC3,0x0C,0x30,0xC3,0x00,
// 's'
0x73,0x04,0x08,0x0A,0x01,0x08,
0x7C,0xFE,0xC2,0xE0,0x7C,0x1E,0x06,0x86,0xFE,0x78,
// 't'
0x74,0x01,0x06,0x0D,0x01,0x07,
0x61,0x86,0x3F,0xFD,0x86,0x18,0x61,0x86,0x1F,0x3C,
// 'u'
0x75,0x04,0x08,0x0A,0x02,0x0B,
0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xE7,0x7F,0x7B,
// 'v'
0x76,0x04,0x0C,0x0A,0x00,0x0B,
0x60,0x66,0x06,0x30,0xC3,0x0C,0x19,0x81,0x98,0x19,0x80,0xF0,0x0F,0x00,0x60,
// 'w'
0x77,0x04,0x0F,0x0A,0x01,0x10,
0x63,0x8C,0xC7,0x19,0x8E,0x31,0xB6,0xC3,0x6D,0x86,0xDB,0x0F,0x1E,0x0E,0x38,0x1C,0x70,0x38,0xE0,
// 'x'
0x78,0x04,0x0A,0x0A,0x01,0x0B,
0xE1,0xD8,0x63,0x30,0xCC,0x1E,0x07,0x83,0x30,0xCC,0x61,0xB8,0x70,
// 'y'
0x79,0x04,0x0C,0x0E,0x00,0x0B,
0x60,0x66,0x06,0x30,0xC3,0x0C,0x19,0x81,0x98,0x0F,0x00,0xF0,0x06,0x00,0x60,0x06,0x00,0xC0,0x3C,0x03,0x80,
// 'z'
0x7A,0x04,0x08,0x0A,0x01,0x09,
0xFF,0xFF,0x06,0x0C,0x1C,0x38,0x30,0x70,0xFF,0xFF,
// '{'
0x7B,0x00,0x08,0x11,0x02,0x0B,
0x0F,0x1F,0x18,0x18,0x18,0x18,0x38,0xF0,0xF0,0x38,0x18,0x18,0x18,0x18,0x18,0x1F,0x0F,
// '|'
0x7C,0x00,0x02,0x12,0x02,0x06,
0xFF,0xFF,0xFF,0xFF,0xF0,
// '}'
0x7D,0x00,0x08,0x11,0x02,0x0B,
0xF0,0xF8,0x18,0x18,0x18,0x18,0x1C,0x0F,0x0F,0x1C,0x18,0x18,0x18,0x18,0x18,0xF8,0xF0,
// '~'
0x7E,0x05,0x0B,0x05,0x02,0x0F,
0x00,0x0F,0x87,0xFF,0xC3,0xE0,0x00,
// Terminator
0xFF
};

View File

@ -0,0 +1,331 @@
// ========================================================================
// This comes with no warranty, implied or otherwise
// This data structure was designed to support Proportional fonts
// fonts. Individual characters do not have to be multiples of 8 bits wide.
// Any width is fine and does not need to be fixed.
// The data bits are packed to minimize data requirements, bu