mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
Merge branch 'esp8266' of https://github.com/ficeto/Arduino into esp8266
Conflicts: hardware/esp8266com/esp8266/libraries/ESP8266WebServer/examples/SDWebServer/SDWebServer.ino
This commit is contained in:
commit
89248032d6
@ -132,7 +132,8 @@ else they default to pins 4(SDA) and 5(SCL).
|
||||
|
||||
#### SPI ####
|
||||
|
||||
SPI library supports the entire Arduino SPI API including transactions, including setting phase and polarity.
|
||||
SPI library supports the entire Arduino SPI API including transactions, including setting phase (CPHA).
|
||||
Setting the Clock polarity (CPOL) is not supported, yet (SPI_MODE2 and SPI_MODE3 not working).
|
||||
|
||||
#### ESP-specific APIs ####
|
||||
|
||||
|
@ -124,8 +124,17 @@ void timer1_write(uint32_t ticks); //maximum ticks 8388607
|
||||
void ets_intr_lock();
|
||||
void ets_intr_unlock();
|
||||
|
||||
#define interrupts() ets_intr_unlock();
|
||||
#define noInterrupts() ets_intr_lock();
|
||||
// level (0-15),
|
||||
// level 15 will disable ALL interrupts,
|
||||
// level 0 will disable most software interrupts
|
||||
//
|
||||
#define xt_disable_interrupts(state, level) __asm__ __volatile__("rsil %0," __STRINGIFY(level) "; esync; isync; dsync" : "=a" (state))
|
||||
#define xt_enable_interrupts(state) __asm__ __volatile__("wsr %0,ps; esync" :: "a" (state) : "memory")
|
||||
|
||||
extern uint32_t interruptsState;
|
||||
|
||||
#define interrupts() xt_enable_interrupts(interruptsState)
|
||||
#define noInterrupts() xt_disable_interrupts(interruptsState, 15)
|
||||
|
||||
#define clockCyclesPerMicrosecond() ( F_CPU / 1000000L )
|
||||
#define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() )
|
||||
@ -163,6 +172,7 @@ int digitalRead(uint8_t);
|
||||
int analogRead(uint8_t);
|
||||
void analogReference(uint8_t mode);
|
||||
void analogWrite(uint8_t, int);
|
||||
void analogWriteFreq(uint32_t freq);
|
||||
|
||||
unsigned long millis(void);
|
||||
unsigned long micros(void);
|
||||
|
@ -227,6 +227,13 @@ FlashMode_t EspClass::getFlashChipMode(void)
|
||||
*/
|
||||
uint32_t EspClass::getFlashChipSizeByChipId(void) {
|
||||
uint32_t chipId = getFlashChipId();
|
||||
/**
|
||||
* Chip ID
|
||||
* 00 - always 00 (Chip ID use only 3 byte)
|
||||
* 17 - ? looks like 2^xx is size in Byte ? //todo: find docu to this
|
||||
* 40 - ? may be Speed ? //todo: find docu to this
|
||||
* C8 - manufacturer ID
|
||||
*/
|
||||
switch(chipId) {
|
||||
|
||||
// GigaDevice
|
||||
|
@ -95,8 +95,16 @@ class EspClass {
|
||||
FlashMode_t getFlashChipMode(void);
|
||||
uint32_t getFlashChipSizeByChipId(void);
|
||||
|
||||
inline uint32_t getCycleCount(void);
|
||||
};
|
||||
|
||||
uint32_t EspClass::getCycleCount(void)
|
||||
{
|
||||
uint32_t ccount;
|
||||
__asm__ __volatile__("rsr %0,ccount":"=a" (ccount));
|
||||
return ccount;
|
||||
}
|
||||
|
||||
extern EspClass ESP;
|
||||
|
||||
#endif //ESP_H
|
||||
|
@ -118,24 +118,14 @@ int uart_get_debug();
|
||||
void ICACHE_RAM_ATTR uart_interrupt_handler(uart_t* uart) {
|
||||
|
||||
// -------------- UART 0 --------------
|
||||
uint32_t status = U0IS;
|
||||
if(Serial.isRxEnabled()) {
|
||||
if(status & (1 << UIFF)) {
|
||||
while(true) {
|
||||
int rx_count = (U0S >> USTXC) & 0xff;
|
||||
if(!rx_count)
|
||||
break;
|
||||
|
||||
while(rx_count--) {
|
||||
char c = U0F & 0xff;
|
||||
Serial._rx_complete_irq(c);
|
||||
}
|
||||
}
|
||||
while(U0IS & (1 << UIFF)) {
|
||||
Serial._rx_complete_irq((char)(U0F & 0xff));
|
||||
U0IC = (1 << UIFF);
|
||||
}
|
||||
}
|
||||
if(Serial.isTxEnabled()) {
|
||||
if(status & (1 << UIFE)) {
|
||||
if(U0IS & (1 << UIFE)) {
|
||||
U0IC = (1 << UIFE);
|
||||
Serial._tx_empty_irq();
|
||||
}
|
||||
@ -143,25 +133,14 @@ void ICACHE_RAM_ATTR uart_interrupt_handler(uart_t* uart) {
|
||||
|
||||
// -------------- UART 1 --------------
|
||||
|
||||
status = U1IS;
|
||||
if(Serial1.isRxEnabled()) {
|
||||
if(status & (1 << UIFF)) {
|
||||
while(true) {
|
||||
int rx_count = (U1S >> USTXC) & 0xff;
|
||||
if(!rx_count)
|
||||
break;
|
||||
|
||||
while(rx_count--) {
|
||||
char c = U1F & 0xff;
|
||||
Serial1._rx_complete_irq(c);
|
||||
}
|
||||
}
|
||||
while(U1IS & (1 << UIFF)) {
|
||||
Serial1._rx_complete_irq((char)(U1F & 0xff));
|
||||
U1IC = (1 << UIFF);
|
||||
}
|
||||
}
|
||||
if(Serial1.isTxEnabled()) {
|
||||
status = U1IS;
|
||||
if(status & (1 << UIFE)) {
|
||||
if(U1IS & (1 << UIFE)) {
|
||||
U1IC = (1 << UIFE);
|
||||
Serial1._tx_empty_irq();
|
||||
}
|
||||
|
@ -30,6 +30,10 @@ void timer1_isr_handler(void *para){
|
||||
if(timer1_user_cb) timer1_user_cb();
|
||||
}
|
||||
|
||||
void timer1_isr_init(){
|
||||
ETS_FRC_TIMER1_INTR_ATTACH(timer1_isr_handler, NULL);
|
||||
}
|
||||
|
||||
void timer1_attachInterrupt(void (*userFunc)(void)) {
|
||||
timer1_user_cb = userFunc;
|
||||
ETS_FRC1_INTR_ENABLE();
|
||||
@ -55,7 +59,3 @@ void timer1_disable(){
|
||||
T1C = 0;
|
||||
T1I = 0;
|
||||
}
|
||||
|
||||
void timer1_isr_init(){
|
||||
ETS_FRC_TIMER1_INTR_ATTACH(timer1_isr_handler, NULL);
|
||||
}
|
@ -75,6 +75,7 @@ void delayMicroseconds(unsigned int us) {
|
||||
|
||||
void init() {
|
||||
initPins();
|
||||
timer1_isr_init();
|
||||
os_timer_setfn(µs_overflow_timer, (os_timer_func_t*) µs_overflow_tick, 0);
|
||||
os_timer_arm(µs_overflow_timer, 60000, REPEAT);
|
||||
}
|
||||
|
@ -139,6 +139,9 @@ extern void __detachInterrupt(uint8_t pin) {
|
||||
}
|
||||
}
|
||||
|
||||
// stored state for the noInterrupts/interrupts methods
|
||||
uint32_t interruptsState = 0;
|
||||
|
||||
void initPins() {
|
||||
//Disable UART interrupts
|
||||
system_set_os_print(0);
|
||||
|
@ -139,4 +139,10 @@ extern void __analogWrite(uint8_t pin, int value) {
|
||||
}
|
||||
}
|
||||
|
||||
extern void __analogWriteFreq(uint32_t freq){
|
||||
pwm_freq = freq;
|
||||
prep_pwm_steps();
|
||||
}
|
||||
|
||||
extern void analogWrite(uint8_t pin, int val) __attribute__ ((weak, alias("__analogWrite")));
|
||||
extern void analogWriteFreq(uint32_t freq) __attribute__ ((weak, alias("__analogWriteFreq")));
|
||||
|
BIN
doc/esp8266_tcp_active_close.png
Normal file
BIN
doc/esp8266_tcp_active_close.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 130 KiB |
@ -1,232 +0,0 @@
|
||||
#include "Adafruit_ILI9341.h"
|
||||
#include "Adafruit_GFX.h"
|
||||
|
||||
extern "C"{
|
||||
#include <ets_sys.h>
|
||||
#include <os_type.h>
|
||||
#include <osapi.h>
|
||||
#include "driver/hspi.h"
|
||||
}
|
||||
|
||||
#define SWAPBYTES(i) ((i>>8) | (i<<8))
|
||||
|
||||
void Adafruit_ILI9341::transmitCmdData(uint8_t cmd, const uint8_t *data, uint8_t numDataByte)
|
||||
{
|
||||
spi_wait_ready();
|
||||
TFT_DC_COMMAND;
|
||||
spi_send_uint8(cmd);
|
||||
spi_wait_ready();
|
||||
TFT_DC_DATA;
|
||||
spi_send_data(data, numDataByte);
|
||||
}
|
||||
|
||||
void Adafruit_ILI9341::begin() {
|
||||
//Set communication using HW SPI Port
|
||||
config = spi_init(HSPI, 1, spi_mode_tx);
|
||||
TFT_DC_INIT;
|
||||
delay(1);
|
||||
|
||||
uint8_t data[15] = {0};
|
||||
|
||||
data[0] = 0x39;
|
||||
data[1] = 0x2C;
|
||||
data[2] = 0x00;
|
||||
data[3] = 0x34;
|
||||
data[4] = 0x02;
|
||||
transmitCmdData(0xCB, data, 5);
|
||||
|
||||
data[0] = 0x00;
|
||||
data[1] = 0XC1;
|
||||
data[2] = 0X30;
|
||||
transmitCmdData(0xCF, data, 3);
|
||||
|
||||
data[0] = 0x85;
|
||||
data[1] = 0x00;
|
||||
data[2] = 0x78;
|
||||
transmitCmdData(0xE8, data, 3);
|
||||
|
||||
data[0] = 0x00;
|
||||
data[1] = 0x00;
|
||||
transmitCmdData(0xEA, data, 2);
|
||||
|
||||
data[0] = 0x64;
|
||||
data[1] = 0x03;
|
||||
data[2] = 0X12;
|
||||
data[3] = 0X81;
|
||||
transmitCmdData(0xED, data, 4);
|
||||
|
||||
data[0] = 0x20;
|
||||
transmitCmdData(0xF7, data, 1);
|
||||
|
||||
data[0] = 0x23; //VRH[5:0]
|
||||
transmitCmdData(0xC0, data, 1); //Power control
|
||||
|
||||
data[0] = 0x10; //SAP[2:0];BT[3:0]
|
||||
transmitCmdData(0xC1, data, 1); //Power control
|
||||
|
||||
data[0] = 0x3e; //Contrast
|
||||
data[1] = 0x28;
|
||||
transmitCmdData(0xC5, data, 2); //VCM control
|
||||
|
||||
data[0] = 0x86; //--
|
||||
transmitCmdData(0xC7, data, 1); //VCM control2
|
||||
|
||||
data[0] = 0x48; //C8
|
||||
transmitCmdData(0x36, data, 1); // Memory Access Control
|
||||
|
||||
data[0] = 0x55;
|
||||
transmitCmdData(0x3A, data, 1);
|
||||
|
||||
data[0] = 0x00;
|
||||
data[1] = 0x18;
|
||||
transmitCmdData(0xB1, data, 2);
|
||||
|
||||
data[0] = 0x08;
|
||||
data[1] = 0x82;
|
||||
data[2] = 0x27;
|
||||
transmitCmdData(0xB6, data, 3); // Display Function Control
|
||||
|
||||
data[0] = 0x00;
|
||||
transmitCmdData(0xF2, data, 1); // 3Gamma Function Disable
|
||||
|
||||
data[0] = 0x01;
|
||||
transmitCmdData(0x26, data, 1); //Gamma curve selected
|
||||
|
||||
data[0] = 0x0F;
|
||||
data[1] = 0x31;
|
||||
data[2] = 0x2B;
|
||||
data[3] = 0x0C;
|
||||
data[4] = 0x0E;
|
||||
data[5] = 0x08;
|
||||
data[6] = 0x4E;
|
||||
data[7] = 0xF1;
|
||||
data[8] = 0x37;
|
||||
data[9] = 0x07;
|
||||
data[10] = 0x10;
|
||||
data[11] = 0x03;
|
||||
data[12] = 0x0E;
|
||||
data[13] = 0x09;
|
||||
data[14] = 0x00;
|
||||
transmitCmdData(0xE0, data, 15); //Set Gamma
|
||||
|
||||
data[0] = 0x00;
|
||||
data[1] = 0x0E;
|
||||
data[2] = 0x14;
|
||||
data[3] = 0x03;
|
||||
data[4] = 0x11;
|
||||
data[5] = 0x07;
|
||||
data[6] = 0x31;
|
||||
data[7] = 0xC1;
|
||||
data[8] = 0x48;
|
||||
data[9] = 0x08;
|
||||
data[10] = 0x0F;
|
||||
data[11] = 0x0C;
|
||||
data[12] = 0x31;
|
||||
data[13] = 0x36;
|
||||
data[14] = 0x0F;
|
||||
transmitCmdData(0xE1, data, 15); //Set Gamma
|
||||
|
||||
transmitCmd(0x11); //Exit Sleep
|
||||
delay(120);
|
||||
|
||||
transmitCmd(0x29); //Display on
|
||||
transmitCmd(0x2c);
|
||||
spi_wait_ready();
|
||||
}
|
||||
|
||||
void Adafruit_ILI9341::drawPixel(int16_t x, int16_t y, uint16_t color) {
|
||||
|
||||
if((x < 0) ||(x >= _width) || (y < 0) || (y >= _height)) return;
|
||||
setAddrWindow(x,y,x+1,y+1);
|
||||
transmitData(SWAPBYTES(color));
|
||||
}
|
||||
|
||||
|
||||
void Adafruit_ILI9341::drawFastVLine(int16_t x, int16_t y, int16_t h,
|
||||
uint16_t color) {
|
||||
|
||||
// Rudimentary clipping
|
||||
if((x >= _width) || (y >= _height)) return;
|
||||
|
||||
if((y+h-1) >= _height)
|
||||
h = _height-y;
|
||||
|
||||
setAddrWindow(x, y, x, y+h-1);
|
||||
transmitData(SWAPBYTES(color), h);
|
||||
}
|
||||
|
||||
void Adafruit_ILI9341::drawFastHLine(int16_t x, int16_t y, int16_t w,
|
||||
uint16_t color) {
|
||||
|
||||
// Rudimentary clipping
|
||||
if((x >= _width) || (y >= _height)) return;
|
||||
if((x+w-1) >= _width) w = _width-x;
|
||||
setAddrWindow(x, y, x+w-1, y);
|
||||
transmitData(SWAPBYTES(color), w);
|
||||
}
|
||||
|
||||
void Adafruit_ILI9341::fillScreen(uint16_t color) {
|
||||
fillRect(0, 0, _width, _height, color);
|
||||
}
|
||||
|
||||
// fill a rectangle
|
||||
void Adafruit_ILI9341::fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
|
||||
uint16_t color) {
|
||||
|
||||
// rudimentary clipping (drawChar w/big text requires this)
|
||||
if((x >= _width) || (y >= _height)) return;
|
||||
if((x + w - 1) >= _width) w = _width - x;
|
||||
if((y + h - 1) >= _height) h = _height - y;
|
||||
|
||||
setAddrWindow(x, y, x+w-1, y+h-1);
|
||||
transmitData(SWAPBYTES(color), h*w);
|
||||
}
|
||||
|
||||
|
||||
// Pass 8-bit (each) R,G,B, get back 16-bit packed color
|
||||
uint16_t Adafruit_ILI9341::color565(uint8_t r, uint8_t g, uint8_t b) {
|
||||
return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3);
|
||||
}
|
||||
|
||||
|
||||
#define MADCTL_MY 0x80
|
||||
#define MADCTL_MX 0x40
|
||||
#define MADCTL_MV 0x20
|
||||
#define MADCTL_ML 0x10
|
||||
#define MADCTL_RGB 0x00
|
||||
#define MADCTL_BGR 0x08
|
||||
#define MADCTL_MH 0x04
|
||||
|
||||
void Adafruit_ILI9341::setRotation(uint8_t m) {
|
||||
|
||||
uint8_t data;
|
||||
rotation = m % 4; // can't be higher than 3
|
||||
switch (rotation) {
|
||||
case 0:
|
||||
data = MADCTL_MX | MADCTL_BGR;
|
||||
_width = ILI9341_TFTWIDTH;
|
||||
_height = ILI9341_TFTHEIGHT;
|
||||
break;
|
||||
case 1:
|
||||
data = MADCTL_MV | MADCTL_BGR;
|
||||
_width = ILI9341_TFTHEIGHT;
|
||||
_height = ILI9341_TFTWIDTH;
|
||||
break;
|
||||
case 2:
|
||||
data = MADCTL_MY | MADCTL_BGR;
|
||||
_width = ILI9341_TFTWIDTH;
|
||||
_height = ILI9341_TFTHEIGHT;
|
||||
break;
|
||||
case 3:
|
||||
data = MADCTL_MX | MADCTL_MY | MADCTL_MV | MADCTL_BGR;
|
||||
_width = ILI9341_TFTHEIGHT;
|
||||
_height = ILI9341_TFTWIDTH;
|
||||
break;
|
||||
}
|
||||
transmitCmdData(ILI9341_MADCTL, &data, 1);
|
||||
}
|
||||
|
||||
|
||||
void Adafruit_ILI9341::invertDisplay(boolean i) {
|
||||
transmitCmd(i ? ILI9341_INVON : ILI9341_INVOFF);
|
||||
}
|
@ -1,126 +0,0 @@
|
||||
#ifndef _ADAFRUIT_ILI9341H_
|
||||
#define _ADAFRUIT_ILI9341H_
|
||||
|
||||
#include "Adafruit_GFX.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include <c_types.h>
|
||||
#include <osapi.h>
|
||||
#include <gpio.h>
|
||||
#include "driver/hspi.h"
|
||||
}
|
||||
|
||||
#define ILI9341_TFTWIDTH 240
|
||||
#define ILI9341_TFTHEIGHT 320
|
||||
|
||||
#define ILI9341_NOP 0x00
|
||||
#define ILI9341_SWRESET 0x01
|
||||
#define ILI9341_RDDID 0x04
|
||||
#define ILI9341_RDDST 0x09
|
||||
|
||||
#define ILI9341_SLPIN 0x10
|
||||
#define ILI9341_SLPOUT 0x11
|
||||
#define ILI9341_PTLON 0x12
|
||||
#define ILI9341_NORON 0x13
|
||||
|
||||
#define ILI9341_RDMODE 0x0A
|
||||
#define ILI9341_RDMADCTL 0x0B
|
||||
#define ILI9341_RDPIXFMT 0x0C
|
||||
#define ILI9341_RDIMGFMT 0x0A
|
||||
#define ILI9341_RDSELFDIAG 0x0F
|
||||
|
||||
#define ILI9341_INVOFF 0x20
|
||||
#define ILI9341_INVON 0x21
|
||||
#define ILI9341_GAMMASET 0x26
|
||||
#define ILI9341_DISPOFF 0x28
|
||||
#define ILI9341_DISPON 0x29
|
||||
|
||||
#define ILI9341_CASET 0x2A
|
||||
#define ILI9341_PASET 0x2B
|
||||
#define ILI9341_RAMWR 0x2C
|
||||
#define ILI9341_RAMRD 0x2E
|
||||
|
||||
#define ILI9341_PTLAR 0x30
|
||||
#define ILI9341_MADCTL 0x36
|
||||
#define ILI9341_PIXFMT 0x3A
|
||||
|
||||
#define ILI9341_FRMCTR1 0xB1
|
||||
#define ILI9341_FRMCTR2 0xB2
|
||||
#define ILI9341_FRMCTR3 0xB3
|
||||
#define ILI9341_INVCTR 0xB4
|
||||
#define ILI9341_DFUNCTR 0xB6
|
||||
|
||||
#define ILI9341_PWCTR1 0xC0
|
||||
#define ILI9341_PWCTR2 0xC1
|
||||
#define ILI9341_PWCTR3 0xC2
|
||||
#define ILI9341_PWCTR4 0xC3
|
||||
#define ILI9341_PWCTR5 0xC4
|
||||
#define ILI9341_VMCTR1 0xC5
|
||||
#define ILI9341_VMCTR2 0xC7
|
||||
|
||||
#define ILI9341_RDID1 0xDA
|
||||
#define ILI9341_RDID2 0xDB
|
||||
#define ILI9341_RDID3 0xDC
|
||||
#define ILI9341_RDID4 0xDD
|
||||
|
||||
#define ILI9341_GMCTRP1 0xE0
|
||||
#define ILI9341_GMCTRN1 0xE1
|
||||
/*
|
||||
#define ILI9341_PWCTR6 0xFC
|
||||
|
||||
*/
|
||||
|
||||
// Color definitions
|
||||
#define ILI9341_BLACK 0x0000
|
||||
#define ILI9341_BLUE 0x001F
|
||||
#define ILI9341_RED 0xF800
|
||||
#define ILI9341_GREEN 0x07E0
|
||||
#define ILI9341_CYAN 0x07FF
|
||||
#define ILI9341_MAGENTA 0xF81F
|
||||
#define ILI9341_YELLOW 0xFFE0
|
||||
#define ILI9341_WHITE 0xFFFF
|
||||
|
||||
#define TFT_DC_DATA GPIO_OUTPUT_SET(2, 1)
|
||||
#define TFT_DC_COMMAND GPIO_OUTPUT_SET(2, 0)
|
||||
#define TFT_DC_INIT PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_GPIO2); TFT_DC_DATA
|
||||
|
||||
#define MAKEWORD(b1, b2, b3, b4) (uint32_t(b1) | ((b2) << 8) | ((b3) << 16) | ((b4) << 24))
|
||||
#define SWAPBYTES(i) ((i>>8) | (i<<8))
|
||||
|
||||
class Adafruit_ILI9341 : public Adafruit_GFX {
|
||||
|
||||
private:
|
||||
uint8_t tabcolor;
|
||||
spi_config config;
|
||||
void transmitCmdData(uint8_t cmd, const uint8_t *data, uint8_t numDataByte);
|
||||
inline void transmitData(uint16_t data) {spi_wait_ready(); spi_send_uint16(data);}
|
||||
inline void transmitCmdData(uint8_t cmd, uint32_t data) {spi_wait_ready(); TFT_DC_COMMAND; spi_send_uint8(cmd); spi_wait_ready(); TFT_DC_DATA; spi_send_uint32(data);}
|
||||
inline void transmitData(uint16_t data, int32_t repeats){spi_wait_ready(); spi_send_uint16_r(data, repeats);}
|
||||
inline void transmitCmd(uint8_t cmd){spi_wait_ready(); TFT_DC_COMMAND; spi_send_uint8(cmd);spi_wait_ready(); TFT_DC_DATA;}
|
||||
inline void drawPixelInternal(int16_t x, int16_t y, uint16_t color) { if((x < 0) ||(x >= _width) || (y < 0) || (y >= _height)) return;
|
||||
setAddrWindow(x,y,x+1,y+1);
|
||||
transmitData(SWAPBYTES(color));
|
||||
}
|
||||
|
||||
public:
|
||||
Adafruit_ILI9341() : Adafruit_GFX(ILI9341_TFTWIDTH, ILI9341_TFTHEIGHT), tabcolor(0){}
|
||||
|
||||
void begin(),
|
||||
fillScreen(uint16_t color),
|
||||
drawPixel(int16_t x, int16_t y, uint16_t color),
|
||||
drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color),
|
||||
drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color),
|
||||
fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
|
||||
uint16_t color),
|
||||
setRotation(uint8_t r),
|
||||
invertDisplay(boolean i);
|
||||
inline void setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1)
|
||||
{ transmitCmdData(ILI9341_CASET, MAKEWORD(x0 >> 8, x0 & 0xFF, x1 >> 8, x1 & 0xFF));
|
||||
transmitCmdData(ILI9341_PASET, MAKEWORD(y0 >> 8, y0 & 0xFF, y1 >> 8, y1 & 0xFF));
|
||||
transmitCmd(ILI9341_RAMWR); // write to RAM
|
||||
}
|
||||
uint16_t color565(uint8_t r, uint8_t g, uint8_t b);
|
||||
};
|
||||
|
||||
#endif
|
@ -1,525 +0,0 @@
|
||||
// Font size 2
|
||||
|
||||
#include "Font16.h"
|
||||
|
||||
const unsigned char widtbl_f16[96] = // character width table
|
||||
{
|
||||
5, 2, 3, 8, 7, 8, 8, 2, // char 32 - 39
|
||||
6, 6, 7, 5, 2, 5, 4, 6, // char 40 - 47
|
||||
7, 7, 7, 7, 7, 7, 7, 7, // char 48 - 55
|
||||
7, 7, 2, 2, 5, 5, 5, 7, // char 56 - 63
|
||||
8, 7, 7, 7, 7, 7, 7, 7, // char 64 - 71
|
||||
6, 3, 7, 7, 6, 9, 7, 7, // char 72 - 79
|
||||
7, 7, 7, 7, 7, 7, 7, 9, // char 80 - 87
|
||||
7, 7, 7, 3, 6, 3, 16, 16, // char 88 - 95
|
||||
3, 6, 6, 6, 6, 6, 5, 6, // char 96 - 103
|
||||
6, 4, 4, 5, 4, 7, 6, 7, // char 104 - 111
|
||||
6, 7, 5, 5, 4, 6, 7, 7, // char 112 - 119
|
||||
5, 6, 6, 11, 16, 8, 2, 13 // char 120 - 127
|
||||
};
|
||||
|
||||
// Row format, MSB left
|
||||
|
||||
const unsigned char chr_f16_20[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 11
|
||||
0x00, 0x00, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_21[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, // row 1 - 11
|
||||
0x00, 0x40, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_22[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0xA0, 0xA0, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 11
|
||||
0x00, 0x00, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_23[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x24, 0x24, 0x24, 0xFF, 0x24, 0x24, 0xFF, 0x24, // row 1 - 11
|
||||
0x24, 0x24, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_24[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x40, 0x40, 0x70, 0x40, 0x40, // row 1 - 11
|
||||
0x40, 0xFE, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_25[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x61, 0x91, 0x92, 0x64, 0x08, 0x10, 0x26, 0x49, // row 1 - 11
|
||||
0x89, 0x86, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_26[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x20, 0x50, 0x88, 0x88, 0x50, 0x20, 0x52, 0x8C, // row 1 - 11
|
||||
0x8C, 0x73, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_27[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x40, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 11
|
||||
0x00, 0x00, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_28[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x0C, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, 0x80, // row 1 - 11
|
||||
0x40, 0x40, 0x20, 0x10, 0x0C // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_29[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0xC0, 0x20, 0x10, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x04, // row 1 - 11
|
||||
0x08, 0x08, 0x10, 0x20, 0xC0 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_2A[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x92, 0x54, 0x38, 0x54, 0x92, 0x10, // row 1 - 11
|
||||
0x00, 0x00, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_2B[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0xF8, 0x20, 0x20, // row 1 - 11
|
||||
0x00, 0x00, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_2C[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 11
|
||||
0xC0, 0xC0, 0x40, 0x80, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_2D[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, // row 1 - 11
|
||||
0x00, 0x00, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_2E[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 11
|
||||
0xC0, 0xC0, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_2F[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, // row 1 - 11
|
||||
0x40, 0x80, 0x80, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_30[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x82, 0x82, 0x82, 0x82, 0x44, // row 1 - 11
|
||||
0x44, 0x38, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_31[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x10, 0x30, 0x50, 0x10, 0x10, 0x10, 0x10, 0x10, // row 1 - 11
|
||||
0x10, 0x7C, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_32[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x02, 0x04, 0x18, 0x20, 0x40, // row 1 - 11
|
||||
0x80, 0xFE, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_33[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x78, 0x84, 0x02, 0x04, 0x38, 0x04, 0x02, 0x02, // row 1 - 11
|
||||
0x84, 0x78, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_34[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x04, 0x0C, 0x14, 0x24, 0x44, 0x84, 0xFE, 0x04, // row 1 - 11
|
||||
0x04, 0x04, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_35[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0xFC, 0x80, 0x80, 0x80, 0xF8, 0x04, 0x02, 0x02, // row 1 - 11
|
||||
0x84, 0x78, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_36[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x3C, 0x40, 0x80, 0x80, 0xB8, 0xC4, 0x82, 0x82, // row 1 - 11
|
||||
0x44, 0x38, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_37[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x7E, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, // row 1 - 11
|
||||
0x10, 0x10, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_38[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x44, 0x38, 0x44, 0x82, 0x82, // row 1 - 11
|
||||
0x44, 0x38, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_39[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x82, 0x46, 0x3A, 0x02, 0x02, // row 1 - 11
|
||||
0x04, 0x78, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_3A[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0xC0, 0xC0, // row 1 - 11
|
||||
0x00, 0x00, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_3B[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0xC0, 0xC0, // row 1 - 11
|
||||
0x40, 0x80, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_3C[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, // row 1 - 11
|
||||
0x10, 0x08, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_3D[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x00, 0xF8, 0x00, // row 1 - 11
|
||||
0x00, 0x00, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_3E[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x10, 0x20, // row 1 - 11
|
||||
0x40, 0x80, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_3F[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x02, 0x04, 0x08, 0x10, 0x10, // row 1 - 11
|
||||
0x00, 0x10, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_40[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x3C, 0x42, 0x99, 0xA5, 0xA5, 0xA5, 0xA5, 0x9E, // row 1 - 11
|
||||
0x40, 0x3E, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_41[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x10, 0x10, 0x28, 0x28, 0x44, 0x44, 0x7C, 0x82, // row 1 - 11
|
||||
0x82, 0x82, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_42[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0xF8, 0x84, 0x82, 0x84, 0xF8, 0x84, 0x82, 0x82, // row 1 - 11
|
||||
0x84, 0xF8, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_43[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x3C, 0x42, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, // row 1 - 11
|
||||
0x42, 0x3C, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_44[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0xF8, 0x84, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, // row 1 - 11
|
||||
0x84, 0xF8, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_45[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0xFE, 0x80, 0x80, 0x80, 0xFC, 0x80, 0x80, 0x80, // row 1 - 11
|
||||
0x80, 0xFE, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_46[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0xFE, 0x80, 0x80, 0x80, 0xF8, 0x80, 0x80, 0x80, // row 1 - 11
|
||||
0x80, 0x80, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_47[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x3C, 0x42, 0x80, 0x80, 0x80, 0x9C, 0x82, 0x82, // row 1 - 11
|
||||
0x42, 0x3C, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_48[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0xFC, 0x84, 0x84, 0x84, // row 1 - 11
|
||||
0x84, 0x84, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_49[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0xE0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, // row 1 - 11
|
||||
0x40, 0xE0, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_4A[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x82, // row 1 - 11
|
||||
0x44, 0x38, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_4B[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x84, 0x88, 0x90, 0xA0, 0xC0, 0xA0, 0x90, 0x88, // row 1 - 11
|
||||
0x84, 0x82, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_4C[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, // row 1 - 11
|
||||
0x80, 0xFC, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_4D[32] = // 2 unsigned chars per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC1, 0x80, 0xC1, 0x80, 0xA2, 0x80, // row 1 - 6
|
||||
0xA2, 0x80, 0x94, 0x80, 0x94, 0x80, 0x88, 0x80, 0x88, 0x80, 0x80, 0x80, // row 7 - 12
|
||||
0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 13 - 16
|
||||
};
|
||||
const unsigned char chr_f16_4E[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0xC2, 0xC2, 0xA2, 0xA2, 0x92, 0x92, 0x8A, 0x8A, // row 1 - 11
|
||||
0x86, 0x86, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_4F[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, // row 1 - 11
|
||||
0x44, 0x38, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_50[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0xF8, 0x84, 0x82, 0x82, 0x82, 0x84, 0xF8, 0x80, // row 1 - 11
|
||||
0x80, 0x80, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_51[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, // row 1 - 11
|
||||
0x44, 0x38, 0x08, 0x06, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_52[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0xF8, 0x84, 0x82, 0x82, 0x84, 0xF8, 0x90, 0x88, // row 1 - 11
|
||||
0x84, 0x82, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_53[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x80, 0x60, 0x1C, 0x02, 0x82, // row 1 - 11
|
||||
0x44, 0x38, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_54[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0xFE, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, // row 1 - 11
|
||||
0x10, 0x10, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_55[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, // row 1 - 11
|
||||
0x44, 0x38, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_56[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x82, 0x82, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, // row 1 - 11
|
||||
0x10, 0x10, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_57[32] = // 2 unsigned chars per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, // row 1 - 6
|
||||
0x88, 0x80, 0x88, 0x80, 0x49, 0x00, 0x55, 0x00, 0x55, 0x00, 0x22, 0x00, // row 7 - 12
|
||||
0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 13 - 16
|
||||
};
|
||||
const unsigned char chr_f16_58[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x28, 0x44, // row 1 - 11
|
||||
0x82, 0x82, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_59[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x82, 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, // row 1 - 11
|
||||
0x10, 0x10, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_5A[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0xFE, 0x02, 0x04, 0x08, 0x10, 0x10, 0x20, 0x40, // row 1 - 11
|
||||
0x80, 0xFE, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_5B[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0xE0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, // row 1 - 11
|
||||
0x80, 0x80, 0xE0, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_5C[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, // row 1 - 11
|
||||
0x40, 0x80, 0x80, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_5D[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0xE0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // row 1 - 11
|
||||
0x20, 0x20, 0xE0, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_5E[32] = // 2 unsigned chars per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7B, 0xDE, 0x84, 0x21, 0x84, 0x21, // row 1 - 6
|
||||
0x84, 0x21, 0x84, 0x21, 0x84, 0x21, 0x84, 0x21, 0x84, 0x21, 0x84, 0x21, // row 7 - 12
|
||||
0x84, 0x21, 0x84, 0x21, 0x00, 0x00, 0x00, 0x00 // row 13 - 16
|
||||
};
|
||||
const unsigned char chr_f16_5F[32] = // 2 unsigned chars per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x08, 0x52, 0x94, 0x4A, 0x52, // row 1 - 6
|
||||
0x84, 0x21, 0x84, 0x21, 0x08, 0x42, 0x08, 0x42, 0x10, 0x84, 0x10, 0x84, // row 7 - 12
|
||||
0x21, 0x08, 0x21, 0x08, 0x00, 0x00, 0x00, 0x00 // row 13 - 16
|
||||
};
|
||||
const unsigned char chr_f16_60[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, // row 1 - 11
|
||||
0x00, 0x00, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_61[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x08, 0x04, 0x74, 0x8C, // row 1 - 11
|
||||
0x8C, 0x74, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_62[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xB0, 0xC8, 0x84, 0x84, 0x84, // row 1 - 11
|
||||
0xC8, 0xB0, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_63[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x80, 0x80, 0x80, // row 1 - 11
|
||||
0x44, 0x38, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_64[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x34, 0x4C, 0x84, 0x84, 0x84, // row 1 - 11
|
||||
0x4C, 0x34, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_65[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x84, 0xF8, 0x80, // row 1 - 11
|
||||
0x44, 0x38, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_66[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x30, 0x48, 0x40, 0x40, 0x40, 0xE0, 0x40, 0x40, // row 1 - 11
|
||||
0x40, 0x40, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_67[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x4C, 0x84, 0x84, 0x84, // row 1 - 11
|
||||
0x4C, 0x34, 0x04, 0x08, 0x70 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_68[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0xB0, 0xC8, 0x84, 0x84, 0x84, // row 1 - 11
|
||||
0x84, 0x84, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_69[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, // row 1 - 11
|
||||
0x40, 0x40, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_6A[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, // row 1 - 11
|
||||
0x10, 0x10, 0x10, 0x90, 0x60 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_6B[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x88, 0x90, 0xA0, 0xC0, 0xA0, // row 1 - 11
|
||||
0x90, 0x88, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_6C[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0xC0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, // row 1 - 11
|
||||
0x40, 0x40, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_6D[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAC, 0xD2, 0x92, 0x92, 0x92, // row 1 - 11
|
||||
0x92, 0x92, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_6E[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0xC8, 0x84, 0x84, 0x84, // row 1 - 11
|
||||
0x84, 0x84, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_6F[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x82, 0x82, // row 1 - 11
|
||||
0x44, 0x38, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_70[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0xC8, 0x84, 0x84, 0x84, // row 1 - 11
|
||||
0xC8, 0xB0, 0x80, 0x80, 0x80 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_71[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x4C, 0x84, 0x84, 0x84, // row 1 - 11
|
||||
0x4C, 0x34, 0x04, 0x04, 0x06 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_72[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0xC8, 0x80, 0x80, 0x80, // row 1 - 11
|
||||
0x80, 0x80, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_73[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x88, 0x80, 0x70, 0x08, // row 1 - 11
|
||||
0x88, 0x70, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_74[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0xE0, 0x40, 0x40, 0x40, 0x40, // row 1 - 11
|
||||
0x40, 0x30, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_75[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0x84, // row 1 - 11
|
||||
0x4C, 0x34, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_76[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x82, 0x82, 0x44, // row 1 - 11
|
||||
0x28, 0x10, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_77[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x82, 0x92, 0x92, // row 1 - 11
|
||||
0xAA, 0x44, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_78[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x88, 0x50, 0x20, 0x50, // row 1 - 11
|
||||
0x88, 0x88, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_79[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0x84, // row 1 - 11
|
||||
0x4C, 0x34, 0x04, 0x08, 0x70 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_7A[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x04, 0x08, 0x30, 0x40, // row 1 - 11
|
||||
0x80, 0xFC, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_7B[32] = // 2 unsigned chars per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x41, 0x00, 0x9C, 0x80, // row 1 - 6
|
||||
0xA0, 0x80, 0xA0, 0x80, 0xA0, 0x80, 0x9C, 0x80, 0x41, 0x00, 0x3E, 0x00, // row 7 - 12
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 13 - 16
|
||||
};
|
||||
const unsigned char chr_f16_7C[32] = // 2 unsigned chars per row
|
||||
{
|
||||
0x00, 0x00, 0xF0, 0x00, 0x88, 0x00, 0x88, 0x00, 0xF0, 0x00, 0xA3, 0xC0, // row 1 - 6
|
||||
0x92, 0x20, 0x8A, 0x20, 0x03, 0xC4, 0x02, 0x0A, 0x02, 0x11, 0x02, 0x11, // row 7 - 12
|
||||
0x00, 0x1F, 0x00, 0x11, 0x00, 0x11, 0x00, 0x00 // row 13 - 16
|
||||
};
|
||||
const unsigned char chr_f16_7D[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x22, 0x22, // row 1 - 11
|
||||
0x32, 0x2C, 0x20, 0x40, 0x80 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_7E[16] = // 1 unsigned char per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 11
|
||||
0x00, 0x00, 0x00, 0x00, 0x00 // row 12 - 16
|
||||
};
|
||||
const unsigned char chr_f16_7F[32] = // 2 unsigned chars per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 6
|
||||
0x00, 0x00, 0x34, 0xD0, 0x2A, 0xA8, 0x2A, 0xA8, 0x2A, 0xA8, 0x2A, 0xA8, // row 7 - 12
|
||||
0x2A, 0xA8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 13 - 16
|
||||
};
|
||||
|
||||
const unsigned char* chrtbl_f16[96] = // character pointer table
|
||||
{
|
||||
chr_f16_20, chr_f16_21, chr_f16_22, chr_f16_23, chr_f16_24, chr_f16_25, chr_f16_26, chr_f16_27,
|
||||
chr_f16_28, chr_f16_29, chr_f16_2A, chr_f16_2B, chr_f16_2C, chr_f16_2D, chr_f16_2E, chr_f16_2F,
|
||||
chr_f16_30, chr_f16_31, chr_f16_32, chr_f16_33, chr_f16_34, chr_f16_35, chr_f16_36, chr_f16_37,
|
||||
chr_f16_38, chr_f16_39, chr_f16_3A, chr_f16_3B, chr_f16_3C, chr_f16_3D, chr_f16_3E, chr_f16_3F,
|
||||
chr_f16_40, chr_f16_41, chr_f16_42, chr_f16_43, chr_f16_44, chr_f16_45, chr_f16_46, chr_f16_47,
|
||||
chr_f16_48, chr_f16_49, chr_f16_4A, chr_f16_4B, chr_f16_4C, chr_f16_4D, chr_f16_4E, chr_f16_4F,
|
||||
chr_f16_50, chr_f16_51, chr_f16_52, chr_f16_53, chr_f16_54, chr_f16_55, chr_f16_56, chr_f16_57,
|
||||
chr_f16_58, chr_f16_59, chr_f16_5A, chr_f16_5B, chr_f16_5C, chr_f16_5D, chr_f16_5E, chr_f16_5F,
|
||||
chr_f16_60, chr_f16_61, chr_f16_62, chr_f16_63, chr_f16_64, chr_f16_65, chr_f16_66, chr_f16_67,
|
||||
chr_f16_68, chr_f16_69, chr_f16_6A, chr_f16_6B, chr_f16_6C, chr_f16_6D, chr_f16_6E, chr_f16_6F,
|
||||
chr_f16_70, chr_f16_71, chr_f16_72, chr_f16_73, chr_f16_74, chr_f16_75, chr_f16_76, chr_f16_77,
|
||||
chr_f16_78, chr_f16_79, chr_f16_7A, chr_f16_7B, chr_f16_7C, chr_f16_7D, chr_f16_7E, chr_f16_7F
|
||||
};
|
@ -1,7 +0,0 @@
|
||||
#define nr_chrs_f16 96
|
||||
#define chr_hgt_f16 16
|
||||
#define data_size_f16 8
|
||||
#define firstchr_f16 32
|
||||
|
||||
extern const unsigned char widtbl_f16[96];
|
||||
extern const unsigned char* chrtbl_f16[96];
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +0,0 @@
|
||||
#define nr_chrs_f32 96
|
||||
#define chr_hgt_f32 26
|
||||
#define data_size_f32 8
|
||||
#define firstchr_f32 32
|
||||
|
||||
extern const unsigned char widtbl_f32[96];
|
||||
extern const unsigned char* chrtbl_f32[96];
|
@ -1,338 +0,0 @@
|
||||
// Font size 6 is intended to display numbers and time
|
||||
// This font only contains characters [space] 0 1 2 3 4 5 6 7 8 9 . : a p m
|
||||
// The Pipe character | is a narrow space to aid formatting
|
||||
// All other characters print as a space
|
||||
|
||||
|
||||
#include "Font64.h"
|
||||
|
||||
const unsigned char widtbl_f64[96] = // character width table
|
||||
{
|
||||
15, 15, 15, 15, 15, 15, 15, 15, // char 32 - 39
|
||||
15, 15, 15, 15, 15, 15, 18, 15, // char 40 - 47
|
||||
30, 30, 30, 30, 30, 30, 30, 30, // char 48 - 55
|
||||
30, 30, 18, 15, 15, 15, 15, 15, // char 56 - 63
|
||||
15, 15, 15, 15, 15, 15, 15, 15, // char 64 - 71
|
||||
15, 15, 15, 15, 15, 15, 15, 15, // char 72 - 79
|
||||
15, 15, 15, 15, 15, 15, 15, 15, // char 80 - 87
|
||||
15, 15, 15, 15, 15, 15, 15, 15, // char 88 - 95
|
||||
15, 30, 15, 15, 15, 15, 15, 15, // char 96 - 103
|
||||
15, 15, 15, 15, 15, 45, 15, 15, // char 104 - 111
|
||||
32, 15, 15, 15, 15, 15, 15, 15, // char 112 - 119
|
||||
15, 15, 15, 15, 10, 15, 15, 15 // char 120 - 127
|
||||
};
|
||||
|
||||
// Row format, MSB left
|
||||
|
||||
const unsigned char chr_f64_20[96] = // 2 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 6
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 7 - 12
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 13 - 18
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 19 - 24
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 25 - 30
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 31 - 36
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 42
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 43 - 48
|
||||
};
|
||||
const unsigned char chr_f64_2E[144] = // 3 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 4
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 5 - 8
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 9 - 12
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 13 - 16
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 17 - 20
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 21 - 24
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 25 - 28
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xC0, 0x00, // row 29 - 32
|
||||
0x07, 0xC0, 0x00, 0x07, 0xC0, 0x00, 0x07, 0xC0, 0x00, 0x07, 0xC0, 0x00, // row 33 - 36
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 40
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 41 - 44
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 45 - 48
|
||||
};
|
||||
const unsigned char chr_f64_30[192] = // 4 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x80, 0x00, 0x03, 0xFF, 0xF0, 0x00, // row 1 - 3
|
||||
0x07, 0xFF, 0xF8, 0x00, 0x0F, 0xFF, 0xFC, 0x00, 0x1F, 0xC0, 0xFE, 0x00, // row 4 - 6
|
||||
0x1F, 0x00, 0x3E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x3E, 0x00, 0x1F, 0x00, // row 7 - 9
|
||||
0x3C, 0x00, 0x0F, 0x00, 0x3C, 0x00, 0x0F, 0x00, 0x3C, 0x00, 0x0F, 0x00, // row 10 - 12
|
||||
0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, // row 13 - 15
|
||||
0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, // row 16 - 18
|
||||
0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, // row 19 - 21
|
||||
0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, // row 22 - 24
|
||||
0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, 0x3C, 0x00, 0x0F, 0x00, // row 25 - 27
|
||||
0x3C, 0x00, 0x0F, 0x00, 0x3C, 0x00, 0x0F, 0x00, 0x3E, 0x00, 0x1F, 0x00, // row 28 - 30
|
||||
0x1E, 0x00, 0x1E, 0x00, 0x1F, 0x00, 0x3E, 0x00, 0x1F, 0xC0, 0xFE, 0x00, // row 31 - 33
|
||||
0x0F, 0xFF, 0xFC, 0x00, 0x07, 0xFF, 0xF8, 0x00, 0x03, 0xFF, 0xF0, 0x00, // row 34 - 36
|
||||
0x00, 0x7F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 39
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 40 - 42
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48
|
||||
};
|
||||
const unsigned char chr_f64_31[192] = // 4 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xC0, 0x00, 0x00, 0x01, 0xC0, 0x00, // row 1 - 3
|
||||
0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x07, 0xC0, 0x00, // row 4 - 6
|
||||
0x00, 0x0F, 0xC0, 0x00, 0x00, 0x3F, 0xC0, 0x00, 0x07, 0xFF, 0xC0, 0x00, // row 7 - 9
|
||||
0x07, 0xFF, 0xC0, 0x00, 0x07, 0xFB, 0xC0, 0x00, 0x07, 0xC3, 0xC0, 0x00, // row 10 - 12
|
||||
0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, // row 13 - 15
|
||||
0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, // row 16 - 18
|
||||
0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, // row 19 - 21
|
||||
0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, // row 22 - 24
|
||||
0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, // row 25 - 27
|
||||
0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, // row 28 - 30
|
||||
0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, // row 31 - 33
|
||||
0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, // row 34 - 36
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 39
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 40 - 42
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48
|
||||
};
|
||||
const unsigned char chr_f64_32[192] = // 4 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xC0, 0x00, 0x00, 0xFF, 0xF8, 0x00, // row 1 - 3
|
||||
0x03, 0xFF, 0xFC, 0x00, 0x07, 0xFF, 0xFE, 0x00, 0x07, 0xE0, 0x7F, 0x00, // row 4 - 6
|
||||
0x0F, 0x80, 0x1F, 0x00, 0x0F, 0x80, 0x0F, 0x00, 0x0F, 0x00, 0x0F, 0x80, // row 7 - 9
|
||||
0x1F, 0x00, 0x07, 0x80, 0x1E, 0x00, 0x07, 0x80, 0x1E, 0x00, 0x07, 0x80, // row 10 - 12
|
||||
0x1E, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x0F, 0x80, // row 13 - 15
|
||||
0x00, 0x00, 0x0F, 0x80, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x3F, 0x00, // row 16 - 18
|
||||
0x00, 0x00, 0x7E, 0x00, 0x00, 0x01, 0xFC, 0x00, 0x00, 0x07, 0xF8, 0x00, // row 19 - 21
|
||||
0x00, 0x1F, 0xF0, 0x00, 0x00, 0x3F, 0xE0, 0x00, 0x00, 0xFF, 0x80, 0x00, // row 22 - 24
|
||||
0x01, 0xFE, 0x00, 0x00, 0x03, 0xF8, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00, // row 25 - 27
|
||||
0x0F, 0xC0, 0x00, 0x00, 0x0F, 0x80, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, // row 28 - 30
|
||||
0x1E, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFF, 0x80, // row 31 - 33
|
||||
0x3F, 0xFF, 0xFF, 0x80, 0x3F, 0xFF, 0xFF, 0x80, 0x3F, 0xFF, 0xFF, 0x80, // row 34 - 36
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 39
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 40 - 42
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48
|
||||
};
|
||||
const unsigned char chr_f64_33[192] = // 4 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x80, 0x00, 0x03, 0xFF, 0xF0, 0x00, // row 1 - 3
|
||||
0x07, 0xFF, 0xFC, 0x00, 0x0F, 0xFF, 0xFC, 0x00, 0x1F, 0xC0, 0xFE, 0x00, // row 4 - 6
|
||||
0x1F, 0x00, 0x3E, 0x00, 0x3E, 0x00, 0x1F, 0x00, 0x3E, 0x00, 0x1F, 0x00, // row 7 - 9
|
||||
0x3C, 0x00, 0x0F, 0x00, 0x3C, 0x00, 0x0F, 0x00, 0x3C, 0x00, 0x0F, 0x00, // row 10 - 12
|
||||
0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x3E, 0x00, // row 13 - 15
|
||||
0x00, 0x00, 0x7E, 0x00, 0x00, 0x3F, 0xFC, 0x00, 0x00, 0x3F, 0xF0, 0x00, // row 16 - 18
|
||||
0x00, 0x3F, 0xFC, 0x00, 0x00, 0x3F, 0xFE, 0x00, 0x00, 0x00, 0x7F, 0x00, // row 19 - 21
|
||||
0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x0F, 0x80, 0x00, 0x00, 0x0F, 0x80, // row 22 - 24
|
||||
0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, // row 25 - 27
|
||||
0x7C, 0x00, 0x0F, 0x80, 0x7C, 0x00, 0x1F, 0x80, 0x3E, 0x00, 0x1F, 0x00, // row 28 - 30
|
||||
0x3F, 0x00, 0x3F, 0x00, 0x1F, 0xC0, 0xFE, 0x00, 0x0F, 0xFF, 0xFC, 0x00, // row 31 - 33
|
||||
0x07, 0xFF, 0xF8, 0x00, 0x03, 0xFF, 0xF0, 0x00, 0x00, 0x7F, 0x80, 0x00, // row 34 - 36
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 39
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 40 - 42
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48
|
||||
};
|
||||
const unsigned char chr_f64_34[192] = // 4 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, // row 1 - 3
|
||||
0x00, 0x01, 0xF0, 0x00, 0x00, 0x03, 0xF0, 0x00, 0x00, 0x07, 0xF0, 0x00, // row 4 - 6
|
||||
0x00, 0x07, 0xF0, 0x00, 0x00, 0x0F, 0xF0, 0x00, 0x00, 0x1E, 0xF0, 0x00, // row 7 - 9
|
||||
0x00, 0x1E, 0xF0, 0x00, 0x00, 0x3C, 0xF0, 0x00, 0x00, 0x78, 0xF0, 0x00, // row 10 - 12
|
||||
0x00, 0xF8, 0xF0, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x01, 0xE0, 0xF0, 0x00, // row 13 - 15
|
||||
0x03, 0xC0, 0xF0, 0x00, 0x07, 0xC0, 0xF0, 0x00, 0x07, 0x80, 0xF0, 0x00, // row 16 - 18
|
||||
0x0F, 0x00, 0xF0, 0x00, 0x1F, 0x00, 0xF0, 0x00, 0x1E, 0x00, 0xF0, 0x00, // row 19 - 21
|
||||
0x3C, 0x00, 0xF0, 0x00, 0x78, 0x00, 0xF0, 0x00, 0x7F, 0xFF, 0xFF, 0x80, // row 22 - 24
|
||||
0x7F, 0xFF, 0xFF, 0x80, 0x7F, 0xFF, 0xFF, 0x80, 0x7F, 0xFF, 0xFF, 0x80, // row 25 - 27
|
||||
0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x00, // row 28 - 30
|
||||
0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x00, // row 31 - 33
|
||||
0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x00, // row 34 - 36
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 39
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 40 - 42
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48
|
||||
};
|
||||
const unsigned char chr_f64_35[192] = // 4 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xFE, 0x00, // row 1 - 3
|
||||
0x07, 0xFF, 0xFE, 0x00, 0x07, 0xFF, 0xFE, 0x00, 0x07, 0xFF, 0xFE, 0x00, // row 4 - 6
|
||||
0x07, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, // row 7 - 9
|
||||
0x0F, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, // row 10 - 12
|
||||
0x0E, 0x00, 0x00, 0x00, 0x1E, 0x3F, 0xC0, 0x00, 0x1E, 0xFF, 0xF0, 0x00, // row 13 - 15
|
||||
0x1F, 0xFF, 0xF8, 0x00, 0x1F, 0xFF, 0xFC, 0x00, 0x1F, 0xC0, 0xFE, 0x00, // row 16 - 18
|
||||
0x1F, 0x00, 0x3F, 0x00, 0x1E, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x0F, 0x00, // row 19 - 21
|
||||
0x00, 0x00, 0x0F, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, // row 22 - 24
|
||||
0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, // row 25 - 27
|
||||
0x3C, 0x00, 0x07, 0x80, 0x3C, 0x00, 0x0F, 0x80, 0x3C, 0x00, 0x0F, 0x00, // row 28 - 30
|
||||
0x3E, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x3F, 0x00, 0x1F, 0xC0, 0xFE, 0x00, // row 31 - 33
|
||||
0x0F, 0xFF, 0xFC, 0x00, 0x07, 0xFF, 0xF8, 0x00, 0x03, 0xFF, 0xF0, 0x00, // row 34 - 36
|
||||
0x00, 0x7F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 39
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 40 - 42
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48
|
||||
};
|
||||
const unsigned char chr_f64_36[192] = // 4 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x80, 0x00, 0x00, 0xFF, 0xF0, 0x00, // row 1 - 3
|
||||
0x03, 0xFF, 0xF8, 0x00, 0x07, 0xFF, 0xFC, 0x00, 0x0F, 0xE0, 0x7E, 0x00, // row 4 - 6
|
||||
0x1F, 0x80, 0x1F, 0x00, 0x1F, 0x00, 0x0F, 0x00, 0x1E, 0x00, 0x0F, 0x80, // row 7 - 9
|
||||
0x3E, 0x00, 0x07, 0x80, 0x3C, 0x00, 0x07, 0x80, 0x3C, 0x00, 0x00, 0x00, // row 10 - 12
|
||||
0x3C, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x3F, 0x80, 0x00, // row 13 - 15
|
||||
0x78, 0xFF, 0xF0, 0x00, 0x7B, 0xFF, 0xF8, 0x00, 0x7F, 0xFF, 0xFC, 0x00, // row 16 - 18
|
||||
0x7F, 0xC0, 0xFE, 0x00, 0x7F, 0x00, 0x3E, 0x00, 0x7E, 0x00, 0x1F, 0x00, // row 19 - 21
|
||||
0x7C, 0x00, 0x0F, 0x00, 0x7C, 0x00, 0x0F, 0x80, 0x78, 0x00, 0x07, 0x80, // row 22 - 24
|
||||
0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, // row 25 - 27
|
||||
0x78, 0x00, 0x07, 0x80, 0x3C, 0x00, 0x0F, 0x80, 0x3C, 0x00, 0x0F, 0x00, // row 28 - 30
|
||||
0x3E, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x3F, 0x00, 0x1F, 0xC0, 0xFE, 0x00, // row 31 - 33
|
||||
0x0F, 0xFF, 0xFC, 0x00, 0x07, 0xFF, 0xF8, 0x00, 0x01, 0xFF, 0xF0, 0x00, // row 34 - 36
|
||||
0x00, 0x7F, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 39
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 40 - 42
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48
|
||||
};
|
||||
const unsigned char chr_f64_37[192] = // 4 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFF, 0x80, // row 1 - 3
|
||||
0x3F, 0xFF, 0xFF, 0x80, 0x3F, 0xFF, 0xFF, 0x80, 0x3F, 0xFF, 0xFF, 0x80, // row 4 - 6
|
||||
0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x1E, 0x00, // row 7 - 9
|
||||
0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0xF8, 0x00, // row 10 - 12
|
||||
0x00, 0x01, 0xF0, 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x03, 0xE0, 0x00, // row 13 - 15
|
||||
0x00, 0x07, 0xC0, 0x00, 0x00, 0x07, 0xC0, 0x00, 0x00, 0x0F, 0x80, 0x00, // row 16 - 18
|
||||
0x00, 0x0F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, // row 19 - 21
|
||||
0x00, 0x3E, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, // row 22 - 24
|
||||
0x00, 0x7C, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, // row 25 - 27
|
||||
0x00, 0xF8, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, // row 28 - 30
|
||||
0x00, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x01, 0xF0, 0x00, 0x00, // row 31 - 33
|
||||
0x01, 0xE0, 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, // row 34 - 36
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 39
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 40 - 42
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48
|
||||
};
|
||||
const unsigned char chr_f64_38[192] = // 4 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x01, 0xFF, 0xE0, 0x00, // row 1 - 3
|
||||
0x07, 0xFF, 0xF8, 0x00, 0x0F, 0xFF, 0xFC, 0x00, 0x1F, 0xC0, 0xFE, 0x00, // row 4 - 6
|
||||
0x1F, 0x00, 0x3E, 0x00, 0x3E, 0x00, 0x1F, 0x00, 0x3E, 0x00, 0x1F, 0x00, // row 7 - 9
|
||||
0x3C, 0x00, 0x0F, 0x00, 0x3C, 0x00, 0x0F, 0x00, 0x3C, 0x00, 0x0F, 0x00, // row 10 - 12
|
||||
0x3E, 0x00, 0x1F, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1F, 0x00, 0x3E, 0x00, // row 13 - 15
|
||||
0x0F, 0xC0, 0xFC, 0x00, 0x07, 0xFF, 0xF8, 0x00, 0x03, 0xFF, 0xF0, 0x00, // row 16 - 18
|
||||
0x07, 0xFF, 0xF8, 0x00, 0x0F, 0xFF, 0xFC, 0x00, 0x1F, 0x80, 0x7E, 0x00, // row 19 - 21
|
||||
0x3E, 0x00, 0x1F, 0x00, 0x3C, 0x00, 0x0F, 0x00, 0x7C, 0x00, 0x0F, 0x80, // row 22 - 24
|
||||
0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, // row 25 - 27
|
||||
0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, 0x7C, 0x00, 0x0F, 0x80, // row 28 - 30
|
||||
0x7C, 0x00, 0x0F, 0x80, 0x3E, 0x00, 0x1F, 0x00, 0x3F, 0x80, 0x7F, 0x00, // row 31 - 33
|
||||
0x1F, 0xFF, 0xFE, 0x00, 0x0F, 0xFF, 0xFC, 0x00, 0x07, 0xFF, 0xF8, 0x00, // row 34 - 36
|
||||
0x00, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 39
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 40 - 42
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48
|
||||
};
|
||||
const unsigned char chr_f64_39[192] = // 4 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x80, 0x00, 0x03, 0xFF, 0xE0, 0x00, // row 1 - 3
|
||||
0x07, 0xFF, 0xF8, 0x00, 0x0F, 0xFF, 0xFC, 0x00, 0x1F, 0xC0, 0xFE, 0x00, // row 4 - 6
|
||||
0x3F, 0x00, 0x3E, 0x00, 0x3E, 0x00, 0x1F, 0x00, 0x3C, 0x00, 0x0F, 0x00, // row 7 - 9
|
||||
0x7C, 0x00, 0x0F, 0x00, 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, // row 10 - 12
|
||||
0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, // row 13 - 15
|
||||
0x7C, 0x00, 0x0F, 0x80, 0x3C, 0x00, 0x0F, 0x80, 0x3E, 0x00, 0x1F, 0x80, // row 16 - 18
|
||||
0x1F, 0x00, 0x3F, 0x80, 0x1F, 0xC0, 0xFF, 0x80, 0x0F, 0xFF, 0xFF, 0x80, // row 19 - 21
|
||||
0x07, 0xFF, 0xF7, 0x80, 0x03, 0xFF, 0xC7, 0x80, 0x00, 0x7F, 0x07, 0x80, // row 22 - 24
|
||||
0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, // row 25 - 27
|
||||
0x78, 0x00, 0x0F, 0x00, 0x78, 0x00, 0x1F, 0x00, 0x7C, 0x00, 0x1E, 0x00, // row 28 - 30
|
||||
0x3C, 0x00, 0x3E, 0x00, 0x3E, 0x00, 0x7E, 0x00, 0x1F, 0x81, 0xFC, 0x00, // row 31 - 33
|
||||
0x0F, 0xFF, 0xF8, 0x00, 0x07, 0xFF, 0xF0, 0x00, 0x03, 0xFF, 0xC0, 0x00, // row 34 - 36
|
||||
0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 39
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 40 - 42
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48
|
||||
};
|
||||
const unsigned char chr_f64_3A[144] = // 3 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 4
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 5 - 8
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xC0, 0x00, 0x07, 0xC0, 0x00, // row 9 - 12
|
||||
0x07, 0xC0, 0x00, 0x07, 0xC0, 0x00, 0x07, 0xC0, 0x00, 0x00, 0x00, 0x00, // row 13 - 16
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 17 - 20
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 21 - 24
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xC0, 0x00, // row 25 - 28
|
||||
0x07, 0xC0, 0x00, 0x07, 0xC0, 0x00, 0x07, 0xC0, 0x00, 0x07, 0xC0, 0x00, // row 29 - 32
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 33 - 36
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 40
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 41 - 44
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 45 - 48
|
||||
};
|
||||
const unsigned char chr_f64_61[192] = // 4 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 3
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 4 - 6
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 7 - 9
|
||||
0x00, 0x7F, 0xC0, 0x00, 0x01, 0xFF, 0xF8, 0x00, 0x07, 0xFF, 0xFC, 0x00, // row 10 - 12
|
||||
0x07, 0xFF, 0xFE, 0x00, 0x0F, 0xC0, 0x7E, 0x00, 0x1F, 0x00, 0x1F, 0x00, // row 13 - 15
|
||||
0x1E, 0x00, 0x0F, 0x00, 0x1E, 0x00, 0x0F, 0x00, 0x1E, 0x00, 0x0F, 0x00, // row 16 - 18
|
||||
0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x0F, 0xFF, 0x00, // row 19 - 21
|
||||
0x01, 0xFF, 0xFF, 0x00, 0x07, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xCF, 0x00, // row 22 - 24
|
||||
0x1F, 0xF0, 0x0F, 0x00, 0x1F, 0x00, 0x0F, 0x00, 0x3E, 0x00, 0x0F, 0x00, // row 25 - 27
|
||||
0x3C, 0x00, 0x0F, 0x00, 0x3C, 0x00, 0x0F, 0x00, 0x3C, 0x00, 0x1F, 0x00, // row 28 - 30
|
||||
0x3C, 0x00, 0x3F, 0x00, 0x3E, 0x00, 0x7F, 0x00, 0x1F, 0x01, 0xFF, 0xC0, // row 31 - 33
|
||||
0x1F, 0xFF, 0xE7, 0xC0, 0x0F, 0xFF, 0xC7, 0xC0, 0x07, 0xFF, 0x03, 0xC0, // row 34 - 36
|
||||
0x01, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 39
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 40 - 42
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48
|
||||
};
|
||||
const unsigned char chr_f64_6D[288] = // 6 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 2
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 3 - 4
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 5 - 6
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 7 - 8
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xE0, 0x1F, 0xC0, 0x00, // row 9 - 10
|
||||
0x1E, 0x3F, 0xF0, 0x7F, 0xF0, 0x00, 0x1E, 0xFF, 0xF8, 0xFF, 0xF8, 0x00, // row 11 - 12
|
||||
0x1E, 0xFF, 0xFD, 0xFF, 0xFC, 0x00, 0x1F, 0xE0, 0x7F, 0xE0, 0x7C, 0x00, // row 13 - 14
|
||||
0x1F, 0x80, 0x3F, 0x80, 0x3E, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1E, 0x00, // row 15 - 16
|
||||
0x1F, 0x00, 0x1F, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, // row 17 - 18
|
||||
0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, // row 19 - 20
|
||||
0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, // row 21 - 22
|
||||
0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, // row 23 - 24
|
||||
0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, // row 25 - 26
|
||||
0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, // row 27 - 28
|
||||
0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, // row 29 - 30
|
||||
0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, // row 31 - 32
|
||||
0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, // row 33 - 34
|
||||
0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, // row 35 - 36
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 38
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 39 - 40
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 41 - 42
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 44
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 45 - 46
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 47 - 48
|
||||
};
|
||||
const unsigned char chr_f64_70[192] = // 4 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 3
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 4 - 6
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 7 - 9
|
||||
0x00, 0x0F, 0xE0, 0x00, 0x1E, 0x3F, 0xFC, 0x00, 0x1E, 0x7F, 0xFE, 0x00, // row 10 - 12
|
||||
0x1E, 0xFF, 0xFF, 0x00, 0x1F, 0xF0, 0x3F, 0x80, 0x1F, 0xC0, 0x0F, 0x80, // row 13 - 15
|
||||
0x1F, 0x80, 0x07, 0xC0, 0x1F, 0x00, 0x03, 0xC0, 0x1F, 0x00, 0x03, 0xC0, // row 16 - 18
|
||||
0x1F, 0x00, 0x03, 0xE0, 0x1E, 0x00, 0x01, 0xE0, 0x1E, 0x00, 0x01, 0xE0, // row 19 - 21
|
||||
0x1E, 0x00, 0x01, 0xE0, 0x1E, 0x00, 0x01, 0xE0, 0x1E, 0x00, 0x01, 0xE0, // row 22 - 24
|
||||
0x1E, 0x00, 0x01, 0xE0, 0x1E, 0x00, 0x01, 0xE0, 0x1E, 0x00, 0x01, 0xE0, // row 25 - 27
|
||||
0x1E, 0x00, 0x03, 0xE0, 0x1F, 0x00, 0x03, 0xC0, 0x1F, 0x00, 0x07, 0xC0, // row 28 - 30
|
||||
0x1F, 0x80, 0x07, 0xC0, 0x1F, 0xC0, 0x0F, 0x80, 0x1F, 0xF0, 0x3F, 0x80, // row 31 - 33
|
||||
0x1E, 0xFF, 0xFF, 0x00, 0x1E, 0x7F, 0xFE, 0x00, 0x1E, 0x3F, 0xFC, 0x00, // row 34 - 36
|
||||
0x1E, 0x0F, 0xE0, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, // row 37 - 39
|
||||
0x1E, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, // row 40 - 42
|
||||
0x1E, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, // row 43 - 45
|
||||
0x1E, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48
|
||||
};
|
||||
|
||||
const unsigned char * chrtbl_f64[96] = // character pointer table
|
||||
{
|
||||
chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20,
|
||||
chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_2E, chr_f64_20,
|
||||
chr_f64_30, chr_f64_31, chr_f64_32, chr_f64_33, chr_f64_34, chr_f64_35, chr_f64_36, chr_f64_37,
|
||||
chr_f64_38, chr_f64_39, chr_f64_3A, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20,
|
||||
chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20,
|
||||
chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20,
|
||||
chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20,
|
||||
chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20,
|
||||
chr_f64_20, chr_f64_61, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20,
|
||||
chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_6D, chr_f64_20, chr_f64_20,
|
||||
chr_f64_70, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20,
|
||||
chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20
|
||||
};
|
@ -1,7 +0,0 @@
|
||||
#define nr_chrs_f64 96
|
||||
#define chr_hgt_f64 48
|
||||
#define data_size_f64 8
|
||||
#define firstchr_f64 32
|
||||
|
||||
extern const unsigned char widtbl_f64[96];
|
||||
extern const unsigned char* chrtbl_f64[96];
|
@ -1,264 +0,0 @@
|
||||
// Font size 7 is a 7 segment font intended to display numbers and time
|
||||
// This font only contains characters [space] 0 1 2 3 4 5 6 7 8 9 : .
|
||||
// All other characters print as a space
|
||||
|
||||
#include "Font7s.h"
|
||||
|
||||
|
||||
const unsigned char widtbl_f7s[96] = // character width table
|
||||
{
|
||||
12, 12, 12, 12, 12, 12, 12, 12, // char 32 - 39
|
||||
12, 12, 12, 12, 12, 12, 12, 12, // char 40 - 47
|
||||
32, 32, 32, 32, 32, 32, 32, 32, // char 48 - 55
|
||||
32, 32, 12, 12, 12, 12, 12, 12, // char 56 - 63
|
||||
12, 12, 12, 12, 12, 12, 12, 12, // char 64 - 71
|
||||
12, 12, 12, 12, 12, 12, 12, 12, // char 72 - 79
|
||||
12, 12, 12, 12, 12, 12, 12, 12, // char 80 - 87
|
||||
12, 12, 12, 12, 12, 12, 12, 12, // char 88 - 95
|
||||
12, 12, 12, 12, 12, 12, 12, 12, // char 96 - 103
|
||||
12, 12, 12, 12, 12, 12, 12, 12, // char 104 - 111
|
||||
12, 12, 12, 12, 12, 12, 12, 12, // char 112 - 119
|
||||
12, 12, 12, 12, 12, 12, 12, 12 // char 120 - 127
|
||||
};
|
||||
|
||||
// Row format, MSB left
|
||||
|
||||
const unsigned char chr_f7s_20[96] = // 2 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 6
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 7 - 12
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 13 - 18
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 19 - 24
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 25 - 30
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 31 - 36
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 42
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 43 - 48
|
||||
};
|
||||
const unsigned char chr_f7s_2E[96] = // 2 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 6
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 7 - 12
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 13 - 18
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 19 - 24
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 25 - 30
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 31 - 36
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 42
|
||||
0x0E, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x0E, 0x00, 0x00, 0x00 // row 43 - 48
|
||||
};
|
||||
const unsigned char chr_f7s_30[192] = // 4 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x01, 0xFF, 0xFF, 0x00, // row 1 - 3
|
||||
0x03, 0xFF, 0xFF, 0x80, 0x01, 0xFF, 0xFF, 0x20, 0x0C, 0xFF, 0xFE, 0x70, // row 4 - 6
|
||||
0x1E, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 7 - 9
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 10 - 12
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 13 - 15
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 16 - 18
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3E, 0x00, 0x00, 0xF8, // row 19 - 21
|
||||
0x38, 0x00, 0x00, 0x38, 0x20, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, // row 22 - 24
|
||||
0x20, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x18, 0x3E, 0x00, 0x00, 0x78, // row 25 - 27
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 28 - 30
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 31 - 33
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 34 - 36
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 37 - 39
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x1E, 0x00, 0x00, 0xF0, // row 40 - 42
|
||||
0x0C, 0xFF, 0xFE, 0x60, 0x01, 0xFF, 0xFF, 0x00, 0x03, 0xFF, 0xFF, 0x80, // row 43 - 45
|
||||
0x01, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48
|
||||
};
|
||||
const unsigned char chr_f7s_31[192] = // 4 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 3
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, // row 4 - 6
|
||||
0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 7 - 9
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 10 - 12
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 13 - 15
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 16 - 18
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x00, 0x78, // row 19 - 21
|
||||
0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, // row 22 - 24
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x78, // row 25 - 27
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 28 - 30
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 31 - 33
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 34 - 36
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 37 - 39
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x00, 0xF0, // row 40 - 42
|
||||
0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48
|
||||
};
|
||||
const unsigned char chr_f7s_32[192] = // 4 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x01, 0xFF, 0xFF, 0x00, // row 1 - 3
|
||||
0x03, 0xFF, 0xFF, 0x80, 0x01, 0xFF, 0xFF, 0x20, 0x00, 0xFF, 0xFE, 0x70, // row 4 - 6
|
||||
0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 7 - 9
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 10 - 12
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 13 - 15
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 16 - 18
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x00, 0xF8, // row 19 - 21
|
||||
0x00, 0xFF, 0xFE, 0x38, 0x03, 0xFF, 0xFF, 0x88, 0x0F, 0xFF, 0xFF, 0xE0, // row 22 - 24
|
||||
0x27, 0xFF, 0xFF, 0xC0, 0x39, 0xFF, 0xFF, 0x00, 0x3E, 0x00, 0x00, 0x00, // row 25 - 27
|
||||
0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, // row 28 - 30
|
||||
0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, // row 31 - 33
|
||||
0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, // row 34 - 36
|
||||
0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, // row 37 - 39
|
||||
0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, // row 40 - 42
|
||||
0x0C, 0xFF, 0xFE, 0x00, 0x01, 0xFF, 0xFF, 0x00, 0x03, 0xFF, 0xFF, 0x80, // row 43 - 45
|
||||
0x01, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48
|
||||
};
|
||||
const unsigned char chr_f7s_33[192] = // 4 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x01, 0xFF, 0xFF, 0x00, // row 1 - 3
|
||||
0x03, 0xFF, 0xFF, 0x80, 0x01, 0xFF, 0xFF, 0x20, 0x00, 0xFF, 0xFE, 0x70, // row 4 - 6
|
||||
0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 7 - 9
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 10 - 12
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 13 - 15
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 16 - 18
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x00, 0xF8, // row 19 - 21
|
||||
0x00, 0xFF, 0xFE, 0x38, 0x03, 0xFF, 0xFF, 0x88, 0x0F, 0xFF, 0xFF, 0xE0, // row 22 - 24
|
||||
0x07, 0xFF, 0xFF, 0xC0, 0x01, 0xFF, 0xFF, 0x18, 0x00, 0x00, 0x00, 0x78, // row 25 - 27
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 28 - 30
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 31 - 33
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 34 - 36
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 37 - 39
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x00, 0xF0, // row 40 - 42
|
||||
0x00, 0xFF, 0xFE, 0x60, 0x01, 0xFF, 0xFF, 0x00, 0x03, 0xFF, 0xFF, 0x80, // row 43 - 45
|
||||
0x01, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48
|
||||
};
|
||||
const unsigned char chr_f7s_34[192] = // 4 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 3
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x0C, 0x00, 0x00, 0x70, // row 4 - 6
|
||||
0x1E, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 7 - 9
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 10 - 12
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 13 - 15
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 16 - 18
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3E, 0x00, 0x00, 0xF8, // row 19 - 21
|
||||
0x38, 0xFF, 0xFE, 0x38, 0x23, 0xFF, 0xFF, 0x88, 0x0F, 0xFF, 0xFF, 0xE0, // row 22 - 24
|
||||
0x07, 0xFF, 0xFF, 0xC0, 0x01, 0xFF, 0xFF, 0x18, 0x00, 0x00, 0x00, 0x78, // row 25 - 27
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 28 - 30
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 31 - 33
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 34 - 36
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 37 - 39
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x00, 0xF0, // row 40 - 42
|
||||
0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48
|
||||
};
|
||||
const unsigned char chr_f7s_35[192] = // 4 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x01, 0xFF, 0xFF, 0x00, // row 1 - 3
|
||||
0x03, 0xFF, 0xFF, 0x80, 0x01, 0xFF, 0xFF, 0x00, 0x0C, 0xFF, 0xFE, 0x00, // row 4 - 6
|
||||
0x1E, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, // row 7 - 9
|
||||
0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, // row 10 - 12
|
||||
0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, // row 13 - 15
|
||||
0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, // row 16 - 18
|
||||
0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, // row 19 - 21
|
||||
0x38, 0xFF, 0xFE, 0x00, 0x23, 0xFF, 0xFF, 0x80, 0x0F, 0xFF, 0xFF, 0xE0, // row 22 - 24
|
||||
0x07, 0xFF, 0xFF, 0xC0, 0x01, 0xFF, 0xFF, 0x18, 0x00, 0x00, 0x00, 0x78, // row 25 - 27
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 28 - 30
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 31 - 33
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 34 - 36
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 37 - 39
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x00, 0xF0, // row 40 - 42
|
||||
0x00, 0xFF, 0xFE, 0x60, 0x01, 0xFF, 0xFF, 0x00, 0x03, 0xFF, 0xFF, 0x80, // row 43 - 45
|
||||
0x01, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48
|
||||
};
|
||||
const unsigned char chr_f7s_36[192] = // 4 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x01, 0xFF, 0xFF, 0x00, // row 1 - 3
|
||||
0x03, 0xFF, 0xFF, 0x80, 0x01, 0xFF, 0xFF, 0x00, 0x0C, 0xFF, 0xFE, 0x00, // row 4 - 6
|
||||
0x1E, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, // row 7 - 9
|
||||
0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, // row 10 - 12
|
||||
0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, // row 13 - 15
|
||||
0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, // row 16 - 18
|
||||
0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, // row 19 - 21
|
||||
0x38, 0xFF, 0xFE, 0x00, 0x23, 0xFF, 0xFF, 0x80, 0x0F, 0xFF, 0xFF, 0xE0, // row 22 - 24
|
||||
0x27, 0xFF, 0xFF, 0xC0, 0x39, 0xFF, 0xFF, 0x18, 0x3E, 0x00, 0x00, 0x78, // row 25 - 27
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 28 - 30
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 31 - 33
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 34 - 36
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 37 - 39
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x1E, 0x00, 0x00, 0xF0, // row 40 - 42
|
||||
0x0C, 0xFF, 0xFE, 0x60, 0x01, 0xFF, 0xFF, 0x00, 0x03, 0xFF, 0xFF, 0x80, // row 43 - 45
|
||||
0x01, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48
|
||||
};
|
||||
const unsigned char chr_f7s_37[192] = // 4 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x01, 0xFF, 0xFF, 0x00, // row 1 - 3
|
||||
0x03, 0xFF, 0xFF, 0x80, 0x01, 0xFF, 0xFF, 0x20, 0x00, 0xFF, 0xFE, 0x70, // row 4 - 6
|
||||
0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 7 - 9
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 10 - 12
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 13 - 15
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 16 - 18
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x00, 0xF8, // row 19 - 21
|
||||
0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, // row 22 - 24
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x78, // row 25 - 27
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 28 - 30
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 31 - 33
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 34 - 36
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 37 - 39
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x00, 0xF0, // row 40 - 42
|
||||
0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48
|
||||
};
|
||||
const unsigned char chr_f7s_38[192] = // 4 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x01, 0xFF, 0xFF, 0x00, // row 1 - 3
|
||||
0x03, 0xFF, 0xFF, 0x80, 0x01, 0xFF, 0xFF, 0x20, 0x0C, 0xFF, 0xFE, 0x70, // row 4 - 6
|
||||
0x1E, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 7 - 9
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 10 - 12
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 13 - 15
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 16 - 18
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3E, 0x00, 0x00, 0xF8, // row 19 - 21
|
||||
0x38, 0xFF, 0xFE, 0x38, 0x23, 0xFF, 0xFF, 0x88, 0x0F, 0xFF, 0xFF, 0xE0, // row 22 - 24
|
||||
0x27, 0xFF, 0xFF, 0xC0, 0x39, 0xFF, 0xFF, 0x18, 0x3E, 0x00, 0x00, 0x78, // row 25 - 27
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 28 - 30
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 31 - 33
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 34 - 36
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 37 - 39
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x1E, 0x00, 0x00, 0xF0, // row 40 - 42
|
||||
0x0C, 0xFF, 0xFE, 0x60, 0x01, 0xFF, 0xFF, 0x00, 0x03, 0xFF, 0xFF, 0x80, // row 43 - 45
|
||||
0x01, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48
|
||||
};
|
||||
const unsigned char chr_f7s_39[192] = // 4 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x01, 0xFF, 0xFF, 0x00, // row 1 - 3
|
||||
0x03, 0xFF, 0xFF, 0x80, 0x01, 0xFF, 0xFF, 0x20, 0x0C, 0xFF, 0xFE, 0x70, // row 4 - 6
|
||||
0x1E, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 7 - 9
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 10 - 12
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 13 - 15
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 16 - 18
|
||||
0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3E, 0x00, 0x00, 0xF8, // row 19 - 21
|
||||
0x38, 0xFF, 0xFE, 0x38, 0x23, 0xFF, 0xFF, 0x88, 0x0F, 0xFF, 0xFF, 0xE0, // row 22 - 24
|
||||
0x07, 0xFF, 0xFF, 0xC0, 0x01, 0xFF, 0xFF, 0x18, 0x00, 0x00, 0x00, 0x78, // row 25 - 27
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 28 - 30
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 31 - 33
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 34 - 36
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 37 - 39
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x00, 0xF0, // row 40 - 42
|
||||
0x00, 0xFF, 0xFE, 0x60, 0x01, 0xFF, 0xFF, 0x00, 0x03, 0xFF, 0xFF, 0x80, // row 43 - 45
|
||||
0x01, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48
|
||||
};
|
||||
const unsigned char chr_f7s_3A[96] = // 2 bytes per row
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 6
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 7 - 12
|
||||
0x00, 0x00, 0x0E, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x0E, 0x00, // row 13 - 18
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 19 - 24
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 25 - 30
|
||||
0x0E, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x0E, 0x00, 0x00, 0x00, // row 31 - 36
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 42
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 43 - 48
|
||||
};
|
||||
|
||||
const unsigned char * chrtbl_f7s[96] = // character pointer table
|
||||
{
|
||||
chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20,
|
||||
chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_2E, chr_f7s_20,
|
||||
chr_f7s_30, chr_f7s_31, chr_f7s_32, chr_f7s_33, chr_f7s_34, chr_f7s_35, chr_f7s_36, chr_f7s_37,
|
||||
chr_f7s_38, chr_f7s_39, chr_f7s_3A, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20,
|
||||
chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20,
|
||||
chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20,
|
||||
chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20,
|
||||
chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20,
|
||||
chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20,
|
||||
chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20,
|
||||
chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20,
|
||||
chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20
|
||||
};
|
@ -1,7 +0,0 @@
|
||||
#define nr_chrs_f7s 96
|
||||
#define chr_hgt_f7s 48
|
||||
#define data_size_f7s 8
|
||||
#define firstchr_f7s 32
|
||||
|
||||
extern const unsigned char widtbl_f7s[96];
|
||||
extern const unsigned char * chrtbl_f7s[96];
|
@ -1,8 +0,0 @@
|
||||
// Comment out the #defines below with // to stop that font being loaded
|
||||
// If all fonts are loaded the total space required is ablout 17890 bytes
|
||||
|
||||
//#define LOAD_GLCD // Standard Adafruit font needs ~1792 bytes in FLASH
|
||||
//#define LOAD_FONT2 // Small font, needs ~3092 bytes in FLASH
|
||||
//#define LOAD_FONT4 // Medium font, needs ~8126 bytes in FLASH
|
||||
//#define LOAD_FONT6 // Large font, needs ~4404 bytes in FLASH
|
||||
//#define LOAD_FONT7 // 7 segment font, needs ~3652 bytes in FLASH
|
@ -1,79 +0,0 @@
|
||||
#ifndef INCLUDE_HSPI_H_
|
||||
#define INCLUDE_HSPI_H_
|
||||
|
||||
#include "spi_register.h"
|
||||
#include <osapi.h>
|
||||
#include <os_type.h>
|
||||
#include <gpio.h>
|
||||
#include <ets_sys.h>
|
||||
|
||||
#define SPI 0
|
||||
#define HSPI 1
|
||||
|
||||
#define SPIFIFOSIZE 16 //16 words length
|
||||
|
||||
extern uint32_t *spi_fifo;
|
||||
extern uint32_t current_spi_port;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
spi_mode_tx,
|
||||
spi_mode_txrx
|
||||
} spi_mode;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t spi_port;
|
||||
uint32_t clock_reg_val;
|
||||
spi_mode mode;
|
||||
} spi_config;
|
||||
|
||||
spi_config spi_init(uint32_t spi_port, uint32_t prescaler, spi_mode mode);
|
||||
void spi_reinit(spi_config *config);
|
||||
void spi_send_data(const uint8_t * data, uint8_t datasize);
|
||||
void spi_send_uint16_r(const uint16_t data, int32_t repeats);
|
||||
static inline void spi_wait_ready(void){while (READ_PERI_REG(SPI_FLASH_CMD(current_spi_port))&SPI_FLASH_USR);}
|
||||
|
||||
static inline void spi_prepare_tx(uint32_t bytecount)
|
||||
{
|
||||
uint32_t bitcount = bytecount * 8 - 1;
|
||||
|
||||
WRITE_PERI_REG(SPI_FLASH_USER1(current_spi_port), (bitcount & SPI_USR_OUT_BITLEN) << SPI_USR_OUT_BITLEN_S);
|
||||
}
|
||||
|
||||
static inline void spi_prepare_txrx_bits(uint32_t txbitcount, uint32_t rxbitcount)
|
||||
{
|
||||
WRITE_PERI_REG(SPI_FLASH_USER1(current_spi_port), ((txbitcount & SPI_USR_OUT_BITLEN) << SPI_USR_OUT_BITLEN_S) |
|
||||
((rxbitcount & SPI_USR_DIN_BITLEN) << SPI_USR_DIN_BITLEN_S));
|
||||
}
|
||||
|
||||
static inline void spi_start_tx()
|
||||
{
|
||||
SET_PERI_REG_MASK(SPI_FLASH_CMD(current_spi_port), SPI_FLASH_USR); // send
|
||||
}
|
||||
|
||||
static inline void spi_send_uint8(uint8_t data)
|
||||
{
|
||||
spi_prepare_tx(1);
|
||||
*spi_fifo = data;
|
||||
spi_start_tx();
|
||||
}
|
||||
|
||||
static inline void spi_send_uint16(uint16_t data)
|
||||
{
|
||||
spi_prepare_tx(2);
|
||||
*spi_fifo = data;
|
||||
spi_start_tx();
|
||||
}
|
||||
|
||||
static inline void spi_send_uint32(uint32_t data)
|
||||
{
|
||||
spi_prepare_tx(4);
|
||||
*spi_fifo = data;
|
||||
spi_start_tx();
|
||||
}
|
||||
|
||||
/* This is needed to implement XPT2046 driver since it transmits 13 bits back*/
|
||||
extern uint16_t spi_send_uint8_receive_13bits(uint8_t to_send);
|
||||
|
||||
#endif /* INCLUDE_HSPI_H_ */
|
@ -1,239 +0,0 @@
|
||||
//Generated at 2014-07-29 11:03:29
|
||||
/*
|
||||
* Copyright (c) 2010 - 2011 Espressif System
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SPI_REGISTER_H_INCLUDED
|
||||
#define SPI_REGISTER_H_INCLUDED
|
||||
|
||||
#define REG_SPI_BASE(i) (0x60000200-i*0x100)
|
||||
|
||||
#define SPI_FLASH_CMD(i) (REG_SPI_BASE(i) + 0x0)
|
||||
#define SPI_FLASH_READ (BIT(31))
|
||||
#define SPI_FLASH_WREN (BIT(30))
|
||||
#define SPI_FLASH_WRDI (BIT(29))
|
||||
#define SPI_FLASH_RDID (BIT(28))
|
||||
#define SPI_FLASH_RDSR (BIT(27))
|
||||
#define SPI_FLASH_WRSR (BIT(26))
|
||||
#define SPI_FLASH_PP (BIT(25))
|
||||
#define SPI_FLASH_SE (BIT(24))
|
||||
#define SPI_FLASH_BE (BIT(23))
|
||||
#define SPI_FLASH_CE (BIT(22))
|
||||
#define SPI_FLASH_DP (BIT(21))
|
||||
#define SPI_FLASH_RES (BIT(20))
|
||||
#define SPI_FLASH_HPM (BIT(19))
|
||||
#define SPI_FLASH_USR (BIT(18))
|
||||
|
||||
#define SPI_FLASH_ADDR(i) (REG_SPI_BASE(i) + 0x4)
|
||||
|
||||
#define SPI_FLASH_CTRL(i) (REG_SPI_BASE(i) + 0x8)
|
||||
#define SPI_WR_BIT_ODER (BIT(26))
|
||||
#define SPI_RD_BIT_ODER (BIT(25))
|
||||
#define SPI_QIO_MODE (BIT(24))
|
||||
#define SPI_DIO_MODE (BIT(23))
|
||||
#define SPI_TWO_BYTE_STATUS_EN (BIT(22))
|
||||
#define SPI_WP_REG (BIT(21))
|
||||
#define SPI_QOUT_MODE (BIT(20))
|
||||
#define SPI_SHARE_BUS (BIT(19))
|
||||
#define SPI_HOLD_MODE (BIT(18))
|
||||
#define SPI_ENABLE_AHB (BIT(17))
|
||||
#define SPI_SST_AAI (BIT(16))
|
||||
#define SPI_RESANDRES (BIT(15))
|
||||
#define SPI_DOUT_MODE (BIT(14))
|
||||
#define SPI_FASTRD_MODE (BIT(13))
|
||||
|
||||
#define SPI_FLASH_CTRL1(i) (REG_SPI_BASE (i) + 0xC)
|
||||
#define SPI_T_CSH 0x0000000F
|
||||
#define SPI_T_CSH_S 28
|
||||
#define SPI_T_RES 0x00000FFF
|
||||
#define SPI_T_RES_S 16
|
||||
#define SPI_BUS_TIMER_LIMIT 0x0000FFFF
|
||||
#define SPI_BUS_TIMER_LIMIT_S 0
|
||||
|
||||
#define SPI_FLASH_STATUS(i) (REG_SPI_BASE(i) + 0x10)
|
||||
#define SPI_STATUS_EXT 0x000000FF
|
||||
#define SPI_STATUS_EXT_S 24
|
||||
#define SPI_WB_MODE 0x000000FF
|
||||
#define SPI_WB_MODE_S 16
|
||||
#define SPI_FLASH_STATUS_PRO_FLAG (BIT(7))
|
||||
#define SPI_FLASH_TOP_BOT_PRO_FLAG (BIT(5))
|
||||
#define SPI_FLASH_BP2 (BIT(4))
|
||||
#define SPI_FLASH_BP1 (BIT(3))
|
||||
#define SPI_FLASH_BP0 (BIT(2))
|
||||
#define SPI_FLASH_WRENABLE_FLAG (BIT(1))
|
||||
#define SPI_FLASH_BUSY_FLAG (BIT(0))
|
||||
|
||||
#define SPI_FLASH_CTRL2(i) (REG_SPI_BASE(i) + 0x14)
|
||||
#define SPI_CS_DELAY_NUM 0x0000000F
|
||||
#define SPI_CS_DELAY_NUM_S 28
|
||||
#define SPI_CS_DELAY_MODE 0x00000003
|
||||
#define SPI_CS_DELAY_MODE_S 26
|
||||
#define SPI_MOSI_DELAY_NUM 0x00000007
|
||||
#define SPI_MOSI_DELAY_NUM_S 23
|
||||
#define SPI_MOSI_DELAY_MODE 0x00000003
|
||||
#define SPI_MOSI_DELAY_MODE_S 21
|
||||
#define SPI_MISO_DELAY_NUM 0x00000007
|
||||
#define SPI_MISO_DELAY_NUM_S 18
|
||||
#define SPI_MISO_DELAY_MODE 0x00000003
|
||||
#define SPI_MISO_DELAY_MODE_S 16
|
||||
#define SPI_CK_OUT_HIGH_MODE 0x0000000F
|
||||
#define SPI_CK_OUT_HIGH_MODE_S 12
|
||||
#define SPI_CK_OUT_LOW_MODE 0x0000000F
|
||||
#define SPI_CK_OUT_LOW_MODE_S 8
|
||||
#define SPI_HOLD_TIME 0x0000000F
|
||||
#define SPI_HOLD_TIME_S 4
|
||||
#define SPI_SETUP_TIME 0x0000000F
|
||||
#define SPI_SETUP_TIME_S 0
|
||||
|
||||
#define SPI_FLASH_CLOCK(i) (REG_SPI_BASE(i) + 0x18)
|
||||
#define SPI_CLK_EQU_SYSCLK (BIT(31))
|
||||
#define SPI_CLKDIV_PRE 0x00001FFF
|
||||
#define SPI_CLKDIV_PRE_S 18
|
||||
#define SPI_CLKCNT_N 0x0000003F
|
||||
#define SPI_CLKCNT_N_S 12
|
||||
#define SPI_CLKCNT_H 0x0000003F
|
||||
#define SPI_CLKCNT_H_S 6
|
||||
#define SPI_CLKCNT_L 0x0000003F
|
||||
#define SPI_CLKCNT_L_S 0
|
||||
|
||||
#define SPI_FLASH_USER(i) (REG_SPI_BASE(i) + 0x1C)
|
||||
#define SPI_USR_COMMAND (BIT(31))
|
||||
#define SPI_FLASH_USR_ADDR (BIT(30))
|
||||
#define SPI_FLASH_USR_DUMMY (BIT(29))
|
||||
#define SPI_FLASH_USR_DIN (BIT(28))
|
||||
#define SPI_FLASH_DOUT (BIT(27))
|
||||
#define SPI_USR_DUMMY_IDLE (BIT(26))
|
||||
#define SPI_USR_DOUT_HIGHPART (BIT(25))
|
||||
#define SPI_USR_DIN_HIGHPART (BIT(24))
|
||||
#define SPI_USR_PREP_HOLD (BIT(23))
|
||||
#define SPI_USR_CMD_HOLD (BIT(22))
|
||||
#define SPI_USR_ADDR_HOLD (BIT(21))
|
||||
#define SPI_USR_DUMMY_HOLD (BIT(20))
|
||||
#define SPI_USR_DIN_HOLD (BIT(19))
|
||||
#define SPI_USR_DOUT_HOLD (BIT(18))
|
||||
#define SPI_USR_HOLD_POL (BIT(17))
|
||||
#define SPI_SIO (BIT(16))
|
||||
#define SPI_FWRITE_QIO (BIT(15))
|
||||
#define SPI_FWRITE_DIO (BIT(14))
|
||||
#define SPI_FWRITE_QUAD (BIT(13))
|
||||
#define SPI_FWRITE_DUAL (BIT(12))
|
||||
#define SPI_WR_BYTE_ORDER (BIT(11))
|
||||
#define SPI_RD_BYTE_ORDER (BIT(10))
|
||||
#define SPI_AHB_ENDIAN_MODE 0x00000003
|
||||
#define SPI_AHB_ENDIAN_MODE_S 8
|
||||
#define SPI_CK_OUT_EDGE (BIT(7))
|
||||
#define SPI_CK_I_EDGE (BIT(6))
|
||||
#define SPI_CS_SETUP (BIT(5))
|
||||
#define SPI_CS_HOLD (BIT(4))
|
||||
#define SPI_AHB_USR_COMMAND (BIT(3))
|
||||
#define SPI_AHB_USR_COMMAND_4BYTE (BIT(1))
|
||||
#define SPI_DOUTDIN (BIT(0))
|
||||
|
||||
#define SPI_FLASH_USER1(i) (REG_SPI_BASE(i) + 0x20)
|
||||
#define SPI_USR_ADDR_BITLEN 0x0000003F
|
||||
#define SPI_USR_ADDR_BITLEN_S 26
|
||||
#define SPI_USR_OUT_BITLEN 0x000001FF
|
||||
#define SPI_USR_OUT_BITLEN_S 17
|
||||
#define SPI_USR_DIN_BITLEN 0x000001FF
|
||||
#define SPI_USR_DIN_BITLEN_S 8
|
||||
#define SPI_USR_DUMMY_CYCLELEN 0x000000FF
|
||||
#define SPI_USR_DUMMY_CYCLELEN_S 0
|
||||
|
||||
#define SPI_FLASH_USER2(i) (REG_SPI_BASE(i) + 0x24)
|
||||
#define SPI_USR_COMMAND_BITLEN 0x0000000F
|
||||
#define SPI_USR_COMMAND_BITLEN_S 28
|
||||
#define SPI_USR_COMMAND_VALUE 0x0000FFFF
|
||||
#define SPI_USR_COMMAND_VALUE_S 0
|
||||
|
||||
#define SPI_FLASH_USER3(i) (REG_SPI_BASE(i) + 0x28)
|
||||
#define SPI_FLASH_PIN(i) (REG_SPI_BASE(i) + 0x2C)
|
||||
#define SPI_FLASH_SLAVE(i) (REG_SPI_BASE(i) + 0x30)
|
||||
#define SPI_SYNC_RESET (BIT(31))
|
||||
#define SPI_SLAVE_MODE (BIT(30))
|
||||
#define SPI_SLV_WR_RD_BUF_EN (BIT(29))
|
||||
#define SPI_SLV_WR_RD_STA_EN (BIT(28))
|
||||
#define SPI_SLV_CMD_DEFINE (BIT(27))
|
||||
#define SPI_TRANS_CNT 0x0000000F
|
||||
#define SPI_TRANS_CNT_S 23
|
||||
#define SPI_SLV_LAST_STATE 0x00000007
|
||||
#define SPI_SLV_LAST_STATE_S 20
|
||||
#define SPI_SLV_LAST_COMMAND 0x00000007
|
||||
#define SPI_SLV_LAST_COMMAND_S 17
|
||||
#define SPI_CS_I_MODE 0x00000003
|
||||
#define SPI_CS_I_MODE_S 10
|
||||
#define SPI_INT_EN 0x0000001F
|
||||
#define SPI_INT_EN_S 5
|
||||
#define SPI_TRANS_DONE (BIT(4))
|
||||
#define SPI_SLV_WR_STA_DONE (BIT(3))
|
||||
#define SPI_SLV_RD_STA_DONE (BIT(2))
|
||||
#define SPI_SLV_WR_BUF_DONE (BIT(1))
|
||||
#define SPI_SLV_RD_BUF_DONE (BIT(0))
|
||||
|
||||
#define SPI_FLASH_SLAVE1(i) (REG_SPI_BASE(i) + 0x34)
|
||||
#define SPI_SLV_STATUS_BITLEN 0x0000001F
|
||||
#define SPI_SLV_STATUS_BITLEN_S 27
|
||||
#define SPI_SLV_STATUS_FAST_EN (BIT(26))
|
||||
#define SPI_SLV_STATUS_READBACK (BIT(25))
|
||||
#define SPI_SLV_BUF_BITLEN 0x000001FF
|
||||
#define SPI_SLV_BUF_BITLEN_S 16
|
||||
#define SPI_SLV_RD_ADDR_BITLEN 0x0000003F
|
||||
#define SPI_SLV_RD_ADDR_BITLEN_S 10
|
||||
#define SPI_SLV_WR_ADDR_BITLEN 0x0000003F
|
||||
#define SPI_SLV_WR_ADDR_BITLEN_S 4
|
||||
#define SPI_SLV_WRSTA_DUMMY_EN (BIT(3))
|
||||
#define SPI_SLV_RDSTA_DUMMY_EN (BIT(2))
|
||||
#define SPI_SLV_WRBUF_DUMMY_EN (BIT(1))
|
||||
#define SPI_SLV_RDBUF_DUMMY_EN (BIT(0))
|
||||
|
||||
#define SPI_FLASH_SLAVE2(i) (REG_SPI_BASE(i) + 0x38)
|
||||
#define SPI_SLV_WRBUF_DUMMY_CYCLELEN 0x000000FF
|
||||
#define SPI_SLV_WRBUF_DUMMY_CYCLELEN_S 24
|
||||
#define SPI_SLV_RDBUF_DUMMY_CYCLELEN 0x000000FF
|
||||
#define SPI_SLV_RDBUF_DUMMY_CYCLELEN_S 16
|
||||
#define SPI_SLV_WRSTA_DUMMY_CYCLELEN 0x000000FF
|
||||
#define SPI_SLV_WRSTA_DUMMY_CYCLELEN_S 8
|
||||
#define SPI_SLV_RDSTA_DUMMY_CYCLELEN 0x000000FF
|
||||
#define SPI_SLV_RDSTA_DUMMY_CYCLELEN_S 0
|
||||
|
||||
#define SPI_FLASH_SLAVE3(i) (REG_SPI_BASE(i) + 0x3C)
|
||||
#define SPI_SLV_WRSTA_CMD_VALUE 0x000000FF
|
||||
#define SPI_SLV_WRSTA_CMD_VALUE_S 24
|
||||
#define SPI_SLV_RDSTA_CMD_VALUE 0x000000FF
|
||||
#define SPI_SLV_RDSTA_CMD_VALUE_S 16
|
||||
#define SPI_SLV_WRBUF_CMD_VALUE 0x000000FF
|
||||
#define SPI_SLV_WRBUF_CMD_VALUE_S 8
|
||||
#define SPI_SLV_RDBUF_CMD_VALUE 0x000000FF
|
||||
#define SPI_SLV_RDBUF_CMD_VALUE_S 0
|
||||
|
||||
#define SPI_FLASH_C0(i) (REG_SPI_BASE(i) +0x40)
|
||||
#define SPI_FLASH_C1(i) (REG_SPI_BASE(i) +0x44)
|
||||
#define SPI_FLASH_C2(i) (REG_SPI_BASE(i) +0x48)
|
||||
#define SPI_FLASH_C3(i) (REG_SPI_BASE(i) +0x4C)
|
||||
#define SPI_FLASH_C4(i) (REG_SPI_BASE(i) +0x50)
|
||||
#define SPI_FLASH_C5(i) (REG_SPI_BASE(i) +0x54)
|
||||
#define SPI_FLASH_C6(i) (REG_SPI_BASE(i) +0x58)
|
||||
#define SPI_FLASH_C7(i) (REG_SPI_BASE(i) +0x5C)
|
||||
|
||||
#define SPI_FLASH_EXT0(i) (REG_SPI_BASE(i) + 0xF0)
|
||||
#define SPI_T_PP_ENA (BIT(31))
|
||||
#define SPI_T_PP_SHIFT 0x0000000F
|
||||
#define SPI_T_PP_SHIFT_S 16
|
||||
#define SPI_T_PP_TIME 0x00000FFF
|
||||
#define SPI_T_PP_TIME_S 0
|
||||
|
||||
#define SPI_FLASH_EXT1(i) (REG_SPI_BASE(i) + 0xF4)
|
||||
#define SPI_T_ERASE_ENA (BIT(31))
|
||||
#define SPI_T_ERASE_SHIFT 0x0000000F
|
||||
#define SPI_T_ERASE_SHIFT_S 16
|
||||
#define SPI_T_ERASE_TIME 0x00000FFF
|
||||
#define SPI_T_ERASE_TIME_S 0
|
||||
|
||||
#define SPI_FLASH_EXT2(i) (REG_SPI_BASE(i) + 0xF8)
|
||||
#define SPI_ST 0x00000007
|
||||
#define SPI_ST_S 0
|
||||
|
||||
#define SPI_FLASH_EXT3(i) (REG_SPI_BASE(i) + 0xFC)
|
||||
#define SPI_INT_HOLD_ENA 0x00000003
|
||||
#define SPI_INT_HOLD_ENA_S 0
|
||||
#endif // SPI_REGISTER_H_INCLUDED
|
@ -1,332 +0,0 @@
|
||||
/***************************************************
|
||||
This is our GFX example for the Adafruit ILI9341 Breakout and Shield
|
||||
----> http://www.adafruit.com/products/1651
|
||||
|
||||
Check out the links above for our tutorials and wiring diagrams
|
||||
These displays use SPI to communicate, 4 or 5 pins are required to
|
||||
interface (RST is optional)
|
||||
Adafruit invests time and resources providing this open source code,
|
||||
please support Adafruit and open-source hardware by purchasing
|
||||
products from Adafruit!
|
||||
|
||||
Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||
MIT license, all text above must be included in any redistribution
|
||||
|
||||
Modified by Sermus for ESP8266
|
||||
****************************************************/
|
||||
|
||||
|
||||
#include "SPI.h"
|
||||
#include "Adafruit_GFX.h"
|
||||
#include "Adafruit_ILI9341.h"
|
||||
|
||||
Adafruit_ILI9341 tft = Adafruit_ILI9341();
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
Serial.println("ILI9341 Test!");
|
||||
|
||||
tft.begin();
|
||||
|
||||
Serial.println(F("Benchmark Time (microseconds)"));
|
||||
|
||||
Serial.print(F("Screen fill "));
|
||||
Serial.println(testFillScreen());
|
||||
delay(500);
|
||||
|
||||
Serial.print(F("Text "));
|
||||
Serial.println(testText());
|
||||
delay(3000);
|
||||
|
||||
Serial.print(F("Lines "));
|
||||
Serial.println(testLines(ILI9341_CYAN));
|
||||
delay(500);
|
||||
|
||||
Serial.print(F("Horiz/Vert Lines "));
|
||||
Serial.println(testFastLines(ILI9341_RED, ILI9341_BLUE));
|
||||
delay(500);
|
||||
|
||||
Serial.print(F("Rectangles (outline) "));
|
||||
Serial.println(testRects(ILI9341_GREEN));
|
||||
delay(500);
|
||||
|
||||
Serial.print(F("Rectangles (filled) "));
|
||||
Serial.println(testFilledRects(ILI9341_YELLOW, ILI9341_MAGENTA));
|
||||
delay(500);
|
||||
|
||||
Serial.print(F("Circles (filled) "));
|
||||
Serial.println(testFilledCircles(10, ILI9341_MAGENTA));
|
||||
|
||||
Serial.print(F("Circles (outline) "));
|
||||
Serial.println(testCircles(10, ILI9341_WHITE));
|
||||
delay(500);
|
||||
|
||||
Serial.print(F("Triangles (outline) "));
|
||||
Serial.println(testTriangles());
|
||||
delay(500);
|
||||
|
||||
Serial.print(F("Triangles (filled) "));
|
||||
Serial.println(testFilledTriangles());
|
||||
delay(500);
|
||||
|
||||
Serial.print(F("Rounded rects (outline) "));
|
||||
Serial.println(testRoundRects());
|
||||
delay(500);
|
||||
|
||||
Serial.print(F("Rounded rects (filled) "));
|
||||
Serial.println(testFilledRoundRects());
|
||||
delay(500);
|
||||
|
||||
Serial.println(F("Done!"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
void loop(void) {
|
||||
for(uint8_t rotation=0; rotation<4; rotation++) {
|
||||
tft.setRotation(rotation);
|
||||
testText();
|
||||
delay(1000);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned long testFillScreen() {
|
||||
unsigned long start = micros();
|
||||
tft.fillScreen(ILI9341_BLACK);
|
||||
tft.fillScreen(ILI9341_RED);
|
||||
tft.fillScreen(ILI9341_GREEN);
|
||||
tft.fillScreen(ILI9341_BLUE);
|
||||
tft.fillScreen(ILI9341_BLACK);
|
||||
return micros() - start;
|
||||
}
|
||||
|
||||
unsigned long testText() {
|
||||
tft.fillScreen(ILI9341_BLACK);
|
||||
unsigned long start = micros();
|
||||
tft.setCursor(0, 0);
|
||||
tft.setTextColor(ILI9341_WHITE); tft.setTextSize(1);
|
||||
tft.println("Hello World!");
|
||||
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2);
|
||||
tft.println(1234.56);
|
||||
tft.setTextColor(ILI9341_RED); tft.setTextSize(3);
|
||||
tft.println(0xDEADBEEF, HEX);
|
||||
tft.println();
|
||||
tft.setTextColor(ILI9341_GREEN);
|
||||
tft.setTextSize(5);
|
||||
tft.println("Groop");
|
||||
tft.setTextSize(2);
|
||||
tft.println("I implore thee,");
|
||||
tft.setTextSize(1);
|
||||
tft.println("my foonting turlingdromes.");
|
||||
tft.println("And hooptiously drangle me");
|
||||
tft.println("with crinkly bindlewurdles,");
|
||||
tft.println("Or I will rend thee");
|
||||
tft.println("in the gobberwarts");
|
||||
tft.println("with my blurglecruncheon,");
|
||||
tft.println("see if I don't!");
|
||||
return micros() - start;
|
||||
}
|
||||
|
||||
unsigned long testLines(uint16_t color) {
|
||||
unsigned long start, t;
|
||||
int x1, y1, x2, y2,
|
||||
w = tft.width(),
|
||||
h = tft.height();
|
||||
|
||||
tft.fillScreen(ILI9341_BLACK);
|
||||
|
||||
x1 = y1 = 0;
|
||||
y2 = h - 1;
|
||||
start = micros();
|
||||
for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
|
||||
x2 = w - 1;
|
||||
for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
|
||||
t = micros() - start; // fillScreen doesn't count against timing
|
||||
|
||||
tft.fillScreen(ILI9341_BLACK);
|
||||
|
||||
x1 = w - 1;
|
||||
y1 = 0;
|
||||
y2 = h - 1;
|
||||
start = micros();
|
||||
for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
|
||||
x2 = 0;
|
||||
for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
|
||||
t += micros() - start;
|
||||
|
||||
tft.fillScreen(ILI9341_BLACK);
|
||||
|
||||
x1 = 0;
|
||||
y1 = h - 1;
|
||||
y2 = 0;
|
||||
start = micros();
|
||||
for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
|
||||
x2 = w - 1;
|
||||
for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
|
||||
t += micros() - start;
|
||||
|
||||
tft.fillScreen(ILI9341_BLACK);
|
||||
|
||||
x1 = w - 1;
|
||||
y1 = h - 1;
|
||||
y2 = 0;
|
||||
start = micros();
|
||||
for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
|
||||
x2 = 0;
|
||||
for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
|
||||
|
||||
return micros() - start;
|
||||
}
|
||||
|
||||
unsigned long testFastLines(uint16_t color1, uint16_t color2) {
|
||||
unsigned long start;
|
||||
int x, y, w = tft.width(), h = tft.height();
|
||||
|
||||
tft.fillScreen(ILI9341_BLACK);
|
||||
start = micros();
|
||||
for(y=0; y<h; y+=5) tft.drawFastHLine(0, y, w, color1);
|
||||
for(x=0; x<w; x+=5) tft.drawFastVLine(x, 0, h, color2);
|
||||
|
||||
return micros() - start;
|
||||
}
|
||||
|
||||
unsigned long testRects(uint16_t color) {
|
||||
unsigned long start;
|
||||
int n, i, i2,
|
||||
cx = tft.width() / 2,
|
||||
cy = tft.height() / 2;
|
||||
|
||||
tft.fillScreen(ILI9341_BLACK);
|
||||
n = min(tft.width(), tft.height());
|
||||
start = micros();
|
||||
for(i=2; i<n; i+=6) {
|
||||
i2 = i / 2;
|
||||
tft.drawRect(cx-i2, cy-i2, i, i, color);
|
||||
}
|
||||
|
||||
return micros() - start;
|
||||
}
|
||||
|
||||
unsigned long testFilledRects(uint16_t color1, uint16_t color2) {
|
||||
unsigned long start, t = 0;
|
||||
int n, i, i2,
|
||||
cx = tft.width() / 2 - 1,
|
||||
cy = tft.height() / 2 - 1;
|
||||
|
||||
tft.fillScreen(ILI9341_BLACK);
|
||||
n = min(tft.width(), tft.height());
|
||||
for(i=n; i>0; i-=6) {
|
||||
i2 = i / 2;
|
||||
start = micros();
|
||||
tft.fillRect(cx-i2, cy-i2, i, i, color1);
|
||||
t += micros() - start;
|
||||
// Outlines are not included in timing results
|
||||
tft.drawRect(cx-i2, cy-i2, i, i, color2);
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
unsigned long testFilledCircles(uint8_t radius, uint16_t color) {
|
||||
unsigned long start;
|
||||
int x, y, w = tft.width(), h = tft.height(), r2 = radius * 2;
|
||||
|
||||
tft.fillScreen(ILI9341_BLACK);
|
||||
start = micros();
|
||||
for(x=radius; x<w; x+=r2) {
|
||||
for(y=radius; y<h; y+=r2) {
|
||||
tft.fillCircle(x, y, radius, color);
|
||||
}
|
||||
}
|
||||
|
||||
return micros() - start;
|
||||
}
|
||||
|
||||
unsigned long testCircles(uint8_t radius, uint16_t color) {
|
||||
unsigned long start;
|
||||
int x, y, r2 = radius * 2,
|
||||
w = tft.width() + radius,
|
||||
h = tft.height() + radius;
|
||||
|
||||
// Screen is not cleared for this one -- this is
|
||||
// intentional and does not affect the reported time.
|
||||
start = micros();
|
||||
for(x=0; x<w; x+=r2) {
|
||||
for(y=0; y<h; y+=r2) {
|
||||
tft.drawCircle(x, y, radius, color);
|
||||
}
|
||||
}
|
||||
|
||||
return micros() - start;
|
||||
}
|
||||
|
||||
unsigned long testTriangles() {
|
||||
unsigned long start;
|
||||
int n, i, cx = tft.width() / 2 - 1,
|
||||
cy = tft.height() / 2 - 1;
|
||||
|
||||
tft.fillScreen(ILI9341_BLACK);
|
||||
n = min(cx, cy);
|
||||
start = micros();
|
||||
for(i=0; i<n; i+=5) {
|
||||
tft.drawTriangle(
|
||||
cx , cy - i, // peak
|
||||
cx - i, cy + i, // bottom left
|
||||
cx + i, cy + i, // bottom right
|
||||
tft.color565(0, 0, i));
|
||||
}
|
||||
|
||||
return micros() - start;
|
||||
}
|
||||
|
||||
unsigned long testFilledTriangles() {
|
||||
unsigned long start, t = 0;
|
||||
int i, cx = tft.width() / 2 - 1,
|
||||
cy = tft.height() / 2 - 1;
|
||||
|
||||
tft.fillScreen(ILI9341_BLACK);
|
||||
start = micros();
|
||||
for(i=min(cx,cy); i>10; i-=5) {
|
||||
start = micros();
|
||||
tft.fillTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
|
||||
tft.color565(0, i, i));
|
||||
t += micros() - start;
|
||||
tft.drawTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
|
||||
tft.color565(i, i, 0));
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
unsigned long testRoundRects() {
|
||||
unsigned long start;
|
||||
int w, i, i2,
|
||||
cx = tft.width() / 2 - 1,
|
||||
cy = tft.height() / 2 - 1;
|
||||
|
||||
tft.fillScreen(ILI9341_BLACK);
|
||||
w = min(tft.width(), tft.height());
|
||||
start = micros();
|
||||
for(i=0; i<w; i+=6) {
|
||||
i2 = i / 2;
|
||||
tft.drawRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(i, 0, 0));
|
||||
}
|
||||
|
||||
return micros() - start;
|
||||
}
|
||||
|
||||
unsigned long testFilledRoundRects() {
|
||||
unsigned long start;
|
||||
int i, i2,
|
||||
cx = tft.width() / 2 - 1,
|
||||
cy = tft.height() / 2 - 1;
|
||||
|
||||
tft.fillScreen(ILI9341_BLACK);
|
||||
start = micros();
|
||||
for(i=min(tft.width(), tft.height()); i>20; i-=6) {
|
||||
i2 = i / 2;
|
||||
tft.fillRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(0, i, 0));
|
||||
}
|
||||
|
||||
return micros() - start;
|
||||
}
|
@ -1,109 +0,0 @@
|
||||
#include "driver/hspi.h"
|
||||
|
||||
/*
|
||||
Pinout:
|
||||
MISO GPIO12
|
||||
MOSI GPIO13
|
||||
CLK GPIO14
|
||||
CS GPIO15
|
||||
DC GPIO2
|
||||
*/
|
||||
|
||||
#define __min(a,b) ((a > b) ? (b):(a))
|
||||
uint32_t *spi_fifo;
|
||||
uint32_t current_spi_port;
|
||||
|
||||
spi_config spi_init(uint32_t spi_port, uint32_t prescaler, spi_mode mode)
|
||||
{
|
||||
spi_config config;
|
||||
|
||||
WRITE_PERI_REG(PERIPHS_IO_MUX, 0x105); //clear bit9
|
||||
|
||||
if (spi_port == SPI)
|
||||
{
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA0_U, 2); // SD_D0 MISO
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA1_U, 2); // SD_D1 MOSI
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, 2); // CLK
|
||||
} else if (spi_port == HSPI)
|
||||
{
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U, 2); // HSPIQ MISO GPIO12
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, 2); // HSPID MOSI GPIO13
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTMS_U, 2); // CLK GPIO14
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, 2); // CS GPIO15
|
||||
}
|
||||
|
||||
|
||||
config.mode = mode;
|
||||
config.spi_port = spi_port;
|
||||
// SPI clock = CPU clock / 10 / 4
|
||||
// time length HIGHT level = (CPU clock / 10 / 2) ^ -1,
|
||||
// time length LOW level = (CPU clock / 10 / 2) ^ -1
|
||||
config.clock_reg_val = (((prescaler - 1) & SPI_CLKDIV_PRE) << SPI_CLKDIV_PRE_S) |
|
||||
((1 & SPI_CLKCNT_N) << SPI_CLKCNT_N_S) |
|
||||
((0 & SPI_CLKCNT_H) << SPI_CLKCNT_H_S) |
|
||||
((1 & SPI_CLKCNT_L) << SPI_CLKCNT_L_S);
|
||||
|
||||
spi_reinit(&config);
|
||||
return config;
|
||||
}
|
||||
|
||||
void spi_reinit(spi_config *config)
|
||||
{
|
||||
current_spi_port = config->spi_port;
|
||||
spi_fifo = (uint32_t*)SPI_FLASH_C0(current_spi_port);
|
||||
|
||||
uint32_t regvalue = SPI_FLASH_DOUT;
|
||||
WRITE_PERI_REG(SPI_FLASH_CLOCK(current_spi_port), config->clock_reg_val);
|
||||
WRITE_PERI_REG(SPI_FLASH_CTRL1(current_spi_port), 0);
|
||||
|
||||
switch(config->mode)
|
||||
{
|
||||
case spi_mode_tx:
|
||||
regvalue &= ~(BIT2 | SPI_FLASH_USR_ADDR | SPI_FLASH_USR_DUMMY | SPI_FLASH_USR_DIN | SPI_USR_COMMAND | SPI_DOUTDIN);
|
||||
break;
|
||||
case spi_mode_txrx:
|
||||
regvalue |= SPI_DOUTDIN | SPI_CK_I_EDGE;
|
||||
regvalue &= ~(BIT2 | SPI_FLASH_USR_ADDR | SPI_FLASH_USR_DUMMY | SPI_FLASH_USR_DIN | SPI_USR_COMMAND);
|
||||
break;
|
||||
}
|
||||
|
||||
WRITE_PERI_REG(SPI_FLASH_USER(current_spi_port), regvalue);
|
||||
}
|
||||
|
||||
void spi_send_uint16_r(uint16_t data, int32_t repeats)
|
||||
{
|
||||
uint32_t i;
|
||||
uint32_t word = data << 16 | data;
|
||||
|
||||
while(repeats > 0)
|
||||
{
|
||||
uint16_t bytes_to_transfer = __min(repeats * sizeof(uint16_t) , SPIFIFOSIZE * sizeof(uint32_t));
|
||||
spi_wait_ready();
|
||||
spi_prepare_tx(bytes_to_transfer);
|
||||
for(i = 0; i < (bytes_to_transfer + 3) / 4;i++)
|
||||
spi_fifo[i] = word;
|
||||
spi_start_tx();
|
||||
repeats -= bytes_to_transfer / 2;
|
||||
}
|
||||
}
|
||||
|
||||
void spi_send_data(const uint8_t * data, uint8_t datasize)
|
||||
{
|
||||
uint32_t *_data = (uint32_t*)data;
|
||||
uint8_t i;
|
||||
|
||||
uint8_t words_to_send = __min((datasize + 3) / 4, SPIFIFOSIZE);
|
||||
spi_prepare_tx(datasize);
|
||||
for(i = 0; i < words_to_send;i++)
|
||||
spi_fifo[i] = _data[i];
|
||||
spi_start_tx();
|
||||
}
|
||||
|
||||
uint16_t spi_send_uint8_receive_13bits(uint8_t to_send)
|
||||
{
|
||||
spi_prepare_txrx_bits(8, 13);
|
||||
*spi_fifo = to_send;
|
||||
spi_start_tx();
|
||||
spi_wait_ready();
|
||||
return (*spi_fifo) & 0x1FFF;
|
||||
}
|
@ -1,199 +0,0 @@
|
||||
/*
|
||||
* The Minimal snprintf() implementation
|
||||
*
|
||||
* Copyright (c) 2013,2014 Michal Ludvig <michal@logix.cz>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the auhor nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* This is a minimal snprintf() implementation optimised
|
||||
* for embedded systems with a very limited program memory.
|
||||
* mini_snprintf() doesn't support _all_ the formatting
|
||||
* the glibc does but on the other hand is a lot smaller.
|
||||
* Here are some numbers from my STM32 project (.bin file size):
|
||||
* no snprintf(): 10768 bytes
|
||||
* mini snprintf(): 11420 bytes (+ 652 bytes)
|
||||
* glibc snprintf(): 34860 bytes (+24092 bytes)
|
||||
* Wasting nearly 24kB of memory just for snprintf() on
|
||||
* a chip with 32kB flash is crazy. Use mini_snprintf() instead.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include "mini-printf.h"
|
||||
|
||||
static unsigned int
|
||||
mini_strlen(const char *s)
|
||||
{
|
||||
unsigned int len = 0;
|
||||
while (s[len] != '\0') len++;
|
||||
return len;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
mini_itoa(int value, unsigned int radix, unsigned int uppercase,
|
||||
char *buffer, unsigned int zero_pad)
|
||||
{
|
||||
char *pbuffer = buffer;
|
||||
int negative = 0;
|
||||
unsigned int i, len;
|
||||
|
||||
/* No support for unusual radixes. */
|
||||
if (radix > 16)
|
||||
return 0;
|
||||
|
||||
if (value < 0) {
|
||||
negative = 1;
|
||||
value = -value;
|
||||
}
|
||||
|
||||
/* This builds the string back to front ... */
|
||||
do {
|
||||
int digit = value % radix;
|
||||
*(pbuffer++) = (digit < 10 ? '0' + digit : (uppercase ? 'A' : 'a') + digit - 10);
|
||||
value /= radix;
|
||||
} while (value > 0);
|
||||
|
||||
for (i = (pbuffer - buffer); i < zero_pad; i++)
|
||||
*(pbuffer++) = '0';
|
||||
|
||||
if (negative)
|
||||
*(pbuffer++) = '-';
|
||||
|
||||
*(pbuffer) = '\0';
|
||||
|
||||
/* ... now we reverse it (could do it recursively but will
|
||||
* conserve the stack space) */
|
||||
len = (pbuffer - buffer);
|
||||
for (i = 0; i < len / 2; i++) {
|
||||
char j = buffer[i];
|
||||
buffer[i] = buffer[len-i-1];
|
||||
buffer[len-i-1] = j;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
int
|
||||
mini_vsnprintf(char *buffer, unsigned int buffer_len, const char *fmt, va_list va)
|
||||
{
|
||||
char *pbuffer = buffer;
|
||||
char bf[24];
|
||||
char ch;
|
||||
|
||||
int _putc(char ch)
|
||||
{
|
||||
if ((unsigned int)((pbuffer - buffer) + 1) >= buffer_len)
|
||||
return 0;
|
||||
*(pbuffer++) = ch;
|
||||
*(pbuffer) = '\0';
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _puts(char *s, unsigned int len)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (buffer_len - (pbuffer - buffer) - 1 < len)
|
||||
len = buffer_len - (pbuffer - buffer) - 1;
|
||||
|
||||
/* Copy to buffer */
|
||||
for (i = 0; i < len; i++)
|
||||
*(pbuffer++) = s[i];
|
||||
*(pbuffer) = '\0';
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
while ((ch=*(fmt++))) {
|
||||
if ((unsigned int)((pbuffer - buffer) + 1) >= buffer_len)
|
||||
break;
|
||||
if (ch!='%')
|
||||
_putc(ch);
|
||||
else {
|
||||
char zero_pad = 0;
|
||||
char *ptr;
|
||||
unsigned int len;
|
||||
|
||||
ch=*(fmt++);
|
||||
|
||||
/* Zero padding requested */
|
||||
if (ch=='0') {
|
||||
ch=*(fmt++);
|
||||
if (ch == '\0')
|
||||
goto end;
|
||||
if (ch >= '0' && ch <= '9')
|
||||
zero_pad = ch - '0';
|
||||
ch=*(fmt++);
|
||||
}
|
||||
|
||||
switch (ch) {
|
||||
case 0:
|
||||
goto end;
|
||||
|
||||
case 'u':
|
||||
case 'd':
|
||||
len = mini_itoa(va_arg(va, unsigned int), 10, 0, bf, zero_pad);
|
||||
_puts(bf, len);
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
case 'X':
|
||||
len = mini_itoa(va_arg(va, unsigned int), 16, (ch=='X'), bf, zero_pad);
|
||||
_puts(bf, len);
|
||||
break;
|
||||
|
||||
case 'c' :
|
||||
_putc((char)(va_arg(va, int)));
|
||||
break;
|
||||
|
||||
case 's' :
|
||||
ptr = va_arg(va, char*);
|
||||
_puts(ptr, mini_strlen(ptr));
|
||||
break;
|
||||
|
||||
default:
|
||||
_putc(ch);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
end:
|
||||
return pbuffer - buffer;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mini_snprintf(char* buffer, unsigned int buffer_len, const char *fmt, ...)
|
||||
{
|
||||
int ret;
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
ret = mini_vsnprintf(buffer, buffer_len, fmt, va);
|
||||
va_end(va);
|
||||
|
||||
return ret;
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* The Minimal snprintf() implementation
|
||||
*
|
||||
* Copyright (c) 2013 Michal Ludvig <michal@logix.cz>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the auhor nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __MINI_PRINTF__
|
||||
#define __MINI_PRINTF__
|
||||
#include <stdarg.h>
|
||||
|
||||
int mini_vsnprintf(char* buffer, unsigned int buffer_len, const char *fmt, va_list va);
|
||||
int mini_snprintf(char* buffer, unsigned int buffer_len, const char *fmt, ...);
|
||||
|
||||
#define vsnprintf mini_vsnprintf
|
||||
#define snprintf mini_snprintf
|
||||
|
||||
#endif
|
@ -1,12 +0,0 @@
|
||||
Port of Adafruit's library for ILI9341 to ESP8266
|
||||
Uses HSPI.
|
||||
Wiring:
|
||||
ILI9341 pin ESP8266 pin
|
||||
MISO GPIO12
|
||||
MOSI GPIO13
|
||||
SCK GPIO14
|
||||
CS GPIO15
|
||||
DC GPIO2
|
||||
|
||||
Reset 3V3
|
||||
LED through 50-60 Ohm resistor to 3V3
|
@ -23,8 +23,10 @@
|
||||
File extensions with more than 3 charecters are not supported by the SD Library
|
||||
File Names longer than 8 charecters will be truncated by the SD library, so keep filenames shorter
|
||||
index.htm is the default index (works on subfolders as well)
|
||||
*/
|
||||
|
||||
upload the contents of SdRoot to the root of the SDcard and access the editor by going to http://esp8266sd.local/edit
|
||||
|
||||
*/
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <WiFiClient.h>
|
||||
#include <ESP8266WebServer.h>
|
||||
@ -32,8 +34,8 @@
|
||||
#include <SPI.h>
|
||||
#include <SD.h>
|
||||
|
||||
//do not go larger than 1460 bytes as that is the maximum that could fit in a packet
|
||||
#define WWW_BUF_SIZE 1460
|
||||
#define DBG_OUTPUT_PORT Serial
|
||||
|
||||
const char* ssid = "**********";
|
||||
const char* password = "**********";
|
||||
@ -43,13 +45,38 @@ MDNSResponder mdns;
|
||||
ESP8266WebServer server(80);
|
||||
|
||||
static bool hasSD = false;
|
||||
File uploadFile;
|
||||
|
||||
void returnOK(){
|
||||
WiFiClient client = server.client();
|
||||
String message = "HTTP/1.1 200 OK\r\n";
|
||||
message += "Content-Type: text/plain\r\n";
|
||||
message += "Connection: close\r\n";
|
||||
message += "Access-Control-Allow-Origin: *\r\n";
|
||||
message += "\r\n";
|
||||
client.print(message);
|
||||
message = 0;
|
||||
client.stop();
|
||||
}
|
||||
|
||||
void returnFail(String msg){
|
||||
WiFiClient client = server.client();
|
||||
String message = "HTTP/1.1 500 Fail\r\n";
|
||||
message += "Content-Type: text/plain\r\n";
|
||||
message += "Connection: close\r\n";
|
||||
message += "Access-Control-Allow-Origin: *\r\n";
|
||||
message += "\r\n";
|
||||
message += msg;
|
||||
message += "\r\n";
|
||||
client.print(message);
|
||||
message = 0;
|
||||
client.stop();
|
||||
}
|
||||
|
||||
bool loadFromSdCard(String path){
|
||||
String dataType = "text/plain";
|
||||
//handle default index
|
||||
if(path.endsWith("/")) path += "index.htm";
|
||||
|
||||
//set proper Content-Type for the most common extensions
|
||||
if(path.endsWith(".src")) path = path.substring(0, path.lastIndexOf("."));
|
||||
else if(path.endsWith(".htm")) dataType = "text/html";
|
||||
else if(path.endsWith(".css")) dataType = "text/css";
|
||||
@ -62,95 +89,220 @@ bool loadFromSdCard(String path){
|
||||
else if(path.endsWith(".pdf")) dataType = "application/pdf";
|
||||
else if(path.endsWith(".zip")) dataType = "application/zip";
|
||||
|
||||
//Try to open the file
|
||||
File dataFile = SD.open(path.c_str());
|
||||
|
||||
//if it's a folder, try to open the default index
|
||||
if(dataFile && dataFile.isDirectory()){
|
||||
if(dataFile.isDirectory()){
|
||||
path += "/index.htm";
|
||||
dataType = "text/html";
|
||||
dataFile = SD.open(path.c_str());
|
||||
}
|
||||
|
||||
//and finally if the file exists, stream the content to the client
|
||||
if(server.hasArg("download")) dataType = "application/octet-stream";
|
||||
|
||||
if (dataFile) {
|
||||
WiFiClient client = server.client();
|
||||
//send the file headers
|
||||
String head = "HTTP/1.1 200 OK\r\nContent-Type: ";
|
||||
head += dataType;
|
||||
head += "\r\nContent-Length: ";
|
||||
head += dataFile.size();
|
||||
head += "\r\nConnection: close";
|
||||
head += "\r\nAccess-Control-Allow-Origin: *";
|
||||
head += "\r\n\r\n";
|
||||
client.print(head);
|
||||
dataType = 0;
|
||||
path = 0;
|
||||
|
||||
//partition the data packets to fit in a TCP packet (1460 bytes MAX)
|
||||
uint8_t obuf[WWW_BUF_SIZE];
|
||||
|
||||
while (dataFile.available() > WWW_BUF_SIZE){
|
||||
dataFile.read(obuf, WWW_BUF_SIZE);
|
||||
client.write(obuf, WWW_BUF_SIZE);
|
||||
if(client.write(obuf, WWW_BUF_SIZE) != WWW_BUF_SIZE){
|
||||
DBG_OUTPUT_PORT.println("Sent less data than expected!");
|
||||
dataFile.close();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//stream the last data left (size is at most WWW_BUF_SIZE bytes)
|
||||
uint16_t leftLen = dataFile.available();
|
||||
dataFile.read(obuf, leftLen);
|
||||
client.write(obuf, leftLen);
|
||||
|
||||
if(client.write(obuf, leftLen) != leftLen){
|
||||
DBG_OUTPUT_PORT.println("Sent less data than expected!");
|
||||
dataFile.close();
|
||||
return true;
|
||||
}
|
||||
dataFile.close();
|
||||
client.stop();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void tryLoadFromSdCard(){
|
||||
String message = "FileNotFound\n\n";
|
||||
if(hasSD){
|
||||
//try to load the URL from SD Card
|
||||
if(loadFromSdCard(server.uri())) return;
|
||||
void handleFileUpload(){
|
||||
if(server.uri() != "/edit") return;
|
||||
HTTPUpload upload = server.upload();
|
||||
if(upload.status == UPLOAD_FILE_START){
|
||||
if(SD.exists((char *)upload.filename.c_str())) SD.remove((char *)upload.filename.c_str());
|
||||
uploadFile = SD.open(upload.filename.c_str(), FILE_WRITE);
|
||||
DBG_OUTPUT_PORT.print("Upload: START, filename: "); DBG_OUTPUT_PORT.println(upload.filename);
|
||||
} else if(upload.status == UPLOAD_FILE_WRITE){
|
||||
if(uploadFile) uploadFile.write(upload.buf, upload.buflen);
|
||||
DBG_OUTPUT_PORT.print("Upload: WRITE, Bytes: "); DBG_OUTPUT_PORT.println(upload.buflen);
|
||||
} else if(upload.status == UPLOAD_FILE_END){
|
||||
if(uploadFile) uploadFile.close();
|
||||
DBG_OUTPUT_PORT.print("Upload: END, Size: "); DBG_OUTPUT_PORT.println(upload.size);
|
||||
}
|
||||
}
|
||||
|
||||
void deleteRecursive(String path){
|
||||
File file = SD.open((char *)path.c_str());
|
||||
if(!file.isDirectory()){
|
||||
file.close();
|
||||
SD.remove((char *)path.c_str());
|
||||
return;
|
||||
}
|
||||
file.rewindDirectory();
|
||||
File entry;
|
||||
String entryPath;
|
||||
while(true) {
|
||||
entry = file.openNextFile();
|
||||
if (!entry) break;
|
||||
entryPath = path + "/" +entry.name();
|
||||
if(entry.isDirectory()){
|
||||
entry.close();
|
||||
deleteRecursive(entryPath);
|
||||
} else {
|
||||
message = "SDCARD Not Detected\n\n";
|
||||
entry.close();
|
||||
SD.remove((char *)entryPath.c_str());
|
||||
}
|
||||
entryPath = 0;
|
||||
yield();
|
||||
}
|
||||
SD.rmdir((char *)path.c_str());
|
||||
path = 0;
|
||||
file.close();
|
||||
}
|
||||
|
||||
void handleDelete(){
|
||||
if(server.args() == 0) return returnFail("BAD ARGS");
|
||||
String path = server.arg(0);
|
||||
if(path == "/" || !SD.exists((char *)path.c_str())) return returnFail("BAD PATH");
|
||||
deleteRecursive(path);
|
||||
returnOK();
|
||||
path = 0;
|
||||
}
|
||||
|
||||
void handleCreate(){
|
||||
if(server.args() == 0) return returnFail("BAD ARGS");
|
||||
String path = server.arg(0);
|
||||
if(path == "/" || SD.exists((char *)path.c_str())) return returnFail("BAD PATH");
|
||||
if(path.indexOf('.') > 0){
|
||||
File file = SD.open((char *)path.c_str(), FILE_WRITE);
|
||||
if(file){
|
||||
file.write((const char *)0);
|
||||
file.close();
|
||||
}
|
||||
} else {
|
||||
SD.mkdir((char *)path.c_str());
|
||||
}
|
||||
returnOK();
|
||||
path = 0;
|
||||
}
|
||||
|
||||
void printDirectory() {
|
||||
if(!server.hasArg("dir")) return returnFail("BAD ARGS");
|
||||
String path = server.arg("dir");
|
||||
if(path != "/" && !SD.exists((char *)path.c_str())) return returnFail("BAD PATH");
|
||||
File dir = SD.open((char *)path.c_str());
|
||||
path = 0;
|
||||
if(!dir.isDirectory()){
|
||||
dir.close();
|
||||
return returnFail("NOT DIR");
|
||||
}
|
||||
dir.rewindDirectory();
|
||||
|
||||
File entry;
|
||||
WiFiClient client = server.client();
|
||||
client.print("HTTP/1.1 200 OK\r\nContent-Type: text/json\r\n\r\n");
|
||||
String output = "[";
|
||||
while(true) {
|
||||
entry = dir.openNextFile();
|
||||
if (!entry) break;
|
||||
if(output != "[") output += ',';
|
||||
output += "{\"type\":\"";
|
||||
output += (entry.isDirectory())?"dir":"file";
|
||||
output += "\",\"name\":\"";
|
||||
output += entry.name();
|
||||
output += "\"";
|
||||
output += "}";
|
||||
entry.close();
|
||||
if(output.length() > 1460){
|
||||
client.write(output.substring(0, 1460).c_str(), 1460);
|
||||
output = output.substring(1460);
|
||||
}
|
||||
}
|
||||
dir.close();
|
||||
output += "]";
|
||||
client.write(output.c_str(), output.length());
|
||||
client.stop();
|
||||
output = 0;
|
||||
}
|
||||
|
||||
void handleNotFound(){
|
||||
if(hasSD && loadFromSdCard(server.uri())) return;
|
||||
String message = "SDCARD Not Detected\n\n";
|
||||
message += "URI: ";
|
||||
message += server.uri();
|
||||
message += "\nMethod: ";
|
||||
message += (server.method() == HTTP_GET)?"GET":"POST";
|
||||
message += "\nArguments: ";
|
||||
message += server.args();
|
||||
message += "\n";
|
||||
for (uint8_t i=0; i<server.args(); i++){
|
||||
message += " NAME:"+server.argName(i) + "\n VALUE:" + server.arg(i) + "\n";
|
||||
}
|
||||
server.send(404, "text/plain", message);
|
||||
DBG_OUTPUT_PORT.print(message);
|
||||
}
|
||||
|
||||
void setup(void){
|
||||
uint8_t i = 0;
|
||||
Serial.begin(115200);
|
||||
|
||||
//setup WiFi
|
||||
DBG_OUTPUT_PORT.begin(115200);
|
||||
DBG_OUTPUT_PORT.setDebugOutput(true);
|
||||
DBG_OUTPUT_PORT.print("\n");
|
||||
WiFi.begin(ssid, password);
|
||||
Serial.print("\nConnecting to ");
|
||||
Serial.println(ssid);
|
||||
DBG_OUTPUT_PORT.print("Connecting to ");
|
||||
DBG_OUTPUT_PORT.println(ssid);
|
||||
|
||||
//wait for WiFi to connect
|
||||
while (WiFi.status() != WL_CONNECTED && i++ < 20) delay(500);
|
||||
|
||||
//check if we have connected?
|
||||
if(i == 20){
|
||||
Serial.print("Could not connect to");
|
||||
Serial.println(ssid);
|
||||
//stop execution and wait forever
|
||||
// Wait for connection
|
||||
uint8_t i = 0;
|
||||
while (WiFi.status() != WL_CONNECTED && i++ < 20) {//wait 10 seconds
|
||||
delay(500);
|
||||
}
|
||||
if(i == 21){
|
||||
DBG_OUTPUT_PORT.print("Could not connect to");
|
||||
DBG_OUTPUT_PORT.println(ssid);
|
||||
while(1) delay(500);
|
||||
}
|
||||
Serial.print("Connected! IP address: ");
|
||||
Serial.println(WiFi.localIP());
|
||||
|
||||
//start mDNS Server
|
||||
DBG_OUTPUT_PORT.print("Connected! IP address: ");
|
||||
DBG_OUTPUT_PORT.println(WiFi.localIP());
|
||||
/*
|
||||
if (mdns.begin(hostname, WiFi.localIP())) {
|
||||
Serial.println("MDNS responder started");
|
||||
Serial.print("You can now connect to http://");
|
||||
Serial.print(hostname);
|
||||
Serial.println(".local");
|
||||
DBG_OUTPUT_PORT.println("MDNS responder started");
|
||||
DBG_OUTPUT_PORT.print("You can now connect to http://");
|
||||
DBG_OUTPUT_PORT.print(hostname);
|
||||
DBG_OUTPUT_PORT.println(".local");
|
||||
}
|
||||
*/
|
||||
|
||||
//Attach handler
|
||||
server.onNotFound(tryLoadFromSdCard);
|
||||
server.on("/list", HTTP_GET, printDirectory);
|
||||
server.on("/edit", HTTP_DELETE, handleDelete);
|
||||
server.on("/edit", HTTP_PUT, handleCreate);
|
||||
server.on("/edit", HTTP_POST, [](){ returnOK(); });
|
||||
server.onNotFound(handleNotFound);
|
||||
server.onFileUpload(handleFileUpload);
|
||||
|
||||
//start server
|
||||
server.begin();
|
||||
Serial.println("HTTP server started");
|
||||
DBG_OUTPUT_PORT.println("HTTP server started");
|
||||
|
||||
//init SD Card
|
||||
if (SD.begin(SS)){
|
||||
Serial.println("SD Card initialized.");
|
||||
DBG_OUTPUT_PORT.println("SD Card initialized.");
|
||||
hasSD = true;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,670 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>SD Editor</title>
|
||||
<style type="text/css" media="screen">
|
||||
.contextMenu {
|
||||
z-index: 300;
|
||||
position: absolute;
|
||||
left: 5px;
|
||||
border: 1px solid #444;
|
||||
background-color: #F5F5F5;
|
||||
display: none;
|
||||
box-shadow: 0 0 10px rgba( 0, 0, 0, .4 );
|
||||
font-size: 12px;
|
||||
font-family: sans-serif;
|
||||
font-weight:bold;
|
||||
}
|
||||
.contextMenu ul {
|
||||
list-style: none;
|
||||
top: 0;
|
||||
left: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.contextMenu li {
|
||||
position: relative;
|
||||
min-width: 60px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.contextMenu span {
|
||||
color: #444;
|
||||
display: inline-block;
|
||||
padding: 6px;
|
||||
}
|
||||
.contextMenu li:hover { background: #444; }
|
||||
.contextMenu li:hover span { color: #EEE; }
|
||||
|
||||
.css-treeview ul, .css-treeview li {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.css-treeview input {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.css-treeview {
|
||||
font: normal 11px Verdana, Arial, Sans-serif;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.css-treeview span {
|
||||
color: #00f;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.css-treeview span:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.css-treeview input + label + ul {
|
||||
margin: 0 0 0 22px;
|
||||
}
|
||||
|
||||
.css-treeview input ~ ul {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.css-treeview label, .css-treeview label::before {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.css-treeview input:disabled + label {
|
||||
cursor: default;
|
||||
opacity: .6;
|
||||
}
|
||||
|
||||
.css-treeview input:checked:not(:disabled) ~ ul {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.css-treeview label, .css-treeview label::before {
|
||||
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAACgCAYAAAAFOewUAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAApxJREFUeNrslM1u00AQgGdthyalFFOK+ClIIKQKyqUVQvTEE3DmAhLwAhU8QZoH4A2Q2gMSFace4MCtJ8SPBFwAkRuiHKpA6sRN/Lu7zG5i14kctaUqRGhGXnu9O/Pt7MzsMiklvF+9t2kWTDvyIrAsA0aKRRi1T0C/hJ4LUbt5/8rNpWVlp8RSr9J40b48fxFaTQ9+ft8EZ6MJYb0Ok+dnYGpmPgXwKIAvLx8vYXc5GdMAQJgQEkpjRTh36TS2U+DWW/D17WuYgm8pwJyY1npZsZKOxImOV1I/h4+O6vEg5GCZBpgmA6hX8wHKUHDRBXQYicQ4rlc3Tf0VMs8DHBS864F2YFspjgUYjKX/Az3gsdQd2eeBHwmdGWXHcgBGSkZXOXohcEXebRoQcAgjqediNY+AVyu3Z3sAKqfKoGMsewBeEIOPgQxxPJIjcGH6qtL/0AdADzKGnuuD+2tLK7Q8DhHHbOBW+KEzcHLuYc82MkEUekLiwuvVH+guQBQzOG4XdAb8EOcRcqQvDkY2iCLuxECJ43JobMXoutqGgDa2T7UqLKwt9KRyuxKVByqVXXqIoCCUCAqhUOioTWC7G4TQEOD0APy2/7G2Xpu1J4+lxeQ4TXBbITDpoVelRN/BVFbwu5oMMJUBhoXy5tmdRcMwymP2OLQaLjx9/vnBo6V3K6izATmSnMa0Dq7ferIohJhr1p01zrlz49rZF4OMs8JkX23vVQzYp+wbYGV/KpXKjvspl8tsIKCrMNAYFxj2GKS5ZWxg4ewKsJfaGMIY5KXqPz8LBBj6+yDvVP79+yDp/9F9oIx3OisHWwe7Oal0HxCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgwD8E/BZgAP0qhKj3rXO7AAAAAElFTkSuQmCC") no-repeat;
|
||||
}
|
||||
|
||||
.css-treeview label, .css-treeview span, .css-treeview label::before {
|
||||
display: inline-block;
|
||||
height: 16px;
|
||||
line-height: 16px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.css-treeview label {
|
||||
background-position: 18px 0;
|
||||
}
|
||||
|
||||
.css-treeview label::before {
|
||||
content: "";
|
||||
width: 16px;
|
||||
margin: 0 22px 0 0;
|
||||
vertical-align: middle;
|
||||
background-position: 0 -32px;
|
||||
}
|
||||
|
||||
.css-treeview input:checked + label::before {
|
||||
background-position: 0 -16px;
|
||||
}
|
||||
|
||||
/* webkit adjacent element selector bugfix */
|
||||
@media screen and (-webkit-min-device-pixel-ratio:0)
|
||||
{
|
||||
.css-treeview{
|
||||
-webkit-animation: webkit-adjacent-element-selector-bugfix infinite 1s;
|
||||
}
|
||||
|
||||
@-webkit-keyframes webkit-adjacent-element-selector-bugfix
|
||||
{
|
||||
from {
|
||||
padding: 0;
|
||||
}
|
||||
to {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#uploader {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
height:28px;
|
||||
line-height: 24px;
|
||||
padding-left: 10px;
|
||||
background-color: #444;
|
||||
color:#EEE;
|
||||
}
|
||||
#tree {
|
||||
position: absolute;
|
||||
top: 28px;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width:200px;
|
||||
padding: 8px;
|
||||
}
|
||||
#editor, #preview {
|
||||
position: absolute;
|
||||
top: 28px;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 200px;
|
||||
}
|
||||
#preview {
|
||||
background-color: #EEE;
|
||||
padding:5px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function createFileUploader(element, tree, editor){
|
||||
var xmlHttp;
|
||||
var input = document.createElement("input");
|
||||
input.type = "file";
|
||||
input.multiple = false;
|
||||
input.name = "data";
|
||||
document.getElementById(element).appendChild(input);
|
||||
var path = document.createElement("input");
|
||||
path.id = "upload-path";
|
||||
path.type = "text";
|
||||
path.name = "path";
|
||||
path.defaultValue = "/";
|
||||
document.getElementById(element).appendChild(path);
|
||||
var button = document.createElement("button");
|
||||
button.innerHTML = 'Upload';
|
||||
document.getElementById(element).appendChild(button);
|
||||
var mkdir = document.createElement("button");
|
||||
mkdir.innerHTML = 'MkDir';
|
||||
document.getElementById(element).appendChild(mkdir);
|
||||
var mkfile = document.createElement("button");
|
||||
mkfile.innerHTML = 'MkFile';
|
||||
document.getElementById(element).appendChild(mkfile);
|
||||
|
||||
function httpPostProcessRequest(){
|
||||
if (xmlHttp.readyState == 4){
|
||||
if(xmlHttp.status != 200) alert("ERROR["+xmlHttp.status+"]: "+xmlHttp.responseText);
|
||||
else {
|
||||
tree.refreshPath(path.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
function createPath(p){
|
||||
xmlHttp = new XMLHttpRequest();
|
||||
xmlHttp.onreadystatechange = httpPostProcessRequest;
|
||||
var formData = new FormData();
|
||||
formData.append("path", p);
|
||||
xmlHttp.open("PUT", "/edit");
|
||||
xmlHttp.send(formData);
|
||||
}
|
||||
|
||||
mkfile.onclick = function(e){
|
||||
if(path.value.indexOf(".") === -1) return;
|
||||
createPath(path.value);
|
||||
editor.loadUrl(path.value);
|
||||
};
|
||||
mkdir.onclick = function(e){
|
||||
if(path.value.length < 2) return;
|
||||
var dir = path.value
|
||||
if(dir.indexOf(".") !== -1){
|
||||
if(dir.lastIndexOf("/") === 0) return;
|
||||
dir = dir.substring(0, dir.lastIndexOf("/"));
|
||||
}
|
||||
createPath(dir);
|
||||
};
|
||||
button.onclick = function(e){
|
||||
if(input.files.length === 0){
|
||||
return;
|
||||
}
|
||||
xmlHttp = new XMLHttpRequest();
|
||||
xmlHttp.onreadystatechange = httpPostProcessRequest;
|
||||
var formData = new FormData();
|
||||
formData.append("data", input.files[0], path.value);
|
||||
xmlHttp.open("POST", "/edit");
|
||||
xmlHttp.send(formData);
|
||||
}
|
||||
input.onchange = function(e){
|
||||
if(input.files.length === 0) return;
|
||||
var filename = input.files[0].name;
|
||||
var ext = /(?:\.([^.]+))?$/.exec(filename)[1];
|
||||
var name = /(.*)\.[^.]+$/.exec(filename)[1];
|
||||
if(typeof name !== undefined){
|
||||
if(name.length > 8) name = name.substring(0, 8);
|
||||
filename = name;
|
||||
}
|
||||
if(typeof ext !== undefined){
|
||||
if(ext === "html") ext = "htm";
|
||||
else if(ext === "jpeg") ext = "jpg";
|
||||
filename = filename + "." + ext;
|
||||
}
|
||||
if(path.value === "/" || path.value.lastIndexOf("/") === 0){
|
||||
path.value = "/"+filename;
|
||||
} else {
|
||||
path.value = path.value.substring(0, path.value.lastIndexOf("/")+1)+filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function createTree(element, editor){
|
||||
var preview = document.getElementById("preview");
|
||||
var treeRoot = document.createElement("div");
|
||||
treeRoot.className = "css-treeview";
|
||||
document.getElementById(element).appendChild(treeRoot);
|
||||
|
||||
function loadDownload(path){
|
||||
document.getElementById('download-frame').src = path+"?download=true";
|
||||
}
|
||||
|
||||
function loadPreview(path){
|
||||
document.getElementById("editor").style.display = "none";
|
||||
preview.style.display = "block";
|
||||
preview.innerHTML = '<img src="'+path+'" style="max-width:100%; max-height:100%; margin:auto; display:block;" />';
|
||||
}
|
||||
|
||||
function fillFolderMenu(el, path){
|
||||
var list = document.createElement("ul");
|
||||
el.appendChild(list);
|
||||
var action = document.createElement("li");
|
||||
list.appendChild(action);
|
||||
var isChecked = document.getElementById(path).checked;
|
||||
var expnd = document.createElement("li");
|
||||
list.appendChild(expnd);
|
||||
if(isChecked){
|
||||
expnd.innerHTML = "<span>Collapse</span>";
|
||||
expnd.onclick = function(e){
|
||||
document.getElementById(path).checked = false;
|
||||
if(document.body.getElementsByClassName('contextMenu').length > 0) document.body.removeChild(el);
|
||||
};
|
||||
var refrsh = document.createElement("li");
|
||||
list.appendChild(refrsh);
|
||||
refrsh.innerHTML = "<span>Refresh</span>";
|
||||
refrsh.onclick = function(e){
|
||||
var leaf = document.getElementById(path).parentNode;
|
||||
if(leaf.childNodes.length == 3) leaf.removeChild(leaf.childNodes[2]);
|
||||
httpGet(leaf, path);
|
||||
if(document.body.getElementsByClassName('contextMenu').length > 0) document.body.removeChild(el);
|
||||
};
|
||||
} else {
|
||||
expnd.innerHTML = "<span>Expand</span>";
|
||||
expnd.onclick = function(e){
|
||||
document.getElementById(path).checked = true;
|
||||
var leaf = document.getElementById(path).parentNode;
|
||||
if(leaf.childNodes.length == 3) leaf.removeChild(leaf.childNodes[2]);
|
||||
httpGet(leaf, path);
|
||||
if(document.body.getElementsByClassName('contextMenu').length > 0) document.body.removeChild(el);
|
||||
};
|
||||
}
|
||||
var upload = document.createElement("li");
|
||||
list.appendChild(upload);
|
||||
upload.innerHTML = "<span>Upload</span>";
|
||||
upload.onclick = function(e){
|
||||
var pathEl = document.getElementById("upload-path");
|
||||
if(pathEl){
|
||||
var subPath = pathEl.value;
|
||||
if(subPath.lastIndexOf("/") < 1) pathEl.value = path+subPath;
|
||||
else pathEl.value = path.substring(subPath.lastIndexOf("/"))+subPath;
|
||||
}
|
||||
if(document.body.getElementsByClassName('contextMenu').length > 0) document.body.removeChild(el);
|
||||
};
|
||||
var delFile = document.createElement("li");
|
||||
list.appendChild(delFile);
|
||||
delFile.innerHTML = "<span>Delete</span>";
|
||||
delFile.onclick = function(e){
|
||||
httpDelete(path);
|
||||
if(document.body.getElementsByClassName('contextMenu').length > 0) document.body.removeChild(el);
|
||||
};
|
||||
}
|
||||
|
||||
function fillFileMenu(el, path){
|
||||
var list = document.createElement("ul");
|
||||
el.appendChild(list);
|
||||
var action = document.createElement("li");
|
||||
list.appendChild(action);
|
||||
if(isTextFile(path)){
|
||||
action.innerHTML = "<span>Edit</span>";
|
||||
action.onclick = function(e){
|
||||
editor.loadUrl(path);
|
||||
if(document.body.getElementsByClassName('contextMenu').length > 0) document.body.removeChild(el);
|
||||
};
|
||||
} else if(isImageFile(path)){
|
||||
action.innerHTML = "<span>Preview</span>";
|
||||
action.onclick = function(e){
|
||||
loadPreview(path);
|
||||
if(document.body.getElementsByClassName('contextMenu').length > 0) document.body.removeChild(el);
|
||||
};
|
||||
}
|
||||
var download = document.createElement("li");
|
||||
list.appendChild(download);
|
||||
download.innerHTML = "<span>Download</span>";
|
||||
download.onclick = function(e){
|
||||
loadDownload(path);
|
||||
if(document.body.getElementsByClassName('contextMenu').length > 0) document.body.removeChild(el);
|
||||
};
|
||||
var delFile = document.createElement("li");
|
||||
list.appendChild(delFile);
|
||||
delFile.innerHTML = "<span>Delete</span>";
|
||||
delFile.onclick = function(e){
|
||||
httpDelete(path);
|
||||
if(document.body.getElementsByClassName('contextMenu').length > 0) document.body.removeChild(el);
|
||||
};
|
||||
}
|
||||
|
||||
function showContextMenu(e, path, isfile){
|
||||
var divContext = document.createElement("div");
|
||||
var scrollTop = document.body.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop;
|
||||
var scrollLeft = document.body.scrollLeft ? document.body.scrollLeft : document.documentElement.scrollLeft;
|
||||
var left = event.clientX + scrollLeft;
|
||||
var top = event.clientY + scrollTop;
|
||||
divContext.className = 'contextMenu';
|
||||
divContext.style.display = 'block';
|
||||
divContext.style.left = left + 'px';
|
||||
divContext.style.top = top + 'px';
|
||||
if(isfile) fillFileMenu(divContext, path);
|
||||
else fillFolderMenu(divContext, path);
|
||||
document.body.appendChild(divContext);
|
||||
var width = divContext.offsetWidth;
|
||||
var height = divContext.offsetHeight;
|
||||
divContext.onmouseout = function(e){
|
||||
if(e.clientX < left || e.clientX > (left + width) || e.clientY < top || e.clientY > (top + height)){
|
||||
if(document.body.getElementsByClassName('contextMenu').length > 0) document.body.removeChild(divContext);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function createTreeLeaf(path, name, size){
|
||||
var leaf = document.createElement("li");
|
||||
leaf.id = (((path == "/")?"":path)+"/"+name).toLowerCase();
|
||||
var label = document.createElement("span");
|
||||
label.innerText = name.toLowerCase();
|
||||
leaf.appendChild(label);
|
||||
leaf.onclick = function(e){
|
||||
if(isTextFile(leaf.id)){
|
||||
editor.loadUrl(leaf.id);
|
||||
} else if(isImageFile(leaf.id)){
|
||||
loadPreview(leaf.id);
|
||||
}
|
||||
};
|
||||
leaf.oncontextmenu = function(e){
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
showContextMenu(e, leaf.id, true);
|
||||
};
|
||||
return leaf;
|
||||
}
|
||||
|
||||
function createTreeBranch(path, name, disabled){
|
||||
var leaf = document.createElement("li");
|
||||
var check = document.createElement("input");
|
||||
check.type = "checkbox";
|
||||
check.id = (((path == "/")?"":path)+"/"+name).toLowerCase();
|
||||
if(typeof disabled !== "undefined" && disabled) check.disabled = "disabled";
|
||||
leaf.appendChild(check);
|
||||
var label = document.createElement("label");
|
||||
label.for = check.id;
|
||||
label.innerText = name.toLowerCase();
|
||||
leaf.appendChild(label);
|
||||
check.onchange = function(e){
|
||||
if(check.checked){
|
||||
if(leaf.childNodes.length == 3) leaf.removeChild(leaf.childNodes[2]);
|
||||
httpGet(leaf, check.id);
|
||||
}
|
||||
};
|
||||
label.onclick = function(e){
|
||||
if(!check.checked){
|
||||
check.checked = true;
|
||||
if(leaf.childNodes.length == 3) leaf.removeChild(leaf.childNodes[2]);
|
||||
httpGet(leaf, check.id);
|
||||
} else {
|
||||
check.checked = false;
|
||||
}
|
||||
};
|
||||
leaf.oncontextmenu = function(e){
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
showContextMenu(e, check.id, false);
|
||||
}
|
||||
return leaf;
|
||||
}
|
||||
|
||||
function addList(parent, path, items){
|
||||
var list = document.createElement("ul");
|
||||
parent.appendChild(list);
|
||||
var ll = items.length;
|
||||
for(var i = 0; i < ll; i++){
|
||||
var item = items[i];
|
||||
var itemEl;
|
||||
if(item.type === "file"){
|
||||
itemEl = createTreeLeaf(path, item.name, item.size);
|
||||
} else {
|
||||
itemEl = createTreeBranch(path, item.name);
|
||||
}
|
||||
list.appendChild(itemEl);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function isTextFile(path){
|
||||
var ext = /(?:\.([^.]+))?$/.exec(path)[1];
|
||||
if(typeof ext !== undefined){
|
||||
switch(ext){
|
||||
case "txt":
|
||||
case "htm":
|
||||
case "js":
|
||||
case "c":
|
||||
case "cpp":
|
||||
case "css":
|
||||
case "xml":
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isImageFile(path){
|
||||
var ext = /(?:\.([^.]+))?$/.exec(path)[1];
|
||||
if(typeof ext !== undefined){
|
||||
switch(ext){
|
||||
case "png":
|
||||
case "jpg":
|
||||
case "gif":
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
this.refreshPath = function(path){
|
||||
if(path.lastIndexOf('/') < 1){
|
||||
path = '/';
|
||||
treeRoot.removeChild(treeRoot.childNodes[0]);
|
||||
httpGet(treeRoot, "/");
|
||||
} else {
|
||||
path = path.substring(0, path.lastIndexOf('/'));
|
||||
var leaf = document.getElementById(path).parentNode;
|
||||
if(leaf.childNodes.length == 3) leaf.removeChild(leaf.childNodes[2]);
|
||||
httpGet(leaf, path);
|
||||
}
|
||||
};
|
||||
|
||||
function delCb(path){
|
||||
return function(){
|
||||
if (xmlHttp.readyState == 4){
|
||||
if(xmlHttp.status != 200){
|
||||
alert("ERROR["+xmlHttp.status+"]: "+xmlHttp.responseText);
|
||||
} else {
|
||||
if(path.lastIndexOf('/') < 1){
|
||||
path = '/';
|
||||
treeRoot.removeChild(treeRoot.childNodes[0]);
|
||||
httpGet(treeRoot, "/");
|
||||
} else {
|
||||
path = path.substring(0, path.lastIndexOf('/'));
|
||||
var leaf = document.getElementById(path).parentNode;
|
||||
if(leaf.childNodes.length == 3) leaf.removeChild(leaf.childNodes[2]);
|
||||
httpGet(leaf, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function httpDelete(filename){
|
||||
xmlHttp = new XMLHttpRequest();
|
||||
xmlHttp.onreadystatechange = delCb(filename);
|
||||
var formData = new FormData();
|
||||
formData.append("path", filename);
|
||||
xmlHttp.open("DELETE", "/edit");
|
||||
xmlHttp.send(formData);
|
||||
}
|
||||
|
||||
function getCb(parent, path){
|
||||
return function(){
|
||||
if (xmlHttp.readyState == 4){
|
||||
//clear loading
|
||||
if(xmlHttp.status == 200) addList(parent, path, JSON.parse(xmlHttp.responseText));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function httpGet(parent, path){
|
||||
xmlHttp = new XMLHttpRequest(parent, path);
|
||||
xmlHttp.onreadystatechange = getCb(parent, path);
|
||||
xmlHttp.open("GET", "/list?dir="+path, true);
|
||||
xmlHttp.send(null);
|
||||
//start loading
|
||||
}
|
||||
|
||||
httpGet(treeRoot, "/");
|
||||
return this;
|
||||
}
|
||||
|
||||
function createEditor(element, file, lang, theme, type){
|
||||
function getLangFromFilename(filename){
|
||||
var lang = "plain";
|
||||
var ext = /(?:\.([^.]+))?$/.exec(filename)[1];
|
||||
if(typeof ext !== undefined){
|
||||
switch(ext){
|
||||
case "txt": lang = "plain"; break;
|
||||
case "htm": lang = "html"; break;
|
||||
case "js": lang = "javascript"; break;
|
||||
case "c": lang = "c_cpp"; break;
|
||||
case "cpp": lang = "c_cpp"; break;
|
||||
case "css":
|
||||
case "scss":
|
||||
case "php":
|
||||
case "html":
|
||||
case "json":
|
||||
case "xml":
|
||||
lang = ext;
|
||||
}
|
||||
}
|
||||
return lang;
|
||||
}
|
||||
|
||||
if(typeof file === "undefined") file = "/index.htm";
|
||||
|
||||
if(typeof lang === "undefined"){
|
||||
lang = getLangFromFilename(file);
|
||||
}
|
||||
|
||||
if(typeof theme === "undefined") theme = "textmate";
|
||||
|
||||
if(typeof type === "undefined"){
|
||||
type = "text/"+lang;
|
||||
if(lang === "c_cpp") type = "text/plain";
|
||||
}
|
||||
|
||||
var xmlHttp = null;
|
||||
var editor = ace.edit(element);
|
||||
|
||||
//post
|
||||
function httpPostProcessRequest(){
|
||||
if (xmlHttp.readyState == 4){
|
||||
if(xmlHttp.status != 200) alert("ERROR["+xmlHttp.status+"]: "+xmlHttp.responseText);
|
||||
}
|
||||
}
|
||||
function httpPost(filename, data, type){
|
||||
xmlHttp = new XMLHttpRequest();
|
||||
xmlHttp.onreadystatechange = httpPostProcessRequest;
|
||||
var formData = new FormData();
|
||||
formData.append("data", new Blob([data], { type: type }), filename);
|
||||
xmlHttp.open("POST", "/edit");
|
||||
xmlHttp.send(formData);
|
||||
}
|
||||
//get
|
||||
function httpGetProcessRequest(){
|
||||
if (xmlHttp.readyState == 4){
|
||||
document.getElementById("preview").style.display = "none";
|
||||
document.getElementById("editor").style.display = "block";
|
||||
if(xmlHttp.status == 200) editor.setValue(xmlHttp.responseText);
|
||||
else editor.setValue("");
|
||||
editor.clearSelection();
|
||||
}
|
||||
}
|
||||
function httpGet(theUrl){
|
||||
xmlHttp = new XMLHttpRequest();
|
||||
xmlHttp.onreadystatechange = httpGetProcessRequest;
|
||||
xmlHttp.open("GET", theUrl, true);
|
||||
xmlHttp.send(null);
|
||||
}
|
||||
|
||||
if(lang !== "plain") editor.getSession().setMode("ace/mode/"+lang);
|
||||
editor.setTheme("ace/theme/"+theme);
|
||||
editor.$blockScrolling = Infinity;
|
||||
editor.getSession().setUseSoftTabs(true);
|
||||
editor.getSession().setTabSize(2);
|
||||
editor.setHighlightActiveLine(true);
|
||||
editor.setShowPrintMargin(false);
|
||||
editor.commands.addCommand({
|
||||
name: 'saveCommand',
|
||||
bindKey: {win: 'Ctrl-S', mac: 'Command-S'},
|
||||
exec: function(editor) {
|
||||
httpPost(file, editor.getValue()+"", type);
|
||||
},
|
||||
readOnly: false
|
||||
});
|
||||
editor.commands.addCommand({
|
||||
name: 'undoCommand',
|
||||
bindKey: {win: 'Ctrl-Z', mac: 'Command-Z'},
|
||||
exec: function(editor) {
|
||||
editor.getSession().getUndoManager().undo(false);
|
||||
},
|
||||
readOnly: false
|
||||
});
|
||||
editor.commands.addCommand({
|
||||
name: 'redoCommand',
|
||||
bindKey: {win: 'Ctrl-Shift-Z', mac: 'Command-Shift-Z'},
|
||||
exec: function(editor) {
|
||||
editor.getSession().getUndoManager().redo(false);
|
||||
},
|
||||
readOnly: false
|
||||
});
|
||||
httpGet(file);
|
||||
editor.loadUrl = function(filename){
|
||||
file = filename;
|
||||
lang = getLangFromFilename(file);
|
||||
type = "text/"+lang;
|
||||
if(lang !== "plain") editor.getSession().setMode("ace/mode/"+lang);
|
||||
httpGet(file);
|
||||
}
|
||||
return editor;
|
||||
}
|
||||
function onBodyLoad(){
|
||||
var vars = {};
|
||||
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { vars[key] = value; });
|
||||
var editor = createEditor("editor", vars.file, vars.lang, vars.theme);
|
||||
var tree = createTree("tree", editor);
|
||||
createFileUploader("uploader", tree, editor);
|
||||
};
|
||||
</script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.1.9/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||
</head>
|
||||
<body onload="onBodyLoad();">
|
||||
<div id="uploader"></div>
|
||||
<div id="tree"></div>
|
||||
<div id="editor"></div>
|
||||
<div id="preview" style="display:none;"></div>
|
||||
<iframe id=download-frame style='display:none;'></iframe>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>ESP Index</title>
|
||||
<style>
|
||||
body {
|
||||
background-color:black;
|
||||
color:white;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function onBodyLoad(){
|
||||
console.log("we are loaded!!");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body id="index" onload="onBodyLoad()">
|
||||
<h1>ESP8266 Pin Functions</h1>
|
||||
<img src="pins.png" />
|
||||
</body>
|
||||
</html>
|
BIN
libraries/ESP8266WebServer/examples/SDWebServer/SdRoot/pins.png
Normal file
BIN
libraries/ESP8266WebServer/examples/SDWebServer/SdRoot/pins.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 174 KiB |
@ -17,6 +17,7 @@
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Modified 8 May 2015 by Hristo Gochkov (proper post and file upload handling)
|
||||
*/
|
||||
|
||||
|
||||
@ -25,7 +26,8 @@
|
||||
#include "WiFiClient.h"
|
||||
#include "ESP8266WebServer.h"
|
||||
|
||||
// #define DEBUG
|
||||
//#define DEBUG
|
||||
#define DEBUG_OUTPUT Serial1
|
||||
|
||||
struct ESP8266WebServer::RequestHandler {
|
||||
RequestHandler(ESP8266WebServer::THandlerFunction fn, const char* uri, HTTPMethod method)
|
||||
@ -95,7 +97,7 @@ void ESP8266WebServer::handleClient()
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
Serial.println("New client");
|
||||
DEBUG_OUTPUT.println("New client");
|
||||
#endif
|
||||
// Wait for data from client to become available
|
||||
while(client.connected() && !client.available()){
|
||||
@ -106,86 +108,101 @@ void ESP8266WebServer::handleClient()
|
||||
String req = client.readStringUntil('\r');
|
||||
client.readStringUntil('\n');
|
||||
|
||||
HTTPMethod method = HTTP_GET;
|
||||
if (req.startsWith("POST")) {
|
||||
method = HTTP_POST;
|
||||
}
|
||||
|
||||
// First line of HTTP request looks like "GET /path HTTP/1.1"
|
||||
// Retrieve the "/path" part by finding the spaces
|
||||
int addr_start = req.indexOf(' ');
|
||||
int addr_end = req.indexOf(' ', addr_start + 1);
|
||||
if (addr_start == -1 || addr_end == -1) {
|
||||
#ifdef DEBUG
|
||||
Serial.print("Invalid request: ");
|
||||
Serial.println(req);
|
||||
DEBUG_OUTPUT.print("Invalid request: ");
|
||||
DEBUG_OUTPUT.println(req);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
req = req.substring(addr_start + 1, addr_end);
|
||||
String methodStr = req.substring(0, addr_start);
|
||||
String url = req.substring(addr_start + 1, addr_end);
|
||||
String searchStr = "";
|
||||
int hasSearch = url.indexOf('?');
|
||||
if(hasSearch != -1){
|
||||
searchStr = url.substring(hasSearch + 1);
|
||||
url = url.substring(0, hasSearch);
|
||||
}
|
||||
_currentUri = url;
|
||||
|
||||
HTTPMethod method = HTTP_GET;
|
||||
if (methodStr == "POST") {
|
||||
method = HTTP_POST;
|
||||
} else if (methodStr == "DELETE") {
|
||||
method = HTTP_DELETE;
|
||||
} else if (methodStr == "PUT") {
|
||||
method = HTTP_PUT;
|
||||
} else if (methodStr == "PATCH") {
|
||||
method = HTTP_PATCH;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
DEBUG_OUTPUT.print("method: ");
|
||||
DEBUG_OUTPUT.print(methodStr);
|
||||
DEBUG_OUTPUT.print(" url: ");
|
||||
DEBUG_OUTPUT.print(url);
|
||||
DEBUG_OUTPUT.print(" search: ");
|
||||
DEBUG_OUTPUT.println(searchStr);
|
||||
#endif
|
||||
|
||||
String formData;
|
||||
if (method == HTTP_POST) {
|
||||
int contentLength = -1;
|
||||
int headerCount = 0;
|
||||
while(headerCount < 1024) { // there shouldn't be that much really
|
||||
String line = client.readStringUntil('\r');
|
||||
//bellow is needed only when POST type request
|
||||
if(method == HTTP_POST || method == HTTP_PUT || method == HTTP_PATCH || method == HTTP_DELETE){
|
||||
String boundaryStr;
|
||||
String headerName;
|
||||
String headerValue;
|
||||
bool isForm = false;
|
||||
uint32_t contentLength = 0;
|
||||
//parse headers
|
||||
while(1){
|
||||
req = client.readStringUntil('\r');
|
||||
client.readStringUntil('\n');
|
||||
|
||||
if (line.length() > 0) { // this is a header
|
||||
++headerCount;
|
||||
if (contentLength < 0 && line.startsWith("Content-Length")) {
|
||||
// get content length from the header
|
||||
int valuePos = line.indexOf(' ', 14);
|
||||
if (valuePos > 0) {
|
||||
String valueStr = line.substring(valuePos+1);
|
||||
contentLength = valueStr.toInt();
|
||||
#ifdef DEBUG
|
||||
Serial.print("Content-Length: ");
|
||||
Serial.println(contentLength);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(req == "") break;//no moar headers
|
||||
int headerDiv = req.indexOf(':');
|
||||
if(headerDiv == -1){
|
||||
break;
|
||||
}
|
||||
headerName = req.substring(0, headerDiv);
|
||||
headerValue = req.substring(headerDiv + 2);
|
||||
if(headerName == "Content-Type"){
|
||||
if(headerValue.startsWith("text/plain")){
|
||||
isForm = false;
|
||||
} else if(headerValue.startsWith("multipart/form-data")){
|
||||
boundaryStr = headerValue.substring(headerValue.indexOf('=')+1);
|
||||
isForm = true;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
Serial.print("headerCount=");
|
||||
Serial.println(headerCount);
|
||||
#endif
|
||||
if (contentLength >= 0) {
|
||||
formData = "";
|
||||
int n = 0; // timeout counter
|
||||
while (formData.length() < contentLength && ++n < 3)
|
||||
formData += client.readString();
|
||||
}
|
||||
else {
|
||||
formData = client.readStringUntil('\r'); // will return after timing out once
|
||||
}
|
||||
}
|
||||
else if (method == HTTP_GET) {
|
||||
int args_start = req.indexOf('?');
|
||||
if (args_start != -1) {
|
||||
formData = req.substring(args_start + 1);
|
||||
req = req.substring(0, args_start);
|
||||
} else if(headerName == "Content-Length"){
|
||||
contentLength = headerValue.toInt();
|
||||
}
|
||||
}
|
||||
|
||||
if(!isForm){
|
||||
if(searchStr != "") searchStr += '&';
|
||||
searchStr += client.readStringUntil('\r');
|
||||
client.readStringUntil('\n');
|
||||
}
|
||||
_parseArguments(searchStr);
|
||||
if(isForm){
|
||||
_parseForm(client, boundaryStr, contentLength);
|
||||
}
|
||||
} else {
|
||||
_parseArguments(searchStr);
|
||||
}
|
||||
client.flush();
|
||||
|
||||
#ifdef DEBUG
|
||||
Serial.print("Request: ");
|
||||
Serial.println(req);
|
||||
Serial.print("Args: ");
|
||||
Serial.println(formData);
|
||||
DEBUG_OUTPUT.print("Request: ");
|
||||
DEBUG_OUTPUT.println(url);
|
||||
DEBUG_OUTPUT.print(" Arguments: ");
|
||||
DEBUG_OUTPUT.println(searchStr);
|
||||
#endif
|
||||
|
||||
_parseArguments(formData);
|
||||
_handleRequest(client, req, method);
|
||||
|
||||
_handleRequest(client, url, method);
|
||||
}
|
||||
|
||||
void ESP8266WebServer::send(int code, const char* content_type, String content) {
|
||||
@ -237,6 +254,10 @@ bool ESP8266WebServer::hasArg(const char* name) {
|
||||
}
|
||||
|
||||
void ESP8266WebServer::_parseArguments(String data) {
|
||||
#ifdef DEBUG
|
||||
DEBUG_OUTPUT.print("args: ");
|
||||
DEBUG_OUTPUT.println(data);
|
||||
#endif
|
||||
if (_currentArgs)
|
||||
delete[] _currentArgs;
|
||||
_currentArgs = 0;
|
||||
@ -254,8 +275,8 @@ void ESP8266WebServer::_parseArguments(String data) {
|
||||
++_currentArgCount;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
Serial.print("args count: ");
|
||||
Serial.println(_currentArgCount);
|
||||
DEBUG_OUTPUT.print("args count: ");
|
||||
DEBUG_OUTPUT.println(_currentArgCount);
|
||||
#endif
|
||||
|
||||
_currentArgs = new RequestArgument[_currentArgCount];
|
||||
@ -265,17 +286,17 @@ void ESP8266WebServer::_parseArguments(String data) {
|
||||
int equal_sign_index = data.indexOf('=', pos);
|
||||
int next_arg_index = data.indexOf('&', pos);
|
||||
#ifdef DEBUG
|
||||
Serial.print("pos ");
|
||||
Serial.print(pos);
|
||||
Serial.print("=@ ");
|
||||
Serial.print(equal_sign_index);
|
||||
Serial.print(" &@ ");
|
||||
Serial.println(next_arg_index);
|
||||
DEBUG_OUTPUT.print("pos ");
|
||||
DEBUG_OUTPUT.print(pos);
|
||||
DEBUG_OUTPUT.print("=@ ");
|
||||
DEBUG_OUTPUT.print(equal_sign_index);
|
||||
DEBUG_OUTPUT.print(" &@ ");
|
||||
DEBUG_OUTPUT.println(next_arg_index);
|
||||
#endif
|
||||
if ((equal_sign_index == -1) || ((equal_sign_index > next_arg_index) && (next_arg_index != -1))) {
|
||||
#ifdef DEBUG
|
||||
Serial.print("arg missing value: ");
|
||||
Serial.println(iarg);
|
||||
DEBUG_OUTPUT.print("arg missing value: ");
|
||||
DEBUG_OUTPUT.println(iarg);
|
||||
#endif
|
||||
if (next_arg_index == -1)
|
||||
break;
|
||||
@ -286,12 +307,12 @@ void ESP8266WebServer::_parseArguments(String data) {
|
||||
arg.key = data.substring(pos, equal_sign_index);
|
||||
arg.value = data.substring(equal_sign_index + 1, next_arg_index);
|
||||
#ifdef DEBUG
|
||||
Serial.print("arg ");
|
||||
Serial.print(iarg);
|
||||
Serial.print(" key: ");
|
||||
Serial.print(arg.key);
|
||||
Serial.print(" value: ");
|
||||
Serial.println(arg.value);
|
||||
DEBUG_OUTPUT.print("arg ");
|
||||
DEBUG_OUTPUT.print(iarg);
|
||||
DEBUG_OUTPUT.print(" key: ");
|
||||
DEBUG_OUTPUT.print(arg.key);
|
||||
DEBUG_OUTPUT.print(" value: ");
|
||||
DEBUG_OUTPUT.println(arg.value);
|
||||
#endif
|
||||
++iarg;
|
||||
if (next_arg_index == -1)
|
||||
@ -300,12 +321,234 @@ void ESP8266WebServer::_parseArguments(String data) {
|
||||
}
|
||||
_currentArgCount = iarg;
|
||||
#ifdef DEBUG
|
||||
Serial.print("args count: ");
|
||||
Serial.println(_currentArgCount);
|
||||
DEBUG_OUTPUT.print("args count: ");
|
||||
DEBUG_OUTPUT.println(_currentArgCount);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void ESP8266WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t len){
|
||||
|
||||
#ifdef DEBUG
|
||||
DEBUG_OUTPUT.print("Parse Form: Boundary: ");
|
||||
DEBUG_OUTPUT.print(boundary);
|
||||
DEBUG_OUTPUT.print("Length: ");
|
||||
DEBUG_OUTPUT.println(len);
|
||||
#endif
|
||||
String line;
|
||||
line = client.readStringUntil('\r');
|
||||
client.readStringUntil('\n');
|
||||
//start reading the form
|
||||
if(line == ("--"+boundary)){
|
||||
RequestArgument* postArgs = new RequestArgument[32];
|
||||
int postArgsLen = 0;
|
||||
while(1){
|
||||
String argName;
|
||||
String argValue;
|
||||
String argType;
|
||||
String argFilename;
|
||||
bool argIsFile = false;
|
||||
|
||||
line = client.readStringUntil('\r');
|
||||
client.readStringUntil('\n');
|
||||
if(line.startsWith("Content-Disposition")){
|
||||
int nameStart = line.indexOf('=');
|
||||
if(nameStart != -1){
|
||||
argName = line.substring(nameStart+2);
|
||||
nameStart = argName.indexOf('=');
|
||||
if(nameStart == -1){
|
||||
argName = argName.substring(0, argName.length() - 1);
|
||||
} else {
|
||||
argFilename = argName.substring(nameStart+2, argName.length() - 1);
|
||||
argName = argName.substring(0, argName.indexOf('"'));
|
||||
argIsFile = true;
|
||||
#ifdef DEBUG
|
||||
DEBUG_OUTPUT.print("PostArg FileName: ");
|
||||
DEBUG_OUTPUT.println(argFilename);
|
||||
#endif
|
||||
//use GET to set the filename if uploading using blob
|
||||
if(argFilename == "blob" && hasArg("filename")) argFilename = arg("filename");
|
||||
}
|
||||
#ifdef DEBUG
|
||||
DEBUG_OUTPUT.print("PostArg Name: ");
|
||||
DEBUG_OUTPUT.println(argName);
|
||||
#endif
|
||||
argType = "text/plain";
|
||||
line = client.readStringUntil('\r');
|
||||
client.readStringUntil('\n');
|
||||
if(line.startsWith("Content-Type")){
|
||||
argType = line.substring(line.indexOf(':')+2);
|
||||
//skip next line
|
||||
client.readStringUntil('\r');
|
||||
client.readStringUntil('\n');
|
||||
}
|
||||
#ifdef DEBUG
|
||||
DEBUG_OUTPUT.print("PostArg Type: ");
|
||||
DEBUG_OUTPUT.println(argType);
|
||||
#endif
|
||||
if(!argIsFile){
|
||||
while(1){
|
||||
line = client.readStringUntil('\r');
|
||||
client.readStringUntil('\n');
|
||||
if(line.startsWith("--"+boundary)) break;
|
||||
if(argValue.length() > 0) argValue += "\n";
|
||||
argValue += line;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
DEBUG_OUTPUT.print("PostArg Value: ");
|
||||
DEBUG_OUTPUT.println(argValue);
|
||||
DEBUG_OUTPUT.println();
|
||||
#endif
|
||||
|
||||
RequestArgument& arg = postArgs[postArgsLen++];
|
||||
arg.key = argName;
|
||||
arg.value = argValue;
|
||||
|
||||
if(line == ("--"+boundary+"--")){
|
||||
#ifdef DEBUG
|
||||
DEBUG_OUTPUT.println("Done Parsing POST");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
_currentUpload.status = UPLOAD_FILE_START;
|
||||
_currentUpload.name = argName;
|
||||
_currentUpload.filename = argFilename;
|
||||
_currentUpload.type = argType;
|
||||
_currentUpload.size = 0;
|
||||
_currentUpload.buflen = 0;
|
||||
#ifdef DEBUG
|
||||
DEBUG_OUTPUT.print("Start File: ");
|
||||
DEBUG_OUTPUT.print(_currentUpload.filename);
|
||||
DEBUG_OUTPUT.print(" Type: ");
|
||||
DEBUG_OUTPUT.println(_currentUpload.type);
|
||||
#endif
|
||||
if(_fileUploadHandler) _fileUploadHandler();
|
||||
_currentUpload.status = UPLOAD_FILE_WRITE;
|
||||
uint8_t argByte = client.read();
|
||||
readfile:
|
||||
while(argByte != 0x0D){
|
||||
_currentUpload.buf[_currentUpload.buflen++] = argByte;
|
||||
if(_currentUpload.buflen == 1460){
|
||||
#ifdef DEBUG
|
||||
DEBUG_OUTPUT.println("Write File: 1460");
|
||||
#endif
|
||||
if(_fileUploadHandler) _fileUploadHandler();
|
||||
_currentUpload.size += _currentUpload.buflen;
|
||||
_currentUpload.buflen = 0;
|
||||
}
|
||||
argByte = client.read();
|
||||
}
|
||||
|
||||
argByte = client.read();
|
||||
if(argByte == 0x0A){
|
||||
#ifdef DEBUG
|
||||
DEBUG_OUTPUT.print("Write File: ");
|
||||
DEBUG_OUTPUT.println(_currentUpload.buflen);
|
||||
#endif
|
||||
if(_fileUploadHandler) _fileUploadHandler();
|
||||
_currentUpload.size += _currentUpload.buflen;
|
||||
_currentUpload.buflen = 0;
|
||||
|
||||
argByte = client.read();
|
||||
if((char)argByte != '-'){
|
||||
//continue reading the file
|
||||
_currentUpload.buf[_currentUpload.buflen++] = 0x0D;
|
||||
_currentUpload.buf[_currentUpload.buflen++] = 0x0A;
|
||||
goto readfile;
|
||||
} else {
|
||||
argByte = client.read();
|
||||
if((char)argByte != '-'){
|
||||
//continue reading the file
|
||||
_currentUpload.buf[_currentUpload.buflen++] = 0x0D;
|
||||
_currentUpload.buf[_currentUpload.buflen++] = 0x0A;
|
||||
_currentUpload.buf[_currentUpload.buflen++] = (uint8_t)('-');
|
||||
goto readfile;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t endBuf[boundary.length()];
|
||||
client.readBytes(endBuf, boundary.length());
|
||||
|
||||
if(strstr((const char*)endBuf, (const char*)(boundary.c_str())) != NULL){
|
||||
_currentUpload.status = UPLOAD_FILE_END;
|
||||
#ifdef DEBUG
|
||||
DEBUG_OUTPUT.print("End File: ");
|
||||
DEBUG_OUTPUT.print(_currentUpload.filename);
|
||||
DEBUG_OUTPUT.print(" Type: ");
|
||||
DEBUG_OUTPUT.print(_currentUpload.type);
|
||||
DEBUG_OUTPUT.print(" Size: ");
|
||||
DEBUG_OUTPUT.println(_currentUpload.size);
|
||||
#endif
|
||||
if(_fileUploadHandler) _fileUploadHandler();
|
||||
line = client.readStringUntil(0x0D);
|
||||
client.readStringUntil(0x0A);
|
||||
if(line == "--"){
|
||||
#ifdef DEBUG
|
||||
DEBUG_OUTPUT.println("Done Parsing POST");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
_currentUpload.buf[_currentUpload.buflen++] = 0x0D;
|
||||
_currentUpload.buf[_currentUpload.buflen++] = 0x0A;
|
||||
uint32_t i = 0;
|
||||
while(i < boundary.length()){
|
||||
_currentUpload.buf[_currentUpload.buflen++] = endBuf[i++];
|
||||
if(_currentUpload.buflen == 1460){
|
||||
#ifdef DEBUG
|
||||
DEBUG_OUTPUT.println("Write File: 1460");
|
||||
#endif
|
||||
if(_fileUploadHandler) _fileUploadHandler();
|
||||
_currentUpload.size += _currentUpload.buflen;
|
||||
_currentUpload.buflen = 0;
|
||||
}
|
||||
}
|
||||
argByte = client.read();
|
||||
goto readfile;
|
||||
}
|
||||
} else {
|
||||
_currentUpload.buf[_currentUpload.buflen++] = 0x0D;
|
||||
if(_currentUpload.buflen == 1460){
|
||||
#ifdef DEBUG
|
||||
DEBUG_OUTPUT.println("Write File: 1460");
|
||||
#endif
|
||||
if(_fileUploadHandler) _fileUploadHandler();
|
||||
_currentUpload.size += _currentUpload.buflen;
|
||||
_currentUpload.buflen = 0;
|
||||
}
|
||||
goto readfile;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int iarg;
|
||||
int totalArgs = ((32 - postArgsLen) < _currentArgCount)?(32 - postArgsLen):_currentArgCount;
|
||||
for (iarg = 0; iarg < totalArgs; iarg++){
|
||||
RequestArgument& arg = postArgs[postArgsLen++];
|
||||
arg.key = _currentArgs[iarg].key;
|
||||
arg.value = _currentArgs[iarg].value;
|
||||
}
|
||||
if (_currentArgs) delete[] _currentArgs;
|
||||
_currentArgs = new RequestArgument[postArgsLen];
|
||||
for (iarg = 0; iarg < postArgsLen; iarg++){
|
||||
RequestArgument& arg = _currentArgs[iarg];
|
||||
arg.key = postArgs[iarg].key;
|
||||
arg.value = postArgs[iarg].value;
|
||||
}
|
||||
_currentArgCount = iarg;
|
||||
if (postArgs) delete[] postArgs;
|
||||
}
|
||||
}
|
||||
|
||||
void ESP8266WebServer::onFileUpload(THandlerFunction fn) {
|
||||
_fileUploadHandler = fn;
|
||||
}
|
||||
|
||||
void ESP8266WebServer::onNotFound(THandlerFunction fn) {
|
||||
_notFoundHandler = fn;
|
||||
}
|
||||
@ -330,7 +573,7 @@ void ESP8266WebServer::_handleRequest(WiFiClient& client, String uri, HTTPMethod
|
||||
|
||||
if (!handler){
|
||||
#ifdef DEBUG
|
||||
Serial.println("request handler not found");
|
||||
DEBUG_OUTPUT.println("request handler not found");
|
||||
#endif
|
||||
|
||||
if(_notFoundHandler) {
|
||||
|
@ -17,6 +17,7 @@
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Modified 8 May 2015 by Hristo Gochkov (proper post and file upload handling)
|
||||
*/
|
||||
|
||||
|
||||
@ -25,8 +26,18 @@
|
||||
|
||||
#include <functional>
|
||||
|
||||
enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_POST };
|
||||
enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE };
|
||||
enum HTTPUploadStatus { UPLOAD_FILE_START, UPLOAD_FILE_WRITE, UPLOAD_FILE_END };
|
||||
|
||||
typedef struct {
|
||||
HTTPUploadStatus status;
|
||||
String filename;
|
||||
String name;
|
||||
String type;
|
||||
size_t size;
|
||||
size_t buflen;
|
||||
uint8_t buf[1460];
|
||||
} HTTPUpload;
|
||||
|
||||
class ESP8266WebServer
|
||||
{
|
||||
@ -42,10 +53,12 @@ public:
|
||||
void on(const char* uri, THandlerFunction handler);
|
||||
void on(const char* uri, HTTPMethod method, THandlerFunction fn);
|
||||
void onNotFound(THandlerFunction fn); //called when handler is not assigned
|
||||
void onFileUpload(THandlerFunction fn); //handle file uploads
|
||||
|
||||
String uri() { return _currentUri; }
|
||||
HTTPMethod method() { return _currentMethod; }
|
||||
WiFiClient client() { return _currentClient; }
|
||||
HTTPUpload upload() { return _currentUpload; }
|
||||
|
||||
String arg(const char* name); // get request argument value by name
|
||||
String arg(int i); // get request argument value by number
|
||||
@ -64,6 +77,7 @@ protected:
|
||||
void _parseArguments(String data);
|
||||
static const char* _responseCodeToString(int code);
|
||||
static void _appendHeader(String& response, const char* name, const char* value);
|
||||
void _parseForm(WiFiClient& client, String boundary, uint32_t len);
|
||||
|
||||
struct RequestHandler;
|
||||
struct RequestArgument {
|
||||
@ -79,10 +93,12 @@ protected:
|
||||
|
||||
size_t _currentArgCount;
|
||||
RequestArgument* _currentArgs;
|
||||
HTTPUpload _currentUpload;
|
||||
|
||||
RequestHandler* _firstHandler;
|
||||
RequestHandler* _lastHandler;
|
||||
THandlerFunction _notFoundHandler;
|
||||
THandlerFunction _fileUploadHandler;
|
||||
|
||||
};
|
||||
|
||||
|
@ -75,6 +75,11 @@ void WiFiServer::begin()
|
||||
|
||||
extern "C" uint32_t esp_micros_at_task_start();
|
||||
|
||||
bool WiFiServer::hasClient(){
|
||||
if (_unclaimed) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
WiFiClient WiFiServer::available(byte* status)
|
||||
{
|
||||
static uint32_t lastPollTime = 0;
|
||||
|
@ -44,6 +44,7 @@ private:
|
||||
public:
|
||||
WiFiServer(uint16_t port);
|
||||
WiFiClient available(uint8_t* status = NULL);
|
||||
bool hasClient();
|
||||
void begin();
|
||||
virtual size_t write(uint8_t);
|
||||
virtual size_t write(const uint8_t *buf, size_t size);
|
||||
|
@ -40,6 +40,38 @@ class ClientContext {
|
||||
tcp_err(pcb, &_s_error);
|
||||
}
|
||||
|
||||
err_t abort(){
|
||||
if(_pcb) {
|
||||
DEBUGV(":abort\r\n");
|
||||
tcp_arg(_pcb, NULL);
|
||||
tcp_sent(_pcb, NULL);
|
||||
tcp_recv(_pcb, NULL);
|
||||
tcp_err(_pcb, NULL);
|
||||
tcp_abort(_pcb);
|
||||
_pcb = 0;
|
||||
}
|
||||
return ERR_ABRT;
|
||||
}
|
||||
|
||||
err_t close(){
|
||||
err_t err = ERR_OK;
|
||||
if(_pcb) {
|
||||
DEBUGV(":close\r\n");
|
||||
tcp_arg(_pcb, NULL);
|
||||
tcp_sent(_pcb, NULL);
|
||||
tcp_recv(_pcb, NULL);
|
||||
tcp_err(_pcb, NULL);
|
||||
err = tcp_close(_pcb);
|
||||
if(err != ERR_OK) {
|
||||
DEBUGV(":tc err %d\r\n", err);
|
||||
tcp_abort(_pcb);
|
||||
err = ERR_ABRT;
|
||||
}
|
||||
_pcb = 0;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
~ClientContext() {
|
||||
}
|
||||
|
||||
@ -58,22 +90,11 @@ class ClientContext {
|
||||
}
|
||||
|
||||
void unref() {
|
||||
err_t err;
|
||||
DEBUGV(":ur %d\r\n", _refcnt);
|
||||
if(--_refcnt == 0) {
|
||||
flush();
|
||||
if(_pcb) {
|
||||
tcp_arg(_pcb, NULL);
|
||||
tcp_sent(_pcb, NULL);
|
||||
tcp_recv(_pcb, NULL);
|
||||
tcp_err(_pcb, NULL);
|
||||
err = tcp_close(_pcb);
|
||||
if(err != ERR_OK) {
|
||||
DEBUGV(":tc err %d\r\n", err);
|
||||
tcp_abort(_pcb);
|
||||
}
|
||||
_pcb = 0;
|
||||
}
|
||||
close();
|
||||
if(_discard_cb) _discard_cb(_discard_cb_arg, this);
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
@ -179,6 +200,13 @@ class ClientContext {
|
||||
|
||||
private:
|
||||
|
||||
err_t _sent(tcp_pcb* pcb, uint16_t len) {
|
||||
DEBUGV(":sent %d\r\n", len);
|
||||
_size_sent -= len;
|
||||
if(_size_sent == 0 && _send_waiting) esp_schedule();
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
void _consume(size_t size) {
|
||||
ptrdiff_t left = _rx_buf->len - _rx_buf_offset - size;
|
||||
if(left > 0) {
|
||||
@ -203,22 +231,9 @@ class ClientContext {
|
||||
err_t _recv(tcp_pcb* pcb, pbuf* pb, err_t err) {
|
||||
|
||||
if(pb == 0) // connection closed
|
||||
{
|
||||
DEBUGV(":rcl\r\n");
|
||||
tcp_arg(pcb, NULL);
|
||||
tcp_sent(pcb, NULL);
|
||||
tcp_recv(pcb, NULL);
|
||||
tcp_err(pcb, NULL);
|
||||
// int error = tcp_close(pcb);
|
||||
// if (error != ERR_OK)
|
||||
{
|
||||
DEBUGV(":rcla\r\n");
|
||||
tcp_abort(pcb);
|
||||
_pcb = 0;
|
||||
return ERR_ABRT;
|
||||
}
|
||||
_pcb = 0;
|
||||
return ERR_OK;
|
||||
return abort();
|
||||
}
|
||||
|
||||
if(_rx_buf) {
|
||||
@ -231,27 +246,12 @@ class ClientContext {
|
||||
_rx_buf = pb;
|
||||
_rx_buf_offset = 0;
|
||||
}
|
||||
// tcp_recved(pcb, received);
|
||||
// pbuf_free(pb);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
void _error(err_t err) {
|
||||
DEBUGV(":er %d\r\n", err);
|
||||
|
||||
if(_pcb) {
|
||||
tcp_arg(_pcb, NULL);
|
||||
tcp_sent(_pcb, NULL);
|
||||
tcp_recv(_pcb, NULL);
|
||||
tcp_err(_pcb, NULL);
|
||||
err = tcp_close(_pcb);
|
||||
if(err != ERR_OK) {
|
||||
DEBUGV(":tc err %d\r\n", err);
|
||||
tcp_abort(_pcb);
|
||||
}
|
||||
}
|
||||
_pcb = 0;
|
||||
|
||||
close();
|
||||
if(_size_sent && _send_waiting) {
|
||||
esp_schedule();
|
||||
}
|
||||
@ -261,13 +261,6 @@ class ClientContext {
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
err_t _sent(tcp_pcb* pcb, uint16_t len) {
|
||||
DEBUGV(":sent %d\r\n", len);
|
||||
_size_sent -= len;
|
||||
if(_size_sent == 0 && _send_waiting) esp_schedule();
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
static err_t _s_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *pb, err_t err) {
|
||||
return reinterpret_cast<ClientContext*>(arg)->_recv(tpcb, pb, err);
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ boolean callback_rmdir(SdFile& parentDir, char *filePathComponent,
|
||||
|
||||
|
||||
|
||||
boolean SDClass::begin(uint8_t csPin) {
|
||||
boolean SDClass::begin(uint8_t csPin, uint32_t speed) {
|
||||
/*
|
||||
|
||||
Performs the initialisation required by the sdfatlib library.
|
||||
@ -340,7 +340,7 @@ boolean SDClass::begin(uint8_t csPin) {
|
||||
Return true if initialization succeeds, false otherwise.
|
||||
|
||||
*/
|
||||
return card.init(SPI_HALF_SPEED, csPin) &&
|
||||
return card.init(speed, csPin) &&
|
||||
volume.init(card) &&
|
||||
root.openRoot(volume);
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ private:
|
||||
public:
|
||||
// This needs to be called to set up the connection to the SD card
|
||||
// before other methods are used.
|
||||
boolean begin(uint8_t csPin = SD_CHIP_SELECT_PIN);
|
||||
boolean begin(uint8_t csPin = SD_CHIP_SELECT_PIN, uint32_t speed = SPI_HALF_SPEED);
|
||||
|
||||
// Open the specified file/directory with the supplied mode (e.g. read or
|
||||
// write, etc). Returns a File object for interacting with the file.
|
||||
|
@ -270,11 +270,7 @@ uint8_t Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
|
||||
SPSR &= ~(1 << SPI2X);
|
||||
#else // USE_SPI_LIB
|
||||
SPI.begin();
|
||||
#ifdef ESP8266
|
||||
settings = SPISettings(SPI_CLOCK_DIV64, MSBFIRST, SPI_MODE0);
|
||||
#else
|
||||
settings = SPISettings(250000, MSBFIRST, SPI_MODE0);
|
||||
#endif
|
||||
#endif // USE_SPI_LIB
|
||||
#endif // SOFTWARE_SPI
|
||||
|
||||
|
@ -28,9 +28,9 @@
|
||||
|
||||
#ifdef ESP8266
|
||||
#include "SPI.h"
|
||||
uint32_t const SPI_FULL_SPEED = SPI_CLOCK_DIV2;
|
||||
uint32_t const SPI_HALF_SPEED = SPI_CLOCK_DIV4;
|
||||
uint32_t const SPI_QUARTER_SPEED = SPI_CLOCK_DIV8;
|
||||
uint32_t const SPI_FULL_SPEED = 8000000;
|
||||
uint32_t const SPI_HALF_SPEED = 4000000;
|
||||
uint32_t const SPI_QUARTER_SPEED = 2000000;
|
||||
#else
|
||||
/** Set SCK to max rate of F_CPU/2. See Sd2Card::setSckRate(). */
|
||||
uint8_t const SPI_FULL_SPEED = 0;
|
||||
|
@ -17,22 +17,34 @@
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "SPI.h"
|
||||
#include "HardwareSerial.h"
|
||||
|
||||
typedef union {
|
||||
uint32_t regValue;
|
||||
struct {
|
||||
unsigned regL :6;
|
||||
unsigned regH :6;
|
||||
unsigned regN :6;
|
||||
unsigned regPre :13;
|
||||
unsigned regEQU :1;
|
||||
};
|
||||
} spiClk_t;
|
||||
|
||||
SPIClass SPI;
|
||||
|
||||
SPIClass::SPIClass(){}
|
||||
SPIClass::SPIClass() {
|
||||
}
|
||||
|
||||
void SPIClass::begin(){
|
||||
pinMode(SCK, SPECIAL);
|
||||
pinMode(MISO, SPECIAL);
|
||||
pinMode(MOSI, SPECIAL);
|
||||
void SPIClass::begin() {
|
||||
pinMode(SCK, SPECIAL); ///< GPIO14
|
||||
pinMode(MISO, SPECIAL); ///< GPIO12
|
||||
pinMode(MOSI, SPECIAL); ///< GPIO13
|
||||
|
||||
GPMUX = 0x105;
|
||||
SPI1C = 0;
|
||||
SPI1CLK = SPI_CLOCK_DIV16;//1MHz
|
||||
setFrequency(1000000); ///< 1MHz
|
||||
SPI1U = SPIUMOSI | SPIUDUPLEX | SPIUSSE;
|
||||
SPI1U1 = (7 << SPILMOSI) | (7 << SPILMISO);
|
||||
SPI1C1 = 0;
|
||||
@ -45,35 +57,155 @@ void SPIClass::end() {
|
||||
}
|
||||
|
||||
void SPIClass::beginTransaction(SPISettings settings) {
|
||||
setClockDivider(settings._clock);
|
||||
setFrequency(settings._clock);
|
||||
setBitOrder(settings._bitOrder);
|
||||
setDataMode(settings._dataMode);
|
||||
}
|
||||
|
||||
void SPIClass::endTransaction() {}
|
||||
void SPIClass::endTransaction() {
|
||||
}
|
||||
|
||||
void SPIClass::setDataMode(uint8_t dataMode) {
|
||||
|
||||
/**
|
||||
SPI_MODE0 0x00 - CPOL: 0 CPHA: 0
|
||||
SPI_MODE1 0x01 - CPOL: 0 CPHA: 1
|
||||
SPI_MODE2 0x10 - CPOL: 1 CPHA: 0
|
||||
SPI_MODE3 0x11 - CPOL: 1 CPHA: 1
|
||||
*/
|
||||
|
||||
bool CPOL = (dataMode & 0x10); ///< CPOL (Clock Polarity)
|
||||
bool CPHA = (dataMode & 0x01); ///< CPHA (Clock Phase)
|
||||
|
||||
if(CPHA) {
|
||||
SPI1U |= (SPIUSME);
|
||||
} else {
|
||||
SPI1U &= ~(SPIUSME);
|
||||
}
|
||||
|
||||
if(CPOL) {
|
||||
//todo How set CPOL???
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SPIClass::setBitOrder(uint8_t bitOrder) {
|
||||
if (bitOrder == MSBFIRST) {
|
||||
if(bitOrder == MSBFIRST) {
|
||||
SPI1C &= ~(SPICWBO | SPICRBO);
|
||||
} else {
|
||||
SPI1C |= (SPICWBO | SPICRBO);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* calculate the Frequency based on the register value
|
||||
* @param reg
|
||||
* @return
|
||||
*/
|
||||
static uint32_t ClkRegToFreq(spiClk_t * reg) {
|
||||
return (F_CPU / ((reg->regPre + 1) * (reg->regN + 1)));
|
||||
}
|
||||
|
||||
void SPIClass::setFrequency(uint32_t freq) {
|
||||
static uint32_t lastSetFrequency = 0;
|
||||
static uint32_t lastSetRegister = 0;
|
||||
|
||||
if(freq >= F_CPU) {
|
||||
setClockDivider(0x80000000);
|
||||
return;
|
||||
}
|
||||
|
||||
if(lastSetFrequency == freq && lastSetRegister == SPI1CLK) {
|
||||
// do nothing (speed optimization)
|
||||
return;
|
||||
}
|
||||
|
||||
const spiClk_t minFreqReg = { 0x7FFFF000 };
|
||||
uint32_t minFreq = ClkRegToFreq((spiClk_t*) &minFreqReg);
|
||||
if(freq < minFreq) {
|
||||
// use minimum possible clock
|
||||
setClockDivider(minFreqReg.regValue);
|
||||
lastSetRegister = SPI1CLK;
|
||||
lastSetFrequency = freq;
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t calN = 1;
|
||||
|
||||
spiClk_t bestReg = { 0 };
|
||||
int32_t bestFreq = 0;
|
||||
|
||||
// find the best match
|
||||
while(calN <= 0x3F) { // 0x3F max for N
|
||||
|
||||
spiClk_t reg = { 0 };
|
||||
int32_t calFreq;
|
||||
int32_t calPre;
|
||||
int8_t calPreVari = -2;
|
||||
|
||||
reg.regN = calN;
|
||||
|
||||
while(calPreVari++ <= 1) { // test different variants for Pre (we calculate in int so we miss the decimals, testing is the easyest and fastest way)
|
||||
calPre = (((F_CPU / (reg.regN + 1)) / freq) - 1) + calPreVari;
|
||||
if(calPre > 0x1FFF) {
|
||||
reg.regPre = 0x1FFF; // 8191
|
||||
} else if(calPre <= 0) {
|
||||
reg.regPre = 0;
|
||||
} else {
|
||||
reg.regPre = calPre;
|
||||
}
|
||||
|
||||
reg.regL = ((reg.regN + 1) / 2);
|
||||
// reg.regH = (reg.regN - reg.regL);
|
||||
|
||||
// test calculation
|
||||
calFreq = ClkRegToFreq(®);
|
||||
//os_printf("-----[0x%08X][%d]\t EQU: %d\t Pre: %d\t N: %d\t H: %d\t L: %d = %d\n", reg.regValue, freq, reg.regEQU, reg.regPre, reg.regN, reg.regH, reg.regL, calFreq);
|
||||
|
||||
if(calFreq == (int32_t) freq) {
|
||||
// accurate match use it!
|
||||
memcpy(&bestReg, ®, sizeof(bestReg));
|
||||
break;
|
||||
} else if(calFreq < (int32_t) freq) {
|
||||
// never go over the requested frequency
|
||||
if(abs(freq - calFreq) < abs(freq - bestFreq)) {
|
||||
bestFreq = calFreq;
|
||||
memcpy(&bestReg, ®, sizeof(bestReg));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(calFreq == (int32_t) freq) {
|
||||
// accurate match use it!
|
||||
break;
|
||||
}
|
||||
calN++;
|
||||
}
|
||||
|
||||
// os_printf("[0x%08X][%d]\t EQU: %d\t Pre: %d\t N: %d\t H: %d\t L: %d\t - Real Frequency: %d\n", bestReg.regValue, freq, bestReg.regEQU, bestReg.regPre, bestReg.regN, bestReg.regH, bestReg.regL, ClkRegToFreq(&bestReg));
|
||||
|
||||
setClockDivider(bestReg.regValue);
|
||||
lastSetRegister = SPI1CLK;
|
||||
lastSetFrequency = freq;
|
||||
|
||||
}
|
||||
|
||||
void SPIClass::setClockDivider(uint32_t clockDiv) {
|
||||
if(clockDiv == 0x80000000) {
|
||||
GPMUX |= (1 << 9); // Set bit 9 if sysclock required
|
||||
} else {
|
||||
GPMUX &= ~(1 << 9);
|
||||
}
|
||||
SPI1CLK = clockDiv;
|
||||
}
|
||||
|
||||
uint8_t SPIClass::transfer(uint8_t data) {
|
||||
while(SPI1CMD & SPIBUSY);
|
||||
while(SPI1CMD & SPIBUSY)
|
||||
;
|
||||
SPI1W0 = data;
|
||||
SPI1CMD |= SPIBUSY;
|
||||
while(SPI1CMD & SPIBUSY);
|
||||
return (uint8_t)(SPI1W0 & 0xff);
|
||||
while(SPI1CMD & SPIBUSY)
|
||||
;
|
||||
return (uint8_t) (SPI1W0 & 0xff);
|
||||
}
|
||||
|
||||
uint16_t SPIClass::transfer16(uint16_t data) {
|
||||
|
@ -24,16 +24,12 @@
|
||||
#include <Arduino.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define FCPU80 80000000L
|
||||
#define SPI_HAS_TRANSACTION
|
||||
|
||||
#if F_CPU == FCPU80
|
||||
#define SPI_CLOCK_DIV80M 0x80000000 //80 MHz
|
||||
#define SPI_CLOCK_DIV40M 0x00001001 //40 MHz
|
||||
#define SPI_CLOCK_DIV20M 0x00041001 //20 MHz
|
||||
#define SPI_CLOCK_DIV16M 0x000fffc0 //16 MHz
|
||||
#define SPI_CLOCK_DIV10M 0x000c1001 //10 MHz
|
||||
// This defines are not representing the real Divider of the ESP8266
|
||||
// the Defines match to an AVR Arduino on 16MHz for better compatibility
|
||||
#if F_CPU == 80000000L
|
||||
#define SPI_CLOCK_DIV2 0x00101001 //8 MHz
|
||||
#define SPI_CLOCK_DIV5M 0x001c1001 //5 MHz
|
||||
#define SPI_CLOCK_DIV4 0x00241001 //4 MHz
|
||||
#define SPI_CLOCK_DIV8 0x004c1001 //2 MHz
|
||||
#define SPI_CLOCK_DIV16 0x009c1001 //1 MHz
|
||||
@ -41,13 +37,6 @@
|
||||
#define SPI_CLOCK_DIV64 0x027c1001 //250 KHz
|
||||
#define SPI_CLOCK_DIV128 0x04fc1001 //125 KHz
|
||||
#else
|
||||
#define SPI_CLOCK_DIV160M 0x80000000 //160 MHz
|
||||
#define SPI_CLOCK_DIV80M 0x00001001 //80 MHz
|
||||
#define SPI_CLOCK_DIV40M 0x00041001 //40 MHz
|
||||
#define SPI_CLOCK_DIV32M 0x000fffc0 //32 MHz
|
||||
#define SPI_CLOCK_DIV20M 0x000c1001 //20 MHz
|
||||
#define SPI_CLOCK_DIV16M 0x00101001 //16 MHz
|
||||
#define SPI_CLOCK_DIV10M 0x001c1001 //10 MHz
|
||||
#define SPI_CLOCK_DIV2 0x00241001 //8 MHz
|
||||
#define SPI_CLOCK_DIV4 0x004c1001 //4 MHz
|
||||
#define SPI_CLOCK_DIV8 0x009c1001 //2 MHz
|
||||
@ -56,14 +45,14 @@
|
||||
#define SPI_CLOCK_DIV64 0x04fc1001 //250 KHz
|
||||
#endif
|
||||
|
||||
const uint8_t SPI_MODE0 = 0x00;
|
||||
const uint8_t SPI_MODE1 = 0x04;
|
||||
const uint8_t SPI_MODE2 = 0x08;
|
||||
const uint8_t SPI_MODE3 = 0x0C;
|
||||
const uint8_t SPI_MODE0 = 0x00; ///< CPOL: 0 CPHA: 0
|
||||
const uint8_t SPI_MODE1 = 0x01; ///< CPOL: 0 CPHA: 1
|
||||
const uint8_t SPI_MODE2 = 0x10; ///< CPOL: 1 CPHA: 0
|
||||
const uint8_t SPI_MODE3 = 0x11; ///< CPOL: 1 CPHA: 1
|
||||
|
||||
class SPISettings {
|
||||
public:
|
||||
SPISettings() :_clock(SPI_CLOCK_DIV16), _bitOrder(LSBFIRST), _dataMode(SPI_MODE0){}
|
||||
SPISettings() :_clock(1000000), _bitOrder(LSBFIRST), _dataMode(SPI_MODE0){}
|
||||
SPISettings(uint32_t clock, uint8_t bitOrder, uint8_t dataMode) :_clock(clock), _bitOrder(bitOrder), _dataMode(dataMode){}
|
||||
uint32_t _clock;
|
||||
uint8_t _bitOrder;
|
||||
@ -77,6 +66,7 @@ public:
|
||||
void end();
|
||||
void setBitOrder(uint8_t bitOrder);
|
||||
void setDataMode(uint8_t dataMode);
|
||||
void setFrequency(uint32_t freq);
|
||||
void setClockDivider(uint32_t clockDiv);
|
||||
void beginTransaction(SPISettings settings);
|
||||
uint8_t transfer(uint8_t data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user