dunno, changes and stuff
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,6 +1,7 @@
|
|||||||
*.pdf
|
*.pdf
|
||||||
*.PDF
|
*.PDF
|
||||||
*.tar.gz
|
*.tar.gz
|
||||||
|
*.ttf
|
||||||
|
|
||||||
build-*
|
build-*
|
||||||
a.out
|
a.out
|
||||||
|
|||||||
19
Debug.h
19
Debug.h
@@ -62,11 +62,12 @@ private:
|
|||||||
|
|
||||||
#if IS_DESKTOP
|
#if IS_DESKTOP
|
||||||
printf(buf);
|
printf(buf);
|
||||||
#elif TEENSY
|
#elif IS_TEENSY
|
||||||
Serial.print(buf);
|
Serial.print(buf);
|
||||||
#elif ESP8266
|
#elif IS_ESP8266
|
||||||
os_printf(buf);
|
//os_printf(buf);
|
||||||
#elif ESP32
|
printf(buf);
|
||||||
|
#elif IS_ESP32
|
||||||
printf(buf);
|
printf(buf);
|
||||||
#else
|
#else
|
||||||
#error "unsupported platform"
|
#error "unsupported platform"
|
||||||
@@ -82,7 +83,7 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
#if (!defined(DEBUG))
|
#if (!defined(DEBUG))
|
||||||
|
|
||||||
// #define debug(str)
|
// #define debug(str)
|
||||||
@@ -101,7 +102,8 @@ private:
|
|||||||
|
|
||||||
// #warning "not using debug output"
|
// #warning "not using debug output"
|
||||||
|
|
||||||
#elif ESP8266
|
|
||||||
|
#elif IS_ESP8266
|
||||||
|
|
||||||
#define debug(str) os_printf(str)
|
#define debug(str) os_printf(str)
|
||||||
#define debugMod(module, str) os_printf("[%s] %s\n", module, str)
|
#define debugMod(module, str) os_printf("[%s] %s\n", module, str)
|
||||||
@@ -124,7 +126,7 @@ private:
|
|||||||
os_printf("\n");
|
os_printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif ESP32
|
#elif IS_ESP32
|
||||||
|
|
||||||
#ifndef CONFIG_LOG_DEFAULT_LEVEL
|
#ifndef CONFIG_LOG_DEFAULT_LEVEL
|
||||||
#define CONFIG_LOG_DEFAULT_LEVEL 3
|
#define CONFIG_LOG_DEFAULT_LEVEL 3
|
||||||
@@ -144,7 +146,7 @@ private:
|
|||||||
#define IF_DEBUG(a) a
|
#define IF_DEBUG(a) a
|
||||||
#define debugShow(buf, len) hexdump(buf,len)
|
#define debugShow(buf, len) hexdump(buf,len)
|
||||||
|
|
||||||
#elif TEENSY
|
#elif IS_TEENSY
|
||||||
|
|
||||||
#define debugMod(module, str) {char buf[64]; sprintf(buf, "i[%-10s] ", module); Serial.print(buf); Serial.println(str);}
|
#define debugMod(module, str) {char buf[64]; sprintf(buf, "i[%-10s] ", module); Serial.print(buf); Serial.println(str);}
|
||||||
#define debugMod1(module, str, v1) {char buf[64]; sprintf(buf, "i[%-10s] ", module); Serial.print(buf); sprintf(buf, str, v1); Serial.println(buf);}
|
#define debugMod1(module, str, v1) {char buf[64]; sprintf(buf, "i[%-10s] ", module); Serial.print(buf); sprintf(buf, str, v1); Serial.println(buf);}
|
||||||
@@ -162,5 +164,6 @@ private:
|
|||||||
#error "unsupported platform"
|
#error "unsupported platform"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
#endif // DEBUG_H
|
#endif // DEBUG_H
|
||||||
|
|||||||
29
Platforms.h
29
Platforms.h
@@ -25,24 +25,24 @@
|
|||||||
|
|
||||||
#if (IS_ESP32)
|
#if (IS_ESP32)
|
||||||
|
|
||||||
#pragma message "Using ESP32"
|
//#pragma message "Using ESP32"
|
||||||
#define DELAY_US(us) ets_delay_us(us)
|
#define DELAY_US(us) ets_delay_us(us)
|
||||||
#define IN_FLASH
|
#define IN_FLASH
|
||||||
|
|
||||||
#elif (IS_ESP8266)
|
#elif (IS_ESP8266)
|
||||||
|
|
||||||
#pragma message "Using ESP8266"
|
//#pragma message "Using ESP8266"
|
||||||
#define DELAY_US(us) os_delay_us(us)
|
#define DELAY_US(us) os_delay_us(us)
|
||||||
#define IN_FLASH ICACHE_FLASH_ATTR
|
#define IN_FLASH ICACHE_FLASH_ATTR
|
||||||
|
|
||||||
#elif (IS_TEENSY)
|
#elif (IS_TEENSY)
|
||||||
|
|
||||||
#pragma message "Using Teensy"
|
//#pragma message "Using Teensy"
|
||||||
#define DELAY_MS(ms) delay(ms)
|
#define DELAY_MS(ms) delay(ms)
|
||||||
|
|
||||||
#elif (IS_DESKTOP)
|
#elif (IS_DESKTOP)
|
||||||
|
|
||||||
#pragma message "Using Desktop"
|
//#pragma message "Using Desktop"
|
||||||
#define DELAY_MS(ms) delay(ms)
|
#define DELAY_MS(ms) delay(ms)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@@ -62,21 +62,22 @@
|
|||||||
// return (a>b) ? (a) : (b);
|
// return (a>b) ? (a) : (b);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
#if ESP8266
|
#if IS_ESP8266
|
||||||
#define sprintf os_sprintf
|
#define sprintf os_sprintf
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "ets_sys.h"
|
// #include "ets_sys.h"
|
||||||
#include "c_types.h"
|
// #include "c_types.h"
|
||||||
#include "osapi.h"
|
// #include "osapi.h"
|
||||||
#include "user_interface.h"
|
// #include "user_interface.h"
|
||||||
#include "mem.h"
|
// #include "mem.h"
|
||||||
#include "espconn.h"
|
// #include "espconn.h"
|
||||||
|
#include "esp_system.h"
|
||||||
}
|
}
|
||||||
#elif ESP32
|
#elif IS_ESP32
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TEENSY
|
#if IS_TEENSY
|
||||||
#define IRAM_ATTR
|
#define IRAM_ATTR
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef COLOR_H
|
#ifndef ESP_COLOR_H
|
||||||
#define COLOR_H
|
#define ESP_COLOR_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -113,4 +113,4 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // COLOR_H
|
#endif // ESP_COLOR_H
|
||||||
|
|||||||
@@ -6,19 +6,22 @@
|
|||||||
#include "../../Debug.h"
|
#include "../../Debug.h"
|
||||||
#include "../../io/GPIO.h"
|
#include "../../io/GPIO.h"
|
||||||
|
|
||||||
|
#include <xtensa/xtruntime.h>
|
||||||
|
|
||||||
|
|
||||||
#if ESP8266
|
#if IS_ESP8266
|
||||||
|
|
||||||
#include "../../io/fastGPIO.h"
|
// https://github.com/FastLED/FastLED/tree/master/src/platforms/esp/8266
|
||||||
|
|
||||||
|
#include "../../io/GPIO.h"
|
||||||
|
|
||||||
template <int numLEDs> class WS2812B {
|
template <int numLEDs> class WS2812B {
|
||||||
|
|
||||||
static constexpr const char* NAME = "WS2812B";
|
static constexpr const char* NAME = "WS2812B";
|
||||||
|
|
||||||
#define LED_SET_PIN_TO_OUTPUT GPIO5_OUTPUT_SET
|
#define LED_SET_PIN_TO_OUTPUT MyGPIO::setOutput(5) //GPIO5_OUTPUT_SET
|
||||||
#define LED_SET_PIN_H GPIO5_H
|
#define LED_SET_PIN_H MyGPIO::set(5) //GPIO5_H
|
||||||
#define LED_SET_PIN_L GPIO5_L
|
#define LED_SET_PIN_L MyGPIO::clear(5) //GPIO5_L
|
||||||
|
|
||||||
//#define NS_PER_TICK ( (1000ul*1000ul*1000ul) / (80ul*1000ul*1000ul) )
|
//#define NS_PER_TICK ( (1000ul*1000ul*1000ul) / (80ul*1000ul*1000ul) )
|
||||||
|
|
||||||
@@ -37,7 +40,7 @@
|
|||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
LED_SET_PIN_TO_OUTPUT;
|
LED_SET_PIN_TO_OUTPUT;
|
||||||
debugMod1(NAME, "init with %d leds", numLEDs);
|
Log::addInfo(NAME, "init with %d leds", numLEDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** set the color for the given LED */
|
/** set the color for the given LED */
|
||||||
@@ -74,12 +77,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** flush configured changes */
|
/** flush configured changes */
|
||||||
void flush() {
|
IRAM_ATTR void flush() {
|
||||||
|
|
||||||
LED_SET_PIN_TO_OUTPUT;
|
//LED_SET_PIN_TO_OUTPUT;
|
||||||
|
|
||||||
ets_intr_lock();
|
|
||||||
|
|
||||||
|
//ets_intr_lock();
|
||||||
|
//taskENTER_CRITICAL();
|
||||||
|
//taskDISABLE_INTERRUPTS();
|
||||||
|
//const uint32_t saved = XTOS_DISABLE_ALL_INTERRUPTS;
|
||||||
|
vPortETSIntrLock();
|
||||||
|
|
||||||
// process each LED
|
// process each LED
|
||||||
for (int i = 0; i < numLEDs; ++i) {
|
for (int i = 0; i < numLEDs; ++i) {
|
||||||
|
|
||||||
@@ -97,19 +104,29 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ets_intr_unlock();
|
//ets_intr_unlock();
|
||||||
|
//taskEXIT_CRITICAL();
|
||||||
|
//XTOS_RESTORE_INTLEVEL(saved);
|
||||||
|
vPortETSIntrUnlock();
|
||||||
|
//taskENABLE_INTERRUPTS();
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** flush configured changes, including global brightness */
|
/** flush configured changes, including global brightness */
|
||||||
void flushBrightness(const uint8_t brightness) {
|
IRAM_ATTR void flushBrightness(const uint8_t brightness) {
|
||||||
|
|
||||||
LED_SET_PIN_TO_OUTPUT;
|
//LED_SET_PIN_TO_OUTPUT;
|
||||||
|
|
||||||
ets_intr_lock();
|
|
||||||
|
|
||||||
|
//ets_intr_lock();
|
||||||
|
//taskENTER_CRITICAL();
|
||||||
|
taskDISABLE_INTERRUPTS();
|
||||||
|
//const uint32_t saved = XTOS_DISABLE_ALL_INTERRUPTS;
|
||||||
|
//vPortETSIntrLock();
|
||||||
|
|
||||||
// process each LED
|
// process each LED
|
||||||
for (int i = 0; i < numLEDs; ++i) {
|
for (int i = 0; i < numLEDs; ++i) {
|
||||||
|
|
||||||
@@ -127,122 +144,79 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ets_intr_unlock();
|
//ets_intr_unlock();
|
||||||
|
taskENABLE_INTERRUPTS();
|
||||||
|
//taskEXIT_CRITICAL();
|
||||||
|
//XTOS_RESTORE_INTLEVEL(saved);
|
||||||
|
//vPortETSIntrUnlock();
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
inline void sendByte(uint8_t b) {
|
IRAM_ATTR void sendByte(uint8_t b) {
|
||||||
// for (uint8_t i = 0; i < 8; ++i) {
|
//if (b & 0b10000000) {send1();} else {send0();}
|
||||||
// if (b & 0b10000000) {
|
//if (b & 0b01000000) {send1();} else {send0();}
|
||||||
// send1();
|
//if (b & 0b00100000) {send1();} else {send0();}
|
||||||
// } else {
|
//if (b & 0b00010000) {send1();} else {send0();}
|
||||||
// send0();
|
//if (b & 0b00001000) {send1();} else {send0();}
|
||||||
// }
|
//if (b & 0b00000100) {send1();} else {send0();}
|
||||||
// b <<= 1;
|
//if (b & 0b00000010) {send1();} else {send0();}
|
||||||
// }
|
//if (b & 0b00000001) {send1();} else {send0();}
|
||||||
if (b & 0b10000000) {send1();} else {send0();}
|
for (uint8_t i = 0; i < 8; ++i) {
|
||||||
if (b & 0b01000000) {send1();} else {send0();}
|
if (b & 0b10000000) {send1();} else {send0();}
|
||||||
if (b & 0b00100000) {send1();} else {send0();}
|
b <<= 1;
|
||||||
if (b & 0b00010000) {send1();} else {send0();}
|
}
|
||||||
if (b & 0b00001000) {send1();} else {send0();}
|
|
||||||
if (b & 0b00000100) {send1();} else {send0();}
|
|
||||||
if (b & 0b00000010) {send1();} else {send0();}
|
|
||||||
if (b & 0b00000001) {send1();} else {send0();}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((always_inline)) inline void send1() { // 800ns high, 450ns low
|
// @80 MHz one instruction = 12.5ns
|
||||||
|
// @160 MHz one instruction = 6.25ns
|
||||||
|
|
||||||
|
__attribute__((always_inline)) void send1() { // 800ns high, 450ns low
|
||||||
LED_SET_PIN_H;
|
LED_SET_PIN_H;
|
||||||
delay800();
|
delayL();
|
||||||
LED_SET_PIN_L;
|
LED_SET_PIN_L;
|
||||||
delay100();
|
delayS();
|
||||||
|
//const uint32_t tmp = soc_get_ccount();
|
||||||
|
//LED_SET_PIN_H;
|
||||||
|
//while(soc_get_ccount() - tmp < 144) {}
|
||||||
|
//LED_SET_PIN_L;
|
||||||
|
//while(soc_get_ccount() - tmp < 192-24) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((always_inline)) inline void send0() { // 400ns high, 850ns low
|
__attribute__((always_inline)) void send0() { // 400ns high, 850ns low
|
||||||
LED_SET_PIN_H;
|
LED_SET_PIN_H;
|
||||||
delay100();
|
delayS();
|
||||||
LED_SET_PIN_L;
|
LED_SET_PIN_L;
|
||||||
delay800();
|
delayL();
|
||||||
|
//const uint32_t tmp = soc_get_ccount();
|
||||||
|
//LED_SET_PIN_H;
|
||||||
|
//while(soc_get_ccount() - tmp < 48) {}
|
||||||
|
//LED_SET_PIN_L;
|
||||||
|
//while(soc_get_ccount() - tmp < 192-24) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((always_inline)) inline void reset() {
|
__attribute__((always_inline)) void reset() {
|
||||||
LED_SET_PIN_L;
|
LED_SET_PIN_L; // low for more than 50 us
|
||||||
os_delay_us(50);
|
//const uint32_t tmp = soc_get_ccount();
|
||||||
|
//while(soc_get_ccount() - tmp < 9999) {}
|
||||||
|
//os_delay_us(100);
|
||||||
|
//LED_SET_PIN_H;
|
||||||
|
//asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");
|
||||||
|
//LED_SET_PIN_L;
|
||||||
//delayMicroseconds(50);
|
//delayMicroseconds(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__attribute__((always_inline)) void delayS() {
|
||||||
//#pragma GCC optimize 0
|
for(uint8_t i = 0; i < (9*1); ++i) {asm("nop");}
|
||||||
|
|
||||||
__attribute__((always_inline)) inline void delay50() {
|
|
||||||
asm volatile("nop");
|
|
||||||
asm volatile("nop");
|
|
||||||
asm volatile("nop");
|
|
||||||
asm volatile("nop");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__attribute__((always_inline)) void delayL() {
|
||||||
// 100 ns delay. @80 MHz one nop = 12,5ns
|
for(uint8_t i = 0; i < (9*2); ++i) {asm("nop");}
|
||||||
__attribute__((always_inline)) inline void delay100() {
|
|
||||||
delay50();
|
|
||||||
delay50();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
__attribute__((always_inline)) inline void delay200() {
|
|
||||||
delay100();
|
|
||||||
delay100();
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((always_inline)) inline void delay400() {
|
|
||||||
delay100();
|
|
||||||
delay100();
|
|
||||||
delay100();
|
|
||||||
delay100();
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((always_inline)) inline void delay500() {
|
|
||||||
delay100();
|
|
||||||
delay100();
|
|
||||||
delay100();
|
|
||||||
delay100();
|
|
||||||
delay100();
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((always_inline)) inline void delay600() {
|
|
||||||
delay100();
|
|
||||||
delay100();
|
|
||||||
delay100();
|
|
||||||
delay100();
|
|
||||||
delay100();
|
|
||||||
delay100();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
__attribute__((always_inline)) inline void delay800() {
|
|
||||||
delay100();
|
|
||||||
delay100();
|
|
||||||
delay100();
|
|
||||||
delay100();
|
|
||||||
delay100();
|
|
||||||
delay100();
|
|
||||||
delay100();
|
|
||||||
delay100();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// #pragma GCC reset_options
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// inline void delayNS(const uint16_t ns) {
|
|
||||||
// const uint16_t ticks = ns / NS_PER_TICK / 2;
|
|
||||||
// for (uint16_t i = 0; i < ticks; ++i) {asm("nop");}
|
|
||||||
// }
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#elif false// ESP32aaa
|
#elif false// ESP32aaa
|
||||||
@@ -452,7 +426,7 @@
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#elif ESP32
|
#elif IS_ESP32
|
||||||
|
|
||||||
#include "../../io/I2S.h"
|
#include "../../io/I2S.h"
|
||||||
|
|
||||||
@@ -474,7 +448,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
debugMod1(TAG, "init with %d leds", NUM_LEDS);
|
Log::addInfo(TAG, "init with %d leds", NUM_LEDS);
|
||||||
cfg();
|
cfg();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
228
ext/led/WS2812B_v2.h
Normal file
228
ext/led/WS2812B_v2.h
Normal file
@@ -0,0 +1,228 @@
|
|||||||
|
#ifndef WS2812B_H
|
||||||
|
#define WS2812B_H
|
||||||
|
|
||||||
|
#include "../../data/Color.h"
|
||||||
|
#include "../../Platforms.h"
|
||||||
|
#include "../../Debug.h"
|
||||||
|
#include "../../io/GPIO.h"
|
||||||
|
|
||||||
|
#include <xtensa/xtruntime.h>
|
||||||
|
|
||||||
|
|
||||||
|
#if IS_ESP8266
|
||||||
|
|
||||||
|
// https://github.com/FastLED/FastLED/tree/master/src/platforms/esp/8266
|
||||||
|
|
||||||
|
//#include "../../io/fastGPIO.h"
|
||||||
|
#include "../../io/GPIO.h"
|
||||||
|
#include "driver/i2s.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
template <int numLEDs> class WS2812B {
|
||||||
|
|
||||||
|
static constexpr const char* NAME = "WS2812B";
|
||||||
|
|
||||||
|
#define LED_SET_PIN_TO_OUTPUT MyGPIO::setOutput(5) //GPIO5_OUTPUT_SET
|
||||||
|
#define LED_SET_PIN_H MyGPIO::set(5) //GPIO5_H
|
||||||
|
#define LED_SET_PIN_L MyGPIO::clear(5) //GPIO5_L
|
||||||
|
|
||||||
|
//#define NS_PER_TICK ( (1000ul*1000ul*1000ul) / (80ul*1000ul*1000ul) )
|
||||||
|
|
||||||
|
/** color-value for each attached LED */
|
||||||
|
Color colors[numLEDs];
|
||||||
|
|
||||||
|
/** enable/disable each led */
|
||||||
|
bool enabled[numLEDs] = {true};
|
||||||
|
|
||||||
|
static constexpr const int bits = 16;
|
||||||
|
static constexpr const i2s_port_t I2S_NUM = (i2s_port_t)0;
|
||||||
|
static constexpr const int SAMPLE_RATE = 44100; // 100000
|
||||||
|
|
||||||
|
class SendBuffer {
|
||||||
|
|
||||||
|
uint32_t buf[numLEDs * 3 + 32];
|
||||||
|
int idx = 0;
|
||||||
|
|
||||||
|
i2s_config_t i2s_config;
|
||||||
|
i2s_pin_config_t pin_config;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
SendBuffer() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void init() {
|
||||||
|
|
||||||
|
Log::addInfo("i2s", "init()");
|
||||||
|
memset(&i2s_config, 0, sizeof(i2s_config));
|
||||||
|
i2s_config.mode = (i2s_mode_t) (I2S_MODE_MASTER | I2S_MODE_TX); // Only TX
|
||||||
|
i2s_config.sample_rate = SAMPLE_RATE;
|
||||||
|
i2s_config.bits_per_sample = (i2s_bits_per_sample_t)16; // 16 bit
|
||||||
|
i2s_config.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT; // 2-channels
|
||||||
|
i2s_config.communication_format = (i2s_comm_format_t) (I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB);
|
||||||
|
i2s_config.dma_buf_count = 6;
|
||||||
|
i2s_config.dma_buf_len = 256;
|
||||||
|
|
||||||
|
memset(&pin_config, 0, sizeof(pin_config));
|
||||||
|
pin_config.bck_o_en = 1;
|
||||||
|
pin_config.ws_o_en = 2;
|
||||||
|
pin_config.data_out_en = 15; // 5
|
||||||
|
|
||||||
|
ESP_ERROR_CHECK(i2s_driver_install(I2S_NUM, &i2s_config, 0, nullptr));
|
||||||
|
ESP_ERROR_CHECK(i2s_set_pin(I2S_NUM, &pin_config));
|
||||||
|
//ESP_ERROR_CHECK(i2s_set_clk(I2S_NUM, SAMPLE_RATE, (i2s_bits_per_sample_t)16, (i2s_channel_t)2));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void reset() {
|
||||||
|
idx = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void add(uint8_t b) {
|
||||||
|
buf[idx] = encode(b);
|
||||||
|
++idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
void transmit() {
|
||||||
|
|
||||||
|
size_t written = 0;
|
||||||
|
size_t bytes = 512;//sizeof(uint32_t) * idx + 20+512;
|
||||||
|
ESP_ERROR_CHECK(i2s_write(I2S_NUM, buf, bytes, &written, 100));
|
||||||
|
Log::addInfo("I2s", "transmit %d %d", bytes, written);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** byte -> i2s transmission pattern */
|
||||||
|
uint32_t encode(uint8_t b) {
|
||||||
|
|
||||||
|
#define _LO 0b1000
|
||||||
|
#define _HI 0b1110
|
||||||
|
uint32_t res;
|
||||||
|
uint8_t* tmp = (uint8_t*) &res;
|
||||||
|
tmp[0] = (((b & (1<<7)) ? (_HI) : (_LO)) << 4) | (((b & (1<<6)) ? (_HI) : (_LO)) << 0);
|
||||||
|
tmp[1] = (((b & (1<<5)) ? (_HI) : (_LO)) << 4) | (((b & (1<<4)) ? (_HI) : (_LO)) << 0);
|
||||||
|
tmp[2] = (((b & (1<<3)) ? (_HI) : (_LO)) << 4) | (((b & (1<<2)) ? (_HI) : (_LO)) << 0);
|
||||||
|
tmp[3] = (((b & (1<<1)) ? (_HI) : (_LO)) << 4) | (((b & (1<<0)) ? (_HI) : (_LO)) << 0);
|
||||||
|
return res;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} sendBuf;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/** ctor */
|
||||||
|
WS2812B() {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
void init() {
|
||||||
|
LED_SET_PIN_TO_OUTPUT;
|
||||||
|
Log::addInfo(NAME, "init with %d leds", numLEDs);
|
||||||
|
}
|
||||||
|
|
||||||
|
void init2() {
|
||||||
|
sendBuf.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** set the color for the given LED */
|
||||||
|
void setColor(const uint8_t idx, const Color rgb) {
|
||||||
|
colors[idx] = rgb;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** set the color for all LEDs */
|
||||||
|
void setColor(const Color rgb) {
|
||||||
|
for (int idx = 0; idx < numLEDs; ++idx) {
|
||||||
|
colors[idx] = rgb;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** enable/disable the given LED */
|
||||||
|
void setEnabled(const uint8_t idx, const bool en) {
|
||||||
|
enabled[idx] = en;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** enable/disable all LEDs */
|
||||||
|
void setEnabled(const bool en) {
|
||||||
|
for (int idx = 0; idx < numLEDs; ++idx) {
|
||||||
|
enabled[idx] = en;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** is the given LED enabled? */
|
||||||
|
bool isEnabled(const uint8_t idx) const {
|
||||||
|
return enabled[idx];
|
||||||
|
}
|
||||||
|
|
||||||
|
Color& getColor(const uint8_t idx) {
|
||||||
|
return colors[idx];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** flush configured changes */
|
||||||
|
IRAM_ATTR void flush() {
|
||||||
|
|
||||||
|
sendBuf.reset();
|
||||||
|
|
||||||
|
// process each LED
|
||||||
|
for (uint16_t i = 0; i < numLEDs; ++i) {
|
||||||
|
|
||||||
|
// send each LEDs 24-bit GRB data
|
||||||
|
if (enabled[i]) {
|
||||||
|
const Color rgb = colors[i];
|
||||||
|
sendBuf.add(rgb.g);
|
||||||
|
sendBuf.add(rgb.r);
|
||||||
|
sendBuf.add(rgb.b);
|
||||||
|
} else {
|
||||||
|
sendBuf.add(0);
|
||||||
|
sendBuf.add(0);
|
||||||
|
sendBuf.add(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sendBuf.transmit();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/** flush configured changes, including global brightness */
|
||||||
|
IRAM_ATTR void flushBrightness(const uint8_t brightness) {
|
||||||
|
|
||||||
|
sendBuf.reset();
|
||||||
|
|
||||||
|
// process each LED
|
||||||
|
for (uint16_t i = 0; i < numLEDs; ++i) {
|
||||||
|
|
||||||
|
// send each LEDs 24-bit GRB data
|
||||||
|
if (enabled[i]) {
|
||||||
|
const Color rgb = colors[i].brightness(brightness);
|
||||||
|
sendBuf.add(rgb.g);
|
||||||
|
sendBuf.add(rgb.r);
|
||||||
|
sendBuf.add(rgb.b);
|
||||||
|
} else {
|
||||||
|
sendBuf.add(0);
|
||||||
|
sendBuf.add(0);
|
||||||
|
sendBuf.add(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sendBuf.transmit();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // WS2812B_H
|
||||||
82
io/GPIO.h
82
io/GPIO.h
@@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
#if IS_ESP8266
|
#if IS_ESP8266
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
#include "fastGPIO.h"
|
#include "fastGPIO.h"
|
||||||
|
|
||||||
struct MyGPIO {
|
struct MyGPIO {
|
||||||
@@ -93,6 +95,86 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "driver/gpio.h"
|
||||||
|
#include "esp8266/gpio_struct.h"
|
||||||
|
|
||||||
|
struct MyGPIO {
|
||||||
|
|
||||||
|
static inline bool get(const uint8_t num) {
|
||||||
|
return get((gpio_num_t)num);
|
||||||
|
}
|
||||||
|
static inline bool get(const gpio_num_t num) {
|
||||||
|
return gpio_get_level(num); // TODO faster access like READ_PERI_REG??
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T> static inline void setOrClear(const uint8_t num, const T val) {
|
||||||
|
if (val) {set(num);} else {clear(num);}
|
||||||
|
//WRITE_PERI_REG(GPIO_OUT_W1TS_REG, (val != 0) << num); // branchless but usually slower
|
||||||
|
//WRITE_PERI_REG(GPIO_OUT_W1TC_REG, (val == 0) << num);
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((always_inline)) static inline void set(const uint8_t num) {
|
||||||
|
//gpio_set_level((gpio_num_t)num, 1); // TODO: faster
|
||||||
|
GPIO.out_w1ts |= (0x1 << num);
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((always_inline)) static inline void clear(const uint8_t num) {
|
||||||
|
//gpio_set_level((gpio_num_t)num, 0); // TODO: faster
|
||||||
|
GPIO.out_w1tc |= (0x1 << num);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void setOutput(const uint8_t num) {
|
||||||
|
setOutput((gpio_num_t)num);
|
||||||
|
}
|
||||||
|
static inline void setOutput(const gpio_num_t num) {
|
||||||
|
//gpio_set_direction(num, GPIO_MODE_OUTPUT); // does not always suffice?!
|
||||||
|
gpio_config_t io_conf;
|
||||||
|
io_conf.intr_type = GPIO_INTR_DISABLE;
|
||||||
|
io_conf.mode = GPIO_MODE_OUTPUT;
|
||||||
|
io_conf.pin_bit_mask = (1<<num);
|
||||||
|
io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
|
||||||
|
io_conf.pull_up_en = GPIO_PULLUP_DISABLE;
|
||||||
|
ESP_ERROR_CHECK(gpio_config(&io_conf));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void setInput(const uint8_t num) {
|
||||||
|
setInput((gpio_num_t)num);
|
||||||
|
}
|
||||||
|
static inline void setInput(const gpio_num_t num) {
|
||||||
|
//gpio_set_direction(num, GPIO_MODE_INPUT); // does not always suffice?!
|
||||||
|
gpio_config_t io_conf;
|
||||||
|
io_conf.intr_type = GPIO_INTR_DISABLE;
|
||||||
|
io_conf.mode = GPIO_MODE_INPUT;
|
||||||
|
io_conf.pin_bit_mask = (1<<num);
|
||||||
|
io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
|
||||||
|
io_conf.pull_up_en = GPIO_PULLUP_DISABLE;
|
||||||
|
ESP_ERROR_CHECK(gpio_config(&io_conf));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void setInputPullUp(const uint8_t num) {
|
||||||
|
setInputPullUp((gpio_num_t)num);
|
||||||
|
}
|
||||||
|
static inline void setInputPullUp(const gpio_num_t num) {
|
||||||
|
gpio_config_t io_conf;
|
||||||
|
io_conf.intr_type = GPIO_INTR_DISABLE;
|
||||||
|
io_conf.mode = GPIO_MODE_INPUT;
|
||||||
|
io_conf.pin_bit_mask = (1<<num);
|
||||||
|
io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
|
||||||
|
io_conf.pull_up_en = GPIO_PULLUP_ENABLE; // here
|
||||||
|
ESP_ERROR_CHECK(gpio_config(&io_conf));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void toggleBuiltInLED() {
|
||||||
|
static bool level = false;
|
||||||
|
setOutput(GPIO_NUM_2);
|
||||||
|
level = !level;
|
||||||
|
if (level) {set(GPIO_NUM_2);} else {clear(GPIO_NUM_2);}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#elif IS_ESP32
|
#elif IS_ESP32
|
||||||
|
|
||||||
|
|||||||
@@ -25,8 +25,10 @@
|
|||||||
#ifndef _ESP8266_FAST_GPIO_H_
|
#ifndef _ESP8266_FAST_GPIO_H_
|
||||||
#define _ESP8266_FAST_GPIO_H_
|
#define _ESP8266_FAST_GPIO_H_
|
||||||
|
|
||||||
#include "eagle_soc.h"
|
//#include "eagle_soc.h"
|
||||||
#include "gpio.h"
|
//#include "gpio.h"
|
||||||
|
#include "esp8266/eagle_soc.h"
|
||||||
|
#include "driver/gpio.h"
|
||||||
|
|
||||||
/* GPIO0 Macros */
|
/* GPIO0 Macros */
|
||||||
#define GPIO0_MUX PERIPHS_IO_MUX_GPIO0_U
|
#define GPIO0_MUX PERIPHS_IO_MUX_GPIO0_U
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <DMAChannel.h>
|
#include <DMAChannel.h>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* base-class for I2S1 and I2S2 when using DMA
|
* base-class for I2S1 and I2S2 when using DMA
|
||||||
|
|||||||
51
net/IP.h
51
net/IP.h
@@ -5,7 +5,8 @@
|
|||||||
|
|
||||||
#define Port uint16_t
|
#define Port uint16_t
|
||||||
|
|
||||||
#if ESP8266
|
|
||||||
|
#if OLD_IS_ESP8266 // RAW
|
||||||
|
|
||||||
struct IP4 {
|
struct IP4 {
|
||||||
|
|
||||||
@@ -13,17 +14,17 @@
|
|||||||
ip_addr_t addr;
|
ip_addr_t addr;
|
||||||
|
|
||||||
/** empty ctor */
|
/** empty ctor */
|
||||||
explicit IP4() {
|
explicit IP4() {
|
||||||
addr.addr = 0;
|
addr.addr = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ctor with IP-string */
|
/** ctor with IP-string */
|
||||||
explicit IP4(const char* ipStr) {
|
explicit IP4(const char* ipStr) {
|
||||||
set(ipStr);
|
set(ipStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ctor with ip_addr_t */
|
/** ctor with ip_addr_t */
|
||||||
explicit IP4(ip_addr addr) : addr(addr) {
|
explicit IP4(ip_addr addr) : addr(addr) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,7 +48,47 @@
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#elif ESP32
|
#elif IS_ESP8266 // freeRTOS
|
||||||
|
|
||||||
|
#include <lwip/ip.h>
|
||||||
|
|
||||||
|
struct IP4 {
|
||||||
|
|
||||||
|
ip4_addr addr;
|
||||||
|
|
||||||
|
/** empty ctor */
|
||||||
|
explicit IP4() {
|
||||||
|
addr.addr = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** ctor with IP-string */
|
||||||
|
explicit IP4(const char* ipStr) {
|
||||||
|
set(ipStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** ctor with ip4_addr */
|
||||||
|
explicit IP4(ip4_addr _addr) {
|
||||||
|
addr =_addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** set the IP by string: x.x.x.x */
|
||||||
|
void set(const char* ipStr) {
|
||||||
|
ip4addr_aton(ipStr, &addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** convert to ip_addr/ip_addr_t */
|
||||||
|
const ip_addr_t* getPtr() const {
|
||||||
|
return &addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** convert to string */
|
||||||
|
const char* toString() const {
|
||||||
|
return ipaddr_ntoa(&addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#elif IS_ESP32
|
||||||
|
|
||||||
#include <lwip/ip.h>
|
#include <lwip/ip.h>
|
||||||
|
|
||||||
|
|||||||
107
net/UDP.h
107
net/UDP.h
@@ -2,11 +2,16 @@
|
|||||||
#define UDP_H
|
#define UDP_H
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "mem.h"
|
//#include "mem.h"
|
||||||
#include "espconn.h"
|
//#include "espconn.h"
|
||||||
|
#include "lwip/sockets.h"
|
||||||
|
#include "lwip/sys.h"
|
||||||
|
#include "lwip/err.h"
|
||||||
|
#include "lwip/udp.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef void (*UDPCallback)(void* arg, char* data, unsigned short len);
|
//typedef void (*UDPCallback)(void* arg, char* data, unsigned short len);
|
||||||
|
typedef void (*UDPCallback)(void* arg, struct udp_pcb* pcb, struct pbuf* p, const ip_addr_t* addr, u16_t port);
|
||||||
|
|
||||||
#include "../Debug.h"
|
#include "../Debug.h"
|
||||||
#include "IP.h"
|
#include "IP.h"
|
||||||
@@ -17,7 +22,8 @@ private:
|
|||||||
|
|
||||||
static constexpr const char* NAME = "UDP";
|
static constexpr const char* NAME = "UDP";
|
||||||
|
|
||||||
espconn* con;
|
//espconn* con;
|
||||||
|
struct udp_pcb* udp;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@@ -35,78 +41,91 @@ public:
|
|||||||
/** bind the socket to the given local port */
|
/** bind the socket to the given local port */
|
||||||
void bind(const Port localPort) {
|
void bind(const Port localPort) {
|
||||||
|
|
||||||
debugMod1(NAME, "binding to local port %d", localPort);
|
Log::addInfo(NAME, "binding to local port %d", localPort);
|
||||||
|
|
||||||
// set the local port to listen on
|
// // set the local port to listen on
|
||||||
con->proto.udp->local_port = localPort;
|
// con->proto.udp->local_port = localPort;
|
||||||
|
//
|
||||||
|
// // todo: check? 0=OK
|
||||||
|
// const int res = espconn_create(con);
|
||||||
|
// os_printf("create: %d\r\n", res);
|
||||||
|
|
||||||
// todo: check? 0=OK
|
ip_addr_t bindIP;
|
||||||
const int res = espconn_create(con);
|
IP4_ADDR(&bindIP, 0,0,0,0);
|
||||||
os_printf("create: %d\r\n", res);
|
udp_bind(udp, &bindIP, localPort);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool send(const IP4 ip, const Port port, const void* data, const uint16_t dataLen) {
|
bool send(const IP4 ip, const Port port, const void* data, const uint16_t dataLen) {
|
||||||
|
|
||||||
debugMod1(NAME, "sending packet to remote port %d", port);
|
Log::addInfo(NAME, "sending packet to remote port %d", port);
|
||||||
|
|
||||||
// set remote port and IP
|
// // set remote port and IP
|
||||||
con->proto.udp->remote_port = port;
|
// con->proto.udp->remote_port = port;
|
||||||
os_memcpy(con->proto.udp->remote_ip, ip.getPtr(), 4);
|
// os_memcpy(con->proto.udp->remote_ip, ip.getPtr(), 4);
|
||||||
|
//
|
||||||
|
// // send. TODO: check. 0=OK
|
||||||
|
// const int res = espconn_sent(con, (unsigned char*)data, dataLen);
|
||||||
|
// return (res == 0);
|
||||||
|
|
||||||
//os_printf("send %d bytes\r\n", dataLen);
|
// allocate and fill transmit buffer
|
||||||
//os_printf("IP: %d.%d.%d.%d\n\r", con->proto.udp->remote_ip[0], con->proto.udp->remote_ip[1], con->proto.udp->remote_ip[2], con->proto.udp->remote_ip[3]);
|
pbuf* buf = pbuf_alloc(PBUF_TRANSPORT, dataLen, PBUF_RAM);
|
||||||
|
memcpy(buf->payload, data, dataLen);
|
||||||
|
|
||||||
// send. TODO: check. 0=OK
|
// transmit
|
||||||
const int res = espconn_sent(con, (unsigned char*)data, dataLen);
|
udp_sendto(udp, buf, ip.getPtr(), port);
|
||||||
return (res == 0);
|
|
||||||
|
pbuf_free(buf);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** set the callback to call whenever a packet is received */
|
/** set the callback to call whenever a packet is received */
|
||||||
void setRecvCallback(UDPCallback callback) {
|
void setRecvCallback(UDPCallback callback) {
|
||||||
debugMod(NAME, "setRecvCallback()");
|
Log::addInfo(NAME, "setRecvCallback()");
|
||||||
espconn_regist_recvcb(con, callback);
|
// espconn_regist_recvcb(con, callback);
|
||||||
|
udp_recv(udp, callback, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** get the IP address of the most recent packet's sender */
|
/** get the IP address of the most recent packet's sender */
|
||||||
IP4 getSenderIP() {
|
// IP4 getSenderIP() {
|
||||||
|
// remot_info* rem;
|
||||||
remot_info* rem;
|
// espconn_get_connection_info(con, &rem, 0);
|
||||||
espconn_get_connection_info(con, &rem, 0);
|
// ip_addr_t* _ip = (ip_addr_t*) rem->remote_ip;
|
||||||
ip_addr_t* _ip = (ip_addr_t*) rem->remote_ip;
|
// return IP4(*_ip);
|
||||||
return IP4(*_ip);
|
// }
|
||||||
//const uint16_t port = rem->remote_port;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/** initialize the UDP "connection" */
|
/** initialize the UDP "connection" */
|
||||||
void init() {
|
void init() {
|
||||||
|
|
||||||
debugMod(NAME, "init()");
|
Log::addInfo(NAME, "init()");
|
||||||
|
|
||||||
// allocate connection-objects
|
// // allocate connection-objects
|
||||||
con = (espconn*) os_zalloc(sizeof(espconn));
|
// con = (espconn*) os_zalloc(sizeof(espconn));
|
||||||
ets_memset( con, 0, sizeof( espconn ) );
|
// ets_memset( con, 0, sizeof( espconn ) );
|
||||||
|
//
|
||||||
// configure
|
// // configure
|
||||||
con->type = ESPCONN_UDP;
|
// con->type = ESPCONN_UDP;
|
||||||
//con->state = ESPCONN_NONE;
|
//
|
||||||
|
// con->proto.udp = (esp_udp*) os_zalloc(sizeof(esp_udp));
|
||||||
con->proto.udp = (esp_udp*) os_zalloc(sizeof(esp_udp));
|
|
||||||
|
|
||||||
|
udp = udp_new();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** cleanup everything */
|
/** cleanup everything */
|
||||||
void cleanup() {
|
void cleanup() {
|
||||||
|
|
||||||
debugMod(NAME, "cleanup()");
|
Log::addInfo(NAME, "cleanup()");
|
||||||
|
|
||||||
espconn_delete(con);
|
// espconn_delete(con);
|
||||||
os_free(con->proto.udp);
|
// os_free(con->proto.udp);
|
||||||
os_free(con);
|
// os_free(con);
|
||||||
|
|
||||||
|
udp_remove(udp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,12 @@
|
|||||||
|
|
||||||
#include "MAC.h"
|
#include "MAC.h"
|
||||||
|
|
||||||
|
#if IS_ESP8266
|
||||||
|
extern "C" {
|
||||||
|
#include "esp_wifi.h"
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// ifconfig wlp0s26u1u2u1 down && iw dev wlp0s26u1u2u1 set monitor none && ifconfig wlp0s26u1u2u1 up && iw dev wlp0s26u1u2u1 set channel 3
|
// ifconfig wlp0s26u1u2u1 down && iw dev wlp0s26u1u2u1 set monitor none && ifconfig wlp0s26u1u2u1 up && iw dev wlp0s26u1u2u1 set channel 3
|
||||||
// ifconfig wlp0s26u1u2u1 down && iw dev wlp0s26u1u2u1 set monitor none && ifconfig wlp0s26u1u2u1 up iwconfig wlp0s26u1u2u1 channel 3
|
// ifconfig wlp0s26u1u2u1 down && iw dev wlp0s26u1u2u1 set monitor none && ifconfig wlp0s26u1u2u1 up iwconfig wlp0s26u1u2u1 channel 3
|
||||||
|
|
||||||
@@ -183,15 +189,15 @@ namespace WiFiRaw {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifdef ESP8266
|
#if IS_ESP8266
|
||||||
WiFiRaw::MACAddress getMyMAC() {
|
WiFiRaw::MACAddress getMyMAC() {
|
||||||
WiFiRaw::MACAddress mine;
|
WiFiRaw::MACAddress mine;
|
||||||
wifi_get_macaddr(0x00, (uint8_t*)&mine);
|
esp_wifi_get_mac(ESP_IF_WIFI_STA, (uint8_t*)&mine);
|
||||||
return mine;
|
return mine;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ESP32
|
#if IS_ESP32
|
||||||
WiFiRaw::MACAddress getMyMAC() {
|
WiFiRaw::MACAddress getMyMAC() {
|
||||||
WiFiRaw::MACAddress mine;
|
WiFiRaw::MACAddress mine;
|
||||||
esp_wifi_get_mac(ESP_IF_WIFI_STA, (uint8_t*)&mine);
|
esp_wifi_get_mac(ESP_IF_WIFI_STA, (uint8_t*)&mine);
|
||||||
|
|||||||
333
tools/PixelFontGen/FontBuilder.h
Normal file
333
tools/PixelFontGen/FontBuilder.h
Normal file
@@ -0,0 +1,333 @@
|
|||||||
|
#ifndef FONTBUILDER_H
|
||||||
|
#define FONTBUILDER_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QImage>
|
||||||
|
#include <QFont>
|
||||||
|
#include <QFontDatabase>
|
||||||
|
#include <QIcon>
|
||||||
|
#include <QSvgRenderer>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
struct FontBuilder {
|
||||||
|
|
||||||
|
/** resulting font */
|
||||||
|
struct Result {
|
||||||
|
|
||||||
|
/** pixel data */
|
||||||
|
std::vector<uint8_t> data;
|
||||||
|
|
||||||
|
/** character x offset in pixel */
|
||||||
|
std::vector<uint16_t> offsets;
|
||||||
|
|
||||||
|
uint16_t w;
|
||||||
|
uint8_t h;
|
||||||
|
QImage img;
|
||||||
|
|
||||||
|
void dump(const char* name) const {
|
||||||
|
|
||||||
|
std::cout << "static const uint8_t " << name << "_data[] = {";
|
||||||
|
for (uint8_t i : data) {
|
||||||
|
std::cout << (int) i << ",";
|
||||||
|
}
|
||||||
|
std::cout << "};" << std::endl;
|
||||||
|
|
||||||
|
std::cout << "static const uint16_t " << name << "_offsets[] = {";
|
||||||
|
for (uint16_t i : offsets) {
|
||||||
|
std::cout << (int) i << ",";
|
||||||
|
}
|
||||||
|
std::cout << "};" << std::endl;
|
||||||
|
|
||||||
|
//std::cout << "out size: " << w << ":" << h << std::endl;
|
||||||
|
std::cout << "static const FontWrap fnt_" << name << "(" << (int)w << "," << (int)h << "," << name << "_data," << name << "_offsets);" << std::endl;
|
||||||
|
|
||||||
|
std::cout << "--------------------" << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Result res;
|
||||||
|
uint16_t curX = 0;
|
||||||
|
|
||||||
|
FontBuilder(const int h) {
|
||||||
|
|
||||||
|
//if ( (w%8) != 0 ) {
|
||||||
|
// throw "width must be multiple of 8";
|
||||||
|
//}
|
||||||
|
|
||||||
|
res.w = 1024;
|
||||||
|
res.h = h;
|
||||||
|
res.img = QImage(res.w, res.h, QImage::Format_Mono);
|
||||||
|
|
||||||
|
QPainter p(&res.img);
|
||||||
|
p.fillRect(0, 0, res.w, res.h, Qt::white);
|
||||||
|
p.end();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void addDummy() {
|
||||||
|
// update
|
||||||
|
res.offsets.push_back(curX);
|
||||||
|
curX += 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void addIcon(QString file, float w, float h, int atHeight) {
|
||||||
|
|
||||||
|
// //QImage img = QIcon("filepath.svg").pixmap(QSize()).toImage();
|
||||||
|
// QSvgRenderer renderer(file);
|
||||||
|
// QImage img(pixelSize, pixelSize, QImage::Format_ARGB32);
|
||||||
|
// //pm.fill(Qt::blue);
|
||||||
|
// QPainter painter(&img);
|
||||||
|
// painter.fillRect(0, 0, pixelSize, pixelSize, Qt::blue);
|
||||||
|
// renderer.render(&painter, img.rect());
|
||||||
|
|
||||||
|
// // renderer
|
||||||
|
// QPainter p(&res.img);
|
||||||
|
// p.setRenderHint(QPainter::Antialiasing, false);
|
||||||
|
// p.setRenderHint(QPainter::TextAntialiasing, false);
|
||||||
|
// //p.setPen(Qt::white);
|
||||||
|
|
||||||
|
// // render
|
||||||
|
// p.drawImage(curX, atHeight, img);
|
||||||
|
// p.end();
|
||||||
|
|
||||||
|
|
||||||
|
// renderer
|
||||||
|
QPainter p(&res.img);
|
||||||
|
p.setRenderHint(QPainter::Antialiasing, false);
|
||||||
|
p.setRenderHint(QPainter::TextAntialiasing, false);
|
||||||
|
p.setRenderHint(QPainter::SmoothPixmapTransform, false);
|
||||||
|
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
|
||||||
|
|
||||||
|
// render the image
|
||||||
|
QSvgRenderer renderer(file);
|
||||||
|
//QImage img(pixelSize, pixelSize, QImage::Format_RGB888);
|
||||||
|
QRect rect(curX, 0, w, h);
|
||||||
|
//p.fillRect(rect, Qt::blue);
|
||||||
|
renderer.render(&p, rect);
|
||||||
|
|
||||||
|
// update
|
||||||
|
res.offsets.push_back(curX);
|
||||||
|
curX += w+1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void addCharsMonoFromImage(QString file, const int charW, unsigned char cFirst, unsigned char cLast) {
|
||||||
|
|
||||||
|
// renderer
|
||||||
|
// QPainter p(&res.img);
|
||||||
|
// p.setRenderHint(QPainter::Antialiasing, false);
|
||||||
|
// p.setRenderHint(QPainter::TextAntialiasing, false);
|
||||||
|
int stride = 1;
|
||||||
|
|
||||||
|
QImage img;
|
||||||
|
img.load(file);
|
||||||
|
res.img = img;
|
||||||
|
res.w = img.width();
|
||||||
|
res.h = img.height();
|
||||||
|
// p.drawImage(0, 0, img);
|
||||||
|
|
||||||
|
// draw letters
|
||||||
|
for (unsigned char c = cFirst; c < cLast; ++c) {
|
||||||
|
int x1 = (c-cFirst) * (charW+stride);
|
||||||
|
int w = charW;
|
||||||
|
int y1 = 0;
|
||||||
|
int h = res.h;
|
||||||
|
QRect rect = QRect(x1, y1, w, h);
|
||||||
|
res.offsets.push_back(curX);
|
||||||
|
curX += std::ceil(rect.width()) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// p.end();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void addChars(QString fontFile, float pixelSize, int atHeight, unsigned char cFirst, unsigned char cLast, std::function<void(char, QRect&)> fixFunc = nullptr) {
|
||||||
|
|
||||||
|
|
||||||
|
// renderer
|
||||||
|
QPainter p(&res.img);
|
||||||
|
p.setRenderHint(QPainter::Antialiasing, false);
|
||||||
|
p.setRenderHint(QPainter::TextAntialiasing, false);
|
||||||
|
p.setPen(Qt::black);
|
||||||
|
|
||||||
|
// the font
|
||||||
|
int id = QFontDatabase::addApplicationFont(fontFile);
|
||||||
|
QString family = QFontDatabase::applicationFontFamilies(id).at(0);
|
||||||
|
QFont fnt(family);
|
||||||
|
if (pixelSize == -1) {
|
||||||
|
;
|
||||||
|
} else if (pixelSize > 100) {
|
||||||
|
fnt.setPointSize(pixelSize-100);
|
||||||
|
} else {
|
||||||
|
fnt.setPixelSize(pixelSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
QFontMetrics fm(fnt);
|
||||||
|
|
||||||
|
// enable
|
||||||
|
p.setFont(fnt);
|
||||||
|
|
||||||
|
// draw letters
|
||||||
|
for (unsigned char c = cFirst; c < cLast; ++c) {
|
||||||
|
|
||||||
|
QRect rect = fm.boundingRect(c);
|
||||||
|
QString str = ""; str += c;
|
||||||
|
|
||||||
|
res.offsets.push_back(curX);
|
||||||
|
int drawOffsetX = 0;
|
||||||
|
|
||||||
|
// apply rectangle fixing function?
|
||||||
|
if (fixFunc) {
|
||||||
|
|
||||||
|
fixFunc(c, rect);
|
||||||
|
|
||||||
|
// hack for some chars
|
||||||
|
if (rect.x() < 0) {drawOffsetX = -rect.x();}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << " " << c << " : " << rect.width() << " cur: " << curX << std::endl;
|
||||||
|
|
||||||
|
p.drawText(curX+drawOffsetX, atHeight, str);
|
||||||
|
curX += std::ceil(rect.width()) + 1; // 1 pixel space between chars
|
||||||
|
}
|
||||||
|
|
||||||
|
p.end();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Result& get() {
|
||||||
|
|
||||||
|
// crop image (only used region)
|
||||||
|
res.w = (curX/8+1)*8;
|
||||||
|
res.img = res.img.copy(0,0,res.w,res.h);
|
||||||
|
|
||||||
|
|
||||||
|
// convert to bitfield
|
||||||
|
const unsigned int bytes = res.w/8 * res.h;
|
||||||
|
res.data.resize(bytes);
|
||||||
|
for (int y = 0; y < res.h; ++y) {
|
||||||
|
for (int x = 0; x < res.w; ++x) {
|
||||||
|
const QColor pixel = res.img.pixelColor(x,y);
|
||||||
|
bool set = pixel.red() + pixel.green() + pixel.blue() == 0;
|
||||||
|
if (set) {
|
||||||
|
const unsigned int idx = (x/8) + (y*res.w/8);
|
||||||
|
res.data[idx] |= (1 << (x%8));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Result build(const QString& fontFile, int maxChar, float pixelSize, const int oh) {
|
||||||
|
|
||||||
|
// the font
|
||||||
|
int id = QFontDatabase::addApplicationFont(fontFile);
|
||||||
|
QString family = QFontDatabase::applicationFontFamilies(id).at(0);
|
||||||
|
QFont fnt(family); fnt.setPixelSize(pixelSize);
|
||||||
|
QFontMetrics fm(fnt);
|
||||||
|
|
||||||
|
// first chars are unused
|
||||||
|
std::vector<uint16_t> offsets;
|
||||||
|
for (unsigned char c = 0; c <= 32; ++c) {
|
||||||
|
offsets.push_back(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// estimate total width and remember character offsets
|
||||||
|
int mx = 0;
|
||||||
|
for (unsigned char c = 32; c < maxChar; ++c) {
|
||||||
|
QRect rect = fm.boundingRect(c);
|
||||||
|
mx += std::ceil(rect.width()) + 1;
|
||||||
|
//if (c < 128 && rect.height() > my) {my = rect.height();}
|
||||||
|
offsets.push_back(mx);
|
||||||
|
}
|
||||||
|
|
||||||
|
// width/height
|
||||||
|
int w = mx;
|
||||||
|
int h = oh;
|
||||||
|
|
||||||
|
// width/height next multiple of 8
|
||||||
|
int ow = ((w-1)/8+1)*8;
|
||||||
|
//int oh = h;
|
||||||
|
|
||||||
|
QImage img = QImage(ow, oh, QImage::Format_RGB888);
|
||||||
|
QPainter p(&img);
|
||||||
|
|
||||||
|
p.setRenderHint(QPainter::Antialiasing, false);
|
||||||
|
p.setRenderHint(QPainter::TextAntialiasing, false);
|
||||||
|
p.setPen(Qt::white);
|
||||||
|
p.setFont(fnt);
|
||||||
|
p.fillRect(0, 0, w, h, Qt::black);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// draw image
|
||||||
|
std::vector<uint8_t> data;
|
||||||
|
for (unsigned char c = 32; c < maxChar; ++c) {
|
||||||
|
QRect rect = fm.boundingRect(c);
|
||||||
|
QString str = ""; str += c;
|
||||||
|
int x = offsets[c];
|
||||||
|
p.drawText(x, h, str);
|
||||||
|
}
|
||||||
|
|
||||||
|
p.end();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// convert to bitfield
|
||||||
|
const unsigned int bytes = ow/8 * oh;
|
||||||
|
data.resize(bytes);
|
||||||
|
for (int y = 0; y < oh; ++y) {
|
||||||
|
for (int x = 0; x < ow; ++x) {
|
||||||
|
bool set = img.pixelColor(x,y).red() > 128;
|
||||||
|
if (set) {
|
||||||
|
const unsigned int idx = (x/8) + (y*ow/8);
|
||||||
|
data[idx] |= (1 << (x%8));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// remove initial empty offsets
|
||||||
|
offsets.erase(offsets.begin(), offsets.begin()+32);
|
||||||
|
|
||||||
|
|
||||||
|
//img.save("/tmp/1.png");
|
||||||
|
|
||||||
|
//int i = 0; (void) i;
|
||||||
|
|
||||||
|
Result res;
|
||||||
|
res.data = data;
|
||||||
|
res.offsets = offsets;
|
||||||
|
res.w = ow;
|
||||||
|
res.h = oh;
|
||||||
|
res.img = img;
|
||||||
|
|
||||||
|
return res;
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FONTBUILDER_H
|
||||||
125
tools/PixelFontGen/MainWindow.cpp
Normal file
125
tools/PixelFontGen/MainWindow.cpp
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
#include "MainWindow.h"
|
||||||
|
#include "ui_MainWindow.h"
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QImage>
|
||||||
|
#include <QFontDatabase>
|
||||||
|
|
||||||
|
#include <ESP8266lib/ext/lcd/Draw.h>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <FontBuilder.h>
|
||||||
|
|
||||||
|
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {// ui(new Ui::MainWindow) {
|
||||||
|
//ui->setupUi(this);
|
||||||
|
|
||||||
|
setMinimumSize(1500,300);
|
||||||
|
|
||||||
|
//QFont fnt("/apps/esp/test/04B_03__.TTF"); fnt.setPixelSize(7);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
MainWindow::~MainWindow() {
|
||||||
|
//delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::paintEvent(QPaintEvent* e) {
|
||||||
|
|
||||||
|
QString fontPath="/apps/ESP8266lib/tools/PixelFontGen/fonts/";
|
||||||
|
|
||||||
|
//FontBuilder::Result res = fb.build("/apps/esp/test/04B_03__.TTF");
|
||||||
|
//FontBuilder fb(10); fb.addChars("/apps/esp/PixelFont/PixelOperator.ttf", 16, 9, 32, 126);
|
||||||
|
//FontBuilder fb(8); fb.addChars("/apps/esp/PixelFont/04B_03__.TTF", 8, 6, 32, 126); // OK
|
||||||
|
//FontBuilder fb(8); fb.addChars("/apps/esp/PixelFont/Minecraft.ttf", 7.5, 6, 32, 126); // ugly
|
||||||
|
//FontBuilder fb(10); fb.addChars("/apps/esp/PixelFont/EnterCommand.ttf", 15, 8, 32, 126);
|
||||||
|
//FontBuilder fb(10); fb.addChars("/apps/esp/PixelFont/PIXELADE.TTF", 13, 8, 32, 126);
|
||||||
|
//FontBuilder fb(10); fb.addChars("/apps/esp/PixelFont/C&C Red Alert [LAN].ttf", 110, 8, 32, 126); // ugly
|
||||||
|
//FontBuilder fb(11); fb.addChars("/apps/esp/PixelFont/LeviWindows.ttf", 21, 9, 32, 126);
|
||||||
|
//FontBuilder fb(9); fb.addChars("/apps/esp/PixelFont/SadMachine.ttf", 16, 8, 32, 126);
|
||||||
|
//FontBuilder fb(7); fb.addChars("/apps/esp/PixelFont/bitdust1.ttf", 8, 6, 32, 126); // NICE
|
||||||
|
//FontBuilder fb(10); fb.addChars("/apps/esp/PixelFont/pixeljosh6.ttf", 8, 7, 32, 126);
|
||||||
|
//FontBuilder fb(9); fb.addChars("/apps/esp/PixelFont/BitPotionExt.ttf", 16, 7, 32, 126);
|
||||||
|
//FontBuilder fb(10); fb.addChars("/apps/esp/PixelFont/PIXEARG_.TTF", 8, 8, 32, 126);
|
||||||
|
//FontBuilder fb(10); fb.addChars(fontPath+"/Volter__28Goldfish_29.ttf", 9, 8, 32, 126);
|
||||||
|
//FontBuilder fb(10); fb.addChars(fontPath+"/ti-83-plus-large.ttf", 8, 8, 32, 126);
|
||||||
|
//FontBuilder fb(10); fb.addChars(fontPath+"/EXEPixelPerfect.ttf", 16, 8, 32, 126);
|
||||||
|
//FontBuilder fb(10); fb.addChars(fontPath+"/new-gen.ttf", 9, 8, 32, 126);
|
||||||
|
//FontBuilder fb(10); fb.addChars(fontPath+"/Comicoro.ttf", 16, 8, 32, 126, [](char c, QRect& r) { if(c=='1'){r.setX(-2); r.setWidth(5);} if(c=='-'){r.setX(-1); r.setWidth(5);} });
|
||||||
|
//FontBuilder fb(9); fb.addChars(fontPath+"/Nineteen Ninety Six.otf", 9, 7, 32, 126);
|
||||||
|
//FontBuilder fb(15); fb.addChars(fontPath+"/Mario64.ttf", 12, 12, 32, 126);
|
||||||
|
//FontBuilder fb(7); fb.addChars(fontPath+"/RNTG Larger.ttf", 7, 7, 32, 126, [](char c, QRect& r) {if(c=='1'){r.setX(0); r.setWidth(5);}});
|
||||||
|
//FontBuilder fb(8); fb.addChars(fontPath+"/Bonni-Africa.ttf", 8, 7, 32, 126);
|
||||||
|
|
||||||
|
//FontBuilder fb(8); fb.addCharsMonoFromImage("/apps/esp/PixelFont/res/fnt1.png", 3, 32, 126);
|
||||||
|
|
||||||
|
// test for icons
|
||||||
|
FontBuilder fb(9);
|
||||||
|
// for (int i = 0; i < 10; ++i) {
|
||||||
|
fb.addDummy();
|
||||||
|
//fb.addIcon("/apps/esp/PixelFont/res/icon/wifi.svg", 12, 0);
|
||||||
|
fb.addIcon("/apps/esp32/BoatRemote/icon/remote.svg", 11, 9, 0);
|
||||||
|
fb.addIcon("/apps/esp32/BoatRemote/icon/boat.svg", 12, 9, 0);
|
||||||
|
fb.addDummy();
|
||||||
|
// }
|
||||||
|
|
||||||
|
const FontBuilder::Result& res = fb.get();
|
||||||
|
//res.dump("f1");
|
||||||
|
res.dump("fIcon");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
struct F {
|
||||||
|
QPainter&p;
|
||||||
|
F(QPainter& p ) : p(p) {;}
|
||||||
|
void setPixel(int x, int y) {
|
||||||
|
p.drawPoint(QPointF(x,y));
|
||||||
|
}
|
||||||
|
void fillRect(int x, int y, int w, int h) {
|
||||||
|
p.fillRect(x,y,w,h, Qt::blue);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
QPainter p(this);
|
||||||
|
p.setPen(Qt::black);
|
||||||
|
p.translate(10,10);
|
||||||
|
|
||||||
|
F dst(p);
|
||||||
|
|
||||||
|
// uint8_t data[] = {171,40,153,86,0,208,190,163,183,55,131,200,57,59,223,239,121,206,196,180,179,243,103,198,204,31,22,4,1,4,66,52,2,0,0,128,0,0,0,124,138,0,251,29,133,41,1,40,69,180,8,204,92,23,198,204,100,18,41,172,236,205,204,12,101,214,76,38,44,232,103,55,249,33,191,179,243,250,51,107,243,85,69,1,161,134,88,217,115,36,53,171,59,50,39,160,245,188,228,223,47,156,212,206,204,52,101,85,115,69,4,144,153,236,103,182,214,204,204,141,50,171,146,146,64,1,240,89,36,9,1,34,13,124,76,73,92,23,212,207,100,146,169,172,196,204,203,67,101,213,196,132,4,144,153,28,101,246,214,204,204,176,178,148,82,84,32,2,161,78,90,6,136,193,252,163,51,49,147,136,184,60,223,227,121,203,199,180,176,60,153,168,180,15,199,227,103,55,121,54,215,180,243,28,93,84,253,125,224,3,};
|
||||||
|
// uint16_t offsets[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,4,9,13,18,23,24,26,28,31,34,36,39,40,45,49,51,55,59,63,67,71,75,79,83,84,85,88,91,94,98,103,107,111,114,118,121,124,128,132,135,139,143,146,151,155,159,163,167,171,175,178,182,186,191,195,199,202,204,209,211,214,218,220,224,228,231,235,239,242,246,250,251,253,257,258,263,267,271,275,279,282,286,289,293,297,302,305,309,313,316,317,320,324,330,};
|
||||||
|
|
||||||
|
|
||||||
|
FontWrap fnt(res.w, res.h, res.data.data(), res.offsets.data());
|
||||||
|
|
||||||
|
Draw<int16_t, F> d(dst);
|
||||||
|
|
||||||
|
const char* txt = "!! ## AABBCCDD aabbccdd";
|
||||||
|
|
||||||
|
p.save();
|
||||||
|
p.scale(6,6);
|
||||||
|
p.drawImage(0, 0, res.img);
|
||||||
|
p.restore();
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 1; i <= 2; ++i) {
|
||||||
|
p.save();
|
||||||
|
p.scale(i,i);
|
||||||
|
fnt.draw<int16_t, F>("--!\"#$%&'()*+,-./--", 20, 100, dst);
|
||||||
|
fnt.draw<int16_t, F>("--0123456789--", 20, 110, dst);
|
||||||
|
fnt.draw<int16_t, F>("--abcdefghijklmnopqrstuvwxyz--", 20, 120, dst);
|
||||||
|
fnt.draw<int16_t, F>("--ABCDEFGHIJKLMNOPQRSTUVWXYZ--", 20, 130, dst);
|
||||||
|
p.restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
// d.drawRect(10,10, 30, 20);
|
||||||
|
|
||||||
|
// uint8_t data = {255,255,255,255};
|
||||||
|
// uint16_t offsets = {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
|
||||||
|
|
||||||
|
p.end();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
25
tools/PixelFontGen/MainWindow.h
Normal file
25
tools/PixelFontGen/MainWindow.h
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#ifndef MAINWINDOW_H
|
||||||
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
|
#include <QMainWindow>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class MainWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
class MainWindow : public QMainWindow {
|
||||||
|
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit MainWindow(QWidget *parent = nullptr);
|
||||||
|
~MainWindow();
|
||||||
|
|
||||||
|
private:
|
||||||
|
//Ui::MainWindow *ui;
|
||||||
|
|
||||||
|
void paintEvent(QPaintEvent* e) override;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MAINWINDOW_H
|
||||||
24
tools/PixelFontGen/MainWindow.ui
Normal file
24
tools/PixelFontGen/MainWindow.ui
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<ui version="4.0">
|
||||||
|
<class>MainWindow</class>
|
||||||
|
<widget class="QMainWindow" name="MainWindow" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle" >
|
||||||
|
<string>MainWindow</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QMenuBar" name="menuBar" />
|
||||||
|
<widget class="QToolBar" name="mainToolBar" />
|
||||||
|
<widget class="QWidget" name="centralWidget" />
|
||||||
|
<widget class="QStatusBar" name="statusBar" />
|
||||||
|
</widget>
|
||||||
|
<layoutDefault spacing="6" margin="11" />
|
||||||
|
<pixmapfunction></pixmapfunction>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
43
tools/PixelFontGen/PixelFontGen.pro
Normal file
43
tools/PixelFontGen/PixelFontGen.pro
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#-------------------------------------------------
|
||||||
|
#
|
||||||
|
# Project created by QtCreator 2018-09-24T20:35:06
|
||||||
|
#
|
||||||
|
#-------------------------------------------------
|
||||||
|
|
||||||
|
QT += core gui widgets svg
|
||||||
|
|
||||||
|
TARGET = test
|
||||||
|
TEMPLATE = app
|
||||||
|
|
||||||
|
# The following define makes your compiler emit warnings if you use
|
||||||
|
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||||
|
# depend on your compiler). Please consult the documentation of the
|
||||||
|
# deprecated API in order to know how to port your code away from it.
|
||||||
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
|
# You can also make your code fail to compile if you use deprecated APIs.
|
||||||
|
# In order to do so, uncomment the following line.
|
||||||
|
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||||
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
|
CONFIG += c++11
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
main.cpp \
|
||||||
|
MainWindow.cpp
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
MainWindow.h \
|
||||||
|
FontBuilder.h \
|
||||||
|
../../ext/lcd/Draw.h \
|
||||||
|
|
||||||
|
FORMS += \
|
||||||
|
MainWindow.ui
|
||||||
|
|
||||||
|
INCLUDEPATH += \
|
||||||
|
/apps
|
||||||
|
|
||||||
|
# Default rules for deployment.
|
||||||
|
qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
|
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||||
|
!isEmpty(target.path): INSTALLS += target
|
||||||
335
tools/PixelFontGen/PixelFontGen.pro.user
Normal file
335
tools/PixelFontGen/PixelFontGen.pro.user
Normal file
@@ -0,0 +1,335 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE QtCreatorProject>
|
||||||
|
<!-- Written by QtCreator 4.12.1, 2020-07-08T21:18:06. -->
|
||||||
|
<qtcreator>
|
||||||
|
<data>
|
||||||
|
<variable>EnvironmentId</variable>
|
||||||
|
<value type="QByteArray">{662356ad-536e-4e17-8869-ff649e71cb1a}</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
|
<value type="int">0</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||||
|
<valuemap type="QVariantMap">
|
||||||
|
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
|
||||||
|
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
|
||||||
|
<value type="QString" key="language">Cpp</value>
|
||||||
|
<valuemap type="QVariantMap" key="value">
|
||||||
|
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
|
||||||
|
</valuemap>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
|
||||||
|
<value type="QString" key="language">QmlJS</value>
|
||||||
|
<valuemap type="QVariantMap" key="value">
|
||||||
|
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
|
||||||
|
</valuemap>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
|
||||||
|
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
||||||
|
<value type="int" key="EditorConfiguration.IndentSize">4</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
|
||||||
|
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
||||||
|
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
|
||||||
|
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
|
||||||
|
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
|
||||||
|
<value type="int" key="EditorConfiguration.TabSize">8</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
|
||||||
|
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
|
||||||
|
</valuemap>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.PluginSettings</variable>
|
||||||
|
<valuemap type="QVariantMap">
|
||||||
|
<valuemap type="QVariantMap" key="ClangTools">
|
||||||
|
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
|
||||||
|
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
|
||||||
|
<value type="int" key="ClangTools.ParallelJobs">4</value>
|
||||||
|
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
|
||||||
|
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
|
||||||
|
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
|
||||||
|
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
|
||||||
|
</valuemap>
|
||||||
|
</valuemap>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||||
|
<valuemap type="QVariantMap">
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{fe56f1ef-f99a-4240-b10b-b3bde6dd50d2}</value>
|
||||||
|
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||||
|
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||||
|
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||||
|
<value type="bool">true</value>
|
||||||
|
<value type="int" key="EnableQmlDebugging">0</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/apps/ESP8266lib/tools/build-PixelFontGen-Desktop-Debug</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/apps/ESP8266lib/tools/build-PixelFontGen-Desktop-Debug</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||||
|
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||||
|
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||||
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||||
|
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
||||||
|
<value type="int" key="QtQuickCompiler">2</value>
|
||||||
|
<value type="int" key="SeparateDebugInfo">2</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||||
|
<value type="bool">true</value>
|
||||||
|
<value type="int" key="EnableQmlDebugging">2</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/apps/ESP8266lib/tools/build-PixelFontGen-Desktop-Release</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/apps/ESP8266lib/tools/build-PixelFontGen-Desktop-Release</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||||
|
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||||
|
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||||
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||||
|
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||||
|
<value type="int" key="QtQuickCompiler">0</value>
|
||||||
|
<value type="int" key="SeparateDebugInfo">2</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
||||||
|
<value type="bool">true</value>
|
||||||
|
<value type="int" key="EnableQmlDebugging">0</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/apps/ESP8266lib/tools/build-PixelFontGen-Desktop-Profile</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/apps/ESP8266lib/tools/build-PixelFontGen-Desktop-Profile</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||||
|
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||||
|
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||||
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||||
|
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||||
|
<value type="int" key="QtQuickCompiler">0</value>
|
||||||
|
<value type="int" key="SeparateDebugInfo">0</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
|
||||||
|
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||||
|
<value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
|
||||||
|
<valuelist type="QVariantList" key="Analyzer.Perf.Events">
|
||||||
|
<value type="QString">cpu-cycles</value>
|
||||||
|
</valuelist>
|
||||||
|
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
|
||||||
|
<value type="int" key="Analyzer.Perf.Frequency">250</value>
|
||||||
|
<valuelist type="QVariantList" key="Analyzer.Perf.RecordArguments">
|
||||||
|
<value type="QString">-e</value>
|
||||||
|
<value type="QString">cpu-cycles</value>
|
||||||
|
<value type="QString">--call-graph</value>
|
||||||
|
<value type="QString">dwarf,4096</value>
|
||||||
|
<value type="QString">-F</value>
|
||||||
|
<value type="QString">250</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
|
||||||
|
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
|
||||||
|
<value type="int" key="Analyzer.Perf.StackSize">4096</value>
|
||||||
|
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
|
||||||
|
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
|
||||||
|
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
|
||||||
|
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
|
||||||
|
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
||||||
|
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
|
||||||
|
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
|
||||||
|
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
|
||||||
|
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value>
|
||||||
|
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
|
||||||
|
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
|
||||||
|
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
|
||||||
|
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
|
||||||
|
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
|
||||||
|
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
|
||||||
|
<value type="int">0</value>
|
||||||
|
<value type="int">1</value>
|
||||||
|
<value type="int">2</value>
|
||||||
|
<value type="int">3</value>
|
||||||
|
<value type="int">4</value>
|
||||||
|
<value type="int">5</value>
|
||||||
|
<value type="int">6</value>
|
||||||
|
<value type="int">7</value>
|
||||||
|
<value type="int">8</value>
|
||||||
|
<value type="int">9</value>
|
||||||
|
<value type="int">10</value>
|
||||||
|
<value type="int">11</value>
|
||||||
|
<value type="int">12</value>
|
||||||
|
<value type="int">13</value>
|
||||||
|
<value type="int">14</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||||
|
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/apps/ESP8266lib/tools/PixelFontGen/PixelFontGen.pro</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/apps/ESP8266lib/tools/PixelFontGen/PixelFontGen.pro</value>
|
||||||
|
<value type="QString" key="RunConfiguration.Arguments"></value>
|
||||||
|
<value type="bool" key="RunConfiguration.Arguments.multi">false</value>
|
||||||
|
<value type="QString" key="RunConfiguration.OverrideDebuggerStartup"></value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||||
|
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
|
||||||
|
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/apps/ESP8266lib/tools/build-PixelFontGen-Desktop-Debug</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||||
|
</valuemap>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||||
|
<value type="int">1</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||||
|
<value type="int">22</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>Version</variable>
|
||||||
|
<value type="int">22</value>
|
||||||
|
</data>
|
||||||
|
</qtcreator>
|
||||||
14
tools/PixelFontGen/main.cpp
Normal file
14
tools/PixelFontGen/main.cpp
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#include "MainWindow.h"
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
|
#include <ESP8266lib/ext/lcd/Draw.h>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
MainWindow w;
|
||||||
|
w.show();
|
||||||
|
|
||||||
|
return a.exec();
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user