mirror of
https://github.com/m5stack/M5Stack_MicroPython.git
synced 2026-05-20 10:14:44 -07:00
Updated 'machine.uart', bug in receive methods fixed
Updated 'ftp' module Initial support for FTDI EVE display modules (FT80x and FT81x) not yet functional
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -15,8 +15,9 @@ menu "MicroPython"
|
||||
string "Time zone"
|
||||
default "GMT0BST"
|
||||
help
|
||||
Set the time zone string used when updating the tome from NTP server
|
||||
You can use 'zones.csv' file to find the time zone string
|
||||
Set the default time zone string used when updating the time from NTP server
|
||||
You can use 'components/micropython/docs/zones.csvzones.csv'
|
||||
file to find the time zone string.
|
||||
Use the second entry for your Region/city as the value set here
|
||||
|
||||
config MICROPY_USE_OTA
|
||||
@@ -211,6 +212,20 @@ menu "MicroPython"
|
||||
help
|
||||
Include websockets module into build
|
||||
|
||||
config MICROPY_USE_DISPLAY
|
||||
bool "Use Display module"
|
||||
default n
|
||||
help
|
||||
Include Display module into build
|
||||
Display module includes support for various SPI TFT displays
|
||||
|
||||
config MICROPY_USE_EVE
|
||||
bool "Use EVE display module"
|
||||
default n
|
||||
help
|
||||
Include EVE display module into build
|
||||
Display module includes support for EVE displays (FT80x, FT81x)
|
||||
|
||||
config MICROPY_USE_GSM
|
||||
bool "Use GSM module"
|
||||
depends on PPP_SUPPORT
|
||||
|
||||
@@ -157,13 +157,16 @@ SRC_C = $(addprefix esp32/,\
|
||||
mpsleep.c \
|
||||
machine_rtc.c \
|
||||
modymodem.c \
|
||||
moddisplay.c \
|
||||
machine_hw_i2c.c \
|
||||
machine_neopixel.c \
|
||||
machine_dht.c \
|
||||
machine_ow.c \
|
||||
)
|
||||
|
||||
ifdef CONFIG_MICROPY_USE_DISPLAY
|
||||
SRC_C += esp32/moddisplay.c
|
||||
endif
|
||||
|
||||
ifdef CONFIG_MICROPY_USE_CURL
|
||||
SRC_C += esp32/modcurl.c
|
||||
endif
|
||||
@@ -226,18 +229,6 @@ LIB_SRC_C = $(addprefix lib/,\
|
||||
LIBS_SRC_C = $(addprefix esp32/libs/,\
|
||||
espcurl.c \
|
||||
neopixel.c \
|
||||
tft/spi_master_lobo.c \
|
||||
tft/tftspi.c \
|
||||
tft/tft.c \
|
||||
tft/comic24.c \
|
||||
tft/DefaultFont.c \
|
||||
tft/DejaVuSans18.c \
|
||||
tft/DejaVuSans24.c \
|
||||
tft/minya24.c \
|
||||
tft/SmallFont.c \
|
||||
tft/tooney32.c \
|
||||
tft/Ubuntu16.c \
|
||||
tft/def_small.c \
|
||||
esp_rmt.c \
|
||||
telnet.c \
|
||||
ftp.c \
|
||||
@@ -248,6 +239,27 @@ LIBS_SRC_C = $(addprefix esp32/libs/,\
|
||||
ow/ds18b20.c \
|
||||
)
|
||||
|
||||
ifdef CONFIG_MICROPY_USE_DISPLAY
|
||||
LIBS_SRC_C += \
|
||||
esp32/libs/tft/spi_master_lobo.c \
|
||||
esp32/libs/tft/tftspi.c \
|
||||
esp32/libs/tft/tft.c \
|
||||
esp32/libs/tft/comic24.c \
|
||||
esp32/libs/tft/DefaultFont.c \
|
||||
esp32/libs/tft/DejaVuSans18.c \
|
||||
esp32/libs/tft/DejaVuSans24.c \
|
||||
esp32/libs/tft/minya24.c \
|
||||
esp32/libs/tft/SmallFont.c \
|
||||
esp32/libs/tft/tooney32.c \
|
||||
esp32/libs/tft/Ubuntu16.c \
|
||||
esp32/libs/tft/def_small.c
|
||||
endif
|
||||
|
||||
ifdef CONFIG_MICROPY_USE_EVE
|
||||
LIBS_SRC_C += \
|
||||
esp32/libs/eve/FT8_commands.c
|
||||
endif
|
||||
|
||||
ifeq ($(MICROPY_PY_BTREE),1)
|
||||
LIB_SRC_C += \
|
||||
lib/berkeley-db-1.xx/btree/bt_open.c \
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,322 @@
|
||||
/*
|
||||
* This file is part of the ESP32 MicroPython project, https://github.com/loboris/MicroPython_ESP32_psRAM_LoBo
|
||||
*
|
||||
* Contains Functions for using the FT8xx
|
||||
* === Ported from https://github.com/RudolphRiedel/FT800-FT813 ===
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2017 Rudolph Riedel
|
||||
* Copyright (c) 2018 LoBo (https://github.com/loboris)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FT8_COMMANDS_H_
|
||||
#define FT8_COMMANDS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* switch over to FT81x */
|
||||
#define FT8_81X_ENABLE
|
||||
|
||||
|
||||
/* select the settings for the TFT attached */
|
||||
#if 0
|
||||
#define FT8_VM800B35A
|
||||
#define FT8_VM800B43A
|
||||
#define FT8_VM800B50A
|
||||
#define FT8_FT810CB_HY50HD
|
||||
#define FT8_FT811CB_HY50HD
|
||||
#define FT8_ET07
|
||||
#define FT8_RVT70AQ
|
||||
#endif
|
||||
|
||||
#define FT8_FT810CB_HY50HD
|
||||
|
||||
|
||||
/* some pre-definded colors */
|
||||
#define RED 0xff0000UL
|
||||
#define ORANGE 0xffa500UL
|
||||
#define GREEN 0x00ff00UL
|
||||
#define BLUE 0x0000ffUL
|
||||
#define YELLOW 0xffff00UL
|
||||
/*#define PINK 0xff00ffUL*/
|
||||
#define PURPLE 0x800080UL
|
||||
#define WHITE 0xffffffUL
|
||||
#define BLACK 0x000000UL
|
||||
|
||||
|
||||
/* VM800B35A: FT800 320x240 3.5" FTDI */
|
||||
#ifdef FT8_VM800B35A
|
||||
#define FT8_VSYNC0 (0L) /* Tvf Vertical Front Porch */
|
||||
#define FT8_VSYNC1 (2L) /* Tvf + Tvp Vertical Front Porch plus Vsync Pulse width */
|
||||
#define FT8_VOFFSET (13L) /* Tvf + Tvp + Tvb Number of non-visible lines (in lines) */
|
||||
#define FT8_VCYCLE (263L) /* Tv Total number of lines (visible and non-visible) (in lines) */
|
||||
#define FT8_VSIZE (240L) /* Tvd Number of visible lines (in lines) - display height */
|
||||
#define FT8_HSYNC0 (0L) /* Thf Horizontal Front Porch */
|
||||
#define FT8_HSYNC1 (10L) /* Thf + Thp Horizontal Front Porch plus Hsync Pulse width */
|
||||
#define FT8_HOFFSET (70L) /* Thf + Thp + Thb Length of non-visible part of line (in PCLK cycles) */
|
||||
#define FT8_HCYCLE (408L) /* Th Total length of line (visible and non-visible) (in PCLKs) */
|
||||
#define FT8_HSIZE (320L) /* Thd Length of visible part of line (in PCLKs) - display width */
|
||||
#define FT8_PCLKPOL (0L) /* PCLK polarity (0 = rising edge, 1 = falling edge) */
|
||||
#define FT8_SWIZZLE (2L) /* Defines the arrangement of the RGB pins of the FT800 */
|
||||
#define FT8_PCLK (8L) /* 48MHz / REG_PCLK = PCLK frequency */
|
||||
#define FT8_TOUCH_RZTHRESH (1200L) /* touch-sensitivity */
|
||||
#define FT8_HAS_CRYSTAL 1 /* use external crystal or internal oscillator? */
|
||||
#endif
|
||||
|
||||
/* VM800B43A: FT800 480x272 4.3" FTDI */
|
||||
#ifdef FT8_VM800B43A
|
||||
#define FT8_VSYNC0 (0L)
|
||||
#define FT8_VSYNC1 (10L)
|
||||
#define FT8_VOFFSET (12L)
|
||||
#define FT8_VCYCLE (292L)
|
||||
#define FT8_VSIZE (272L)
|
||||
#define FT8_HSYNC0 (0L)
|
||||
#define FT8_HSYNC1 (41L)
|
||||
#define FT8_HOFFSET (43L)
|
||||
#define FT8_HCYCLE (548L)
|
||||
#define FT8_HSIZE (480L)
|
||||
#define FT8_PCLKPOL (1L)
|
||||
#define FT8_SWIZZLE (0L)
|
||||
#define FT8_PCLK (5L)
|
||||
#define FT8_TOUCH_RZTHRESH (1200L)
|
||||
#define FT8_HAS_CRYSTAL 1
|
||||
#endif
|
||||
|
||||
/* VM800B50A: FT800 480x272 5.0" FTDI */
|
||||
#ifdef FT8_VM800B50A
|
||||
#define FT8_VSYNC0 (0L)
|
||||
#define FT8_VSYNC1 (10L)
|
||||
#define FT8_VOFFSET (12L)
|
||||
#define FT8_VCYCLE (292L)
|
||||
#define FT8_VSIZE (272L)
|
||||
#define FT8_HSYNC0 (0L)
|
||||
#define FT8_HSYNC1 (41L)
|
||||
#define FT8_HOFFSET (43L)
|
||||
#define FT8_HCYCLE (548L)
|
||||
#define FT8_HSIZE (480L)
|
||||
#define FT8_PCLKPOL (1L)
|
||||
#define FT8_SWIZZLE (0L)
|
||||
#define FT8_PCLK (5L)
|
||||
#define FT8_TOUCH_RZTHRESH (1200L)
|
||||
#define FT8_HAS_CRYSTAL 1
|
||||
#endif
|
||||
|
||||
/* FT810CB-HY50HD: FT810 800x480 5" HAOYU */
|
||||
#ifdef FT8_FT810CB_HY50HD
|
||||
#define FT8_VSYNC0 (0L)
|
||||
#define FT8_VSYNC1 (2L)
|
||||
#define FT8_VOFFSET (13L)
|
||||
#define FT8_VCYCLE (525L)
|
||||
#define FT8_VSIZE (480L)
|
||||
#define FT8_HSYNC0 (0L)
|
||||
#define FT8_HSYNC1 (20L)
|
||||
#define FT8_HOFFSET (64L)
|
||||
#define FT8_HCYCLE (952L)
|
||||
#define FT8_HSIZE (800L)
|
||||
#define FT8_PCLKPOL (1L)
|
||||
#define FT8_SWIZZLE (0L)
|
||||
#define FT8_PCLK (2L)
|
||||
#define FT8_TOUCH_RZTHRESH (2000L) /* touch-sensitivity */
|
||||
#define FT8_HAS_CRYSTAL 1
|
||||
#endif
|
||||
|
||||
/* FT811CB-HY50HD: FT811 800x480 5" HAOYU */
|
||||
#ifdef FT8_FT811CB_HY50HD
|
||||
#define FT8_VSYNC0 (0L)
|
||||
#define FT8_VSYNC1 (2L)
|
||||
#define FT8_VOFFSET (13L)
|
||||
#define FT8_VCYCLE (525L)
|
||||
#define FT8_VSIZE (480L)
|
||||
#define FT8_HSYNC0 (0L)
|
||||
#define FT8_HSYNC1 (20L)
|
||||
#define FT8_HOFFSET (64L)
|
||||
#define FT8_HCYCLE (952L)
|
||||
#define FT8_HSIZE (800L)
|
||||
#define FT8_PCLKPOL (1L)
|
||||
#define FT8_SWIZZLE (0L)
|
||||
#define FT8_PCLK (2L)
|
||||
#define FT8_TOUCH_RZTHRESH (1200L) /* touch-sensitivity */
|
||||
#define FT8_HAS_CRYSTAL 1
|
||||
#endif
|
||||
|
||||
/* some test setup */
|
||||
#ifdef FT8_800x480x
|
||||
#define FT8_VSYNC0 (0L) /* Tvf Vertical Front Porch */
|
||||
#define FT8_VSYNC1 (10L) /* Tvf + Tvp Vertical Front Porch plus Vsync Pulse width */
|
||||
#define FT8_VOFFSET (35L) /* Tvf + Tvp + Tvb Number of non-visible lines (in lines) */
|
||||
#define FT8_VCYCLE (516L) /* Tv Total number of lines (visible and non-visible) (in lines) */
|
||||
#define FT8_VSIZE (480L) /* Tvd Number of visible lines (in lines) - display height */
|
||||
#define FT8_HSYNC0 (0L) /* (40L) // Thf Horizontal Front Porch */
|
||||
#define FT8_HSYNC1 (88L) /* Thf + Thp Horizontal Front Porch plus Hsync Pulse width */
|
||||
#define FT8_HOFFSET (169L) /* Thf + Thp + Thb Length of non-visible part of line (in PCLK cycles) */
|
||||
#define FT8_HCYCLE (969L) /* Th Total length of line (visible and non-visible) (in PCLKs) */
|
||||
#define FT8_HSIZE (800L) /* Thd Length of visible part of line (in PCLKs) - display width */
|
||||
#define FT8_PCLKPOL (1L) /* PCLK polarity (0 = rising edge, 1 = falling edge) */
|
||||
#define FT8_SWIZZLE (0L) /* Defines the arrangement of the RGB pins of the FT800 */
|
||||
#define FT8_PCLK (2L) /* 60MHz / REG_PCLK = PCLK frequency 30 MHz */
|
||||
#define FT8_TOUCH_RZTHRESH (1200L) /* touch-sensitivity */
|
||||
#define FT8_HAS_CRYSTAL 1
|
||||
#endif
|
||||
|
||||
/* G-ET0700G0DM6 800x480 7" Glyn, untested */
|
||||
#ifdef FT8_ET07
|
||||
#define FT8_VSYNC0 (0L)
|
||||
#define FT8_VSYNC1 (2L)
|
||||
#define FT8_VOFFSET (35L)
|
||||
#define FT8_VCYCLE (525L)
|
||||
#define FT8_VSIZE (480L)
|
||||
#define FT8_HSYNC0 (0L)
|
||||
#define FT8_HSYNC1 (128L)
|
||||
#define FT8_HOFFSET (203L)
|
||||
#define FT8_HCYCLE (1056L)
|
||||
#define FT8_HSIZE (800L)
|
||||
#define FT8_PCLKPOL (1L)
|
||||
#define FT8_SWIZZLE (0L)
|
||||
#define FT8_PCLK (2L)
|
||||
#define FT8_TOUCH_RZTHRESH (1200L)
|
||||
#define FT8_HAS_CRYSTAL 0 /* no idea if these come with a crystal populated or not */
|
||||
#endif
|
||||
|
||||
/* RVT70AQxxxxxx 800x480 7" Riverdi, various options, FT812/FT813, tested with RVT70UQFNWC0x */
|
||||
#ifdef FT8_RVT70AQ
|
||||
#define FT8_VSYNC0 (0L) /* Tvf Vertical Front Porch */
|
||||
#define FT8_VSYNC1 (10L) /* Tvf + Tvp Vertical Front Porch plus Vsync Pulse width */
|
||||
#define FT8_VOFFSET (23L) /* Tvf + Tvp + Tvb Number of non-visible lines (in lines) */
|
||||
#define FT8_VCYCLE (525L) /* Tv Total number of lines (visible and non-visible) (in lines) */
|
||||
#define FT8_VSIZE (480L) /* Tvd Number of visible lines (in lines) - display height */
|
||||
#define FT8_HSYNC0 (0L) /* Thf Horizontal Front Porch */
|
||||
#define FT8_HSYNC1 (10L) /* Thf + Thp Horizontal Front Porch plus Hsync Pulse width */
|
||||
#define FT8_HOFFSET (46L) /* Thf + Thp + Thb Length of non-visible part of line (in PCLK cycles) */
|
||||
#define FT8_HCYCLE (1056L) /* Th Total length of line (visible and non-visible) (in PCLKs) */
|
||||
#define FT8_HSIZE (800L) /* Thd Length of visible part of line (in PCLKs) - display width */
|
||||
#define FT8_PCLKPOL (1L) /* PCLK polarity (0 = rising edge, 1 = falling edge) */
|
||||
#define FT8_SWIZZLE (0L) /* Defines the arrangement of the RGB pins of the FT800 */
|
||||
#define FT8_PCLK (2L) /* 60MHz / REG_PCLK = PCLK frequency 30 MHz */
|
||||
#define FT8_TOUCH_RZTHRESH (1800L) /* touch-sensitivity */
|
||||
#define FT8_HAS_CRYSTAL 0
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
||||
extern uint16_t eve_cmdOffset;
|
||||
|
||||
void FT8_cmdWrite(uint8_t data);
|
||||
|
||||
uint8_t FT8_memRead8(uint32_t ftAddress);
|
||||
uint16_t FT8_memRead16(uint32_t ftAddress);
|
||||
uint32_t FT8_memRead32(uint32_t ftAddress);
|
||||
void FT8_memWrite8(uint32_t ftAddress, uint8_t ftData8);
|
||||
void FT8_memWrite16(uint32_t ftAddress, uint16_t ftData16);
|
||||
void FT8_memWrite32(uint32_t ftAddress, uint32_t ftData32);
|
||||
void FT8_memWrite_flash_buffer(uint32_t ftAddress, const uint8_t *data, uint16_t len);
|
||||
uint8_t FT8_busy(void);
|
||||
void FT8_cmd_dl(uint32_t command);
|
||||
|
||||
void FT8_get_cmdoffset(void);
|
||||
uint32_t FT8_get_touch_tag(void);
|
||||
void FT8_cmd_start(void);
|
||||
void FT8_cmd_execute(void);
|
||||
|
||||
void FT8_start_cmd_burst(void);
|
||||
void FT8_end_cmd_burst(void);
|
||||
|
||||
/* commands to draw graphics objects: */
|
||||
void FT8_cmd_text(int16_t x0, int16_t y0, int16_t font, uint16_t options, const char* text);
|
||||
void FT8_cmd_button(int16_t x0, int16_t y0, int16_t w0, int16_t h0, int16_t font, uint16_t options, const char* text);
|
||||
void FT8_cmd_clock(int16_t x0, int16_t y0, int16_t r0, uint16_t options, uint16_t hours, uint16_t minutes, uint16_t seconds, uint16_t millisecs);
|
||||
void FT8_cmd_bgcolor(uint32_t color);
|
||||
void FT8_cmd_fgcolor(uint32_t color);
|
||||
void FT8_cmd_gradcolor(uint32_t color);
|
||||
void FT8_cmd_gauge(int16_t x0, int16_t y0, int16_t r0, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range);
|
||||
void FT8_cmd_gradient(int16_t x0, int16_t y0, uint32_t rgb0, int16_t x1, int16_t y1, uint32_t rgb1);
|
||||
void FT8_cmd_keys(int16_t x0, int16_t y0, int16_t w0, int16_t h0, int16_t font, uint16_t options, const char* text);
|
||||
void FT8_cmd_progress(int16_t x0, int16_t y0, int16_t w0, int16_t h0, uint16_t options, uint16_t val, uint16_t range);
|
||||
void FT8_cmd_scrollbar(int16_t x0, int16_t y0, int16_t w0, int16_t h0, uint16_t options, uint16_t val, uint16_t size, uint16_t range);
|
||||
void FT8_cmd_slider(int16_t x1, int16_t y1, int16_t w1, int16_t h1, uint16_t options, uint16_t val, uint16_t range);
|
||||
void FT8_cmd_dial(int16_t x0, int16_t y0, int16_t r0, uint16_t options, uint16_t val);
|
||||
void FT8_cmd_toggle(int16_t x0, int16_t y0, int16_t w0, int16_t font, uint16_t options, uint16_t state, const char* text);
|
||||
void FT8_cmd_number(int16_t x0, int16_t y0, int16_t font, uint16_t options, int32_t number);
|
||||
|
||||
#ifdef FT8_81X_ENABLE
|
||||
void FT8_cmd_setbase(uint32_t base);
|
||||
void FT8_cmd_setbitmap(uint32_t addr, uint16_t fmt, uint16_t width, uint16_t height);
|
||||
#endif
|
||||
|
||||
/* commands to operate on memory: */
|
||||
void FT8_cmd_memzero(uint32_t ptr, uint32_t num);
|
||||
void FT8_cmd_memset(uint32_t ptr, uint8_t value, uint32_t num);
|
||||
/*(void FT8_cmd_memwrite(uint32_t dest, uint32_t num, const uint8_t *data); */
|
||||
void FT8_cmd_memcpy(uint32_t dest, uint32_t src, uint32_t num);
|
||||
void FT8_cmd_append(uint32_t ptr, uint32_t num);
|
||||
|
||||
|
||||
/* commands for loading image data into FT8xx memory: */
|
||||
void FT8_cmd_inflate(uint32_t ptr, const uint8_t *data, uint16_t len);
|
||||
void FT8_cmd_loadimage(uint32_t ptr, uint32_t options, const uint8_t *data, uint16_t len);
|
||||
#ifdef FT8_81X_ENABLE
|
||||
void FT8_cmd_mediafifo(uint32_t ptr, uint32_t size);
|
||||
#endif
|
||||
|
||||
/* commands for setting the bitmap transform matrix: */
|
||||
void FT8_cmd_translate(int32_t tx, int32_t ty);
|
||||
void FT8_cmd_scale(int32_t sx, int32_t sy);
|
||||
void FT8_cmd_rotate(int32_t ang);
|
||||
void FT8_cmd_getmatrix(int32_t a, int32_t b, int32_t c, int32_t d, int32_t e, int32_t f);
|
||||
|
||||
|
||||
/* other commands: */
|
||||
void FT8_cmd_calibrate(void);
|
||||
void FT8_cmd_interrupt(uint32_t ms);
|
||||
void FT8_cmd_setfont(uint32_t font, uint32_t ptr);
|
||||
#ifdef FT8_81X_ENABLE
|
||||
void FT8_cmd_romfont(uint32_t font, uint32_t romslot);
|
||||
void FT8_cmd_setfont2(uint32_t font, uint32_t ptr, uint32_t firstchar);
|
||||
void FT8_cmd_setrotate(uint32_t r);
|
||||
void FT8_cmd_setscratch(uint32_t handle);
|
||||
#endif
|
||||
void FT8_cmd_sketch(int16_t x0, int16_t y0, uint16_t w0, uint16_t h0, uint32_t ptr, uint16_t format);
|
||||
void FT8_cmd_snapshot(uint32_t ptr);
|
||||
#ifdef FT8_81X_ENABLE
|
||||
void FT8_cmd_snapshot2(uint32_t fmt, uint32_t ptr, int16_t x0, int16_t y0, int16_t w0, int16_t h0);
|
||||
#endif
|
||||
void FT8_cmd_spinner(int16_t x0, int16_t y0, uint16_t style, uint16_t scale);
|
||||
void FT8_cmd_track(int16_t x0, int16_t y0, int16_t w0, int16_t h0, int16_t tag);
|
||||
|
||||
|
||||
/* commands that return values by writing to the command-fifo */
|
||||
uint16_t FT8_cmd_memcrc(uint32_t ptr, uint32_t num);
|
||||
uint16_t FT8_cmd_getptr(void);
|
||||
uint16_t FT8_cmd_regread(uint32_t ptr);
|
||||
uint16_t FT8_cmd_getprops(uint32_t ptr);
|
||||
|
||||
|
||||
/* meta-commands, sequences of several display-list entries condensed into simpler to use functions at the price of some overhead */
|
||||
void FT8_cmd_point(int16_t x0, int16_t y0, uint16_t size);
|
||||
void FT8_cmd_line(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t w0);
|
||||
void FT8_cmd_rect(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t corner);
|
||||
|
||||
|
||||
/* startup FT8xx: */
|
||||
uint8_t FT8_init(void);
|
||||
|
||||
#endif // FT8_COMMANDS_H_
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -747,7 +747,8 @@ static void ftp_process_cmd (void) {
|
||||
if (result == E_FTP_RESULT_OK) {
|
||||
// bufptr is moved as commands are being popped
|
||||
ftp_cmd_index_t cmd = ftp_pop_command(&bufptr);
|
||||
if (!ftp_data.loggin.passvalid && (cmd != E_FTP_CMD_USER && cmd != E_FTP_CMD_PASS && cmd != E_FTP_CMD_QUIT)) {
|
||||
if (!ftp_data.loggin.passvalid &&
|
||||
((cmd != E_FTP_CMD_USER) && (cmd != E_FTP_CMD_PASS) && (cmd != E_FTP_CMD_QUIT) && (cmd != E_FTP_CMD_FEAT))) {
|
||||
ftp_send_reply(332, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -456,6 +456,7 @@ static const uint8_t Rcmd3[] = {
|
||||
// ==== Public functions =========================================================
|
||||
|
||||
// == Low level functions; usually not used directly ==
|
||||
|
||||
esp_err_t wait_trans_finish(uint8_t free_line);
|
||||
void disp_spi_transfer_cmd(int8_t cmd);
|
||||
void disp_spi_transfer_cmd_data(int8_t cmd, uint8_t *data, uint32_t len);
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "py/runtime.h"
|
||||
#include "py/stream.h"
|
||||
#include "py/mperrno.h"
|
||||
#include "py/mphal.h"
|
||||
#include "modmachine.h"
|
||||
|
||||
typedef struct _machine_uart_obj_t {
|
||||
@@ -47,7 +48,8 @@ typedef struct _machine_uart_obj_t {
|
||||
int8_t rts;
|
||||
int8_t cts;
|
||||
uint16_t timeout; // timeout waiting for first char (in ms)
|
||||
uint16_t timeout_char; // timeout waiting between chars (in ms)
|
||||
uint16_t timeout_char; // timeout character
|
||||
uint16_t buffer_size;
|
||||
} machine_uart_obj_t;
|
||||
|
||||
STATIC const char *_parity_name[] = {"None", "1", "0"};
|
||||
@@ -62,26 +64,28 @@ STATIC void machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_pri
|
||||
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
uint32_t baudrate;
|
||||
uart_get_baudrate(self->uart_num, &baudrate);
|
||||
mp_printf(print, "UART(%u, baudrate=%u, bits=%u, parity=%s, stop=%u, tx=%d, rx=%d, rts=%d, cts=%d, timeout=%u, timeout_char=%u)",
|
||||
mp_printf(print, "UART(%u, baudrate=%u, bits=%u, parity=%s, stop=%u, tx=%d, rx=%d, rts=%d, cts=%d, timeout=%u, timeout_char=%u, buf_size=%u)",
|
||||
self->uart_num, baudrate, self->bits, _parity_name[self->parity],
|
||||
self->stop, self->tx, self->rx, self->rts, self->cts, self->timeout, self->timeout_char);
|
||||
self->stop, self->tx, self->rx, self->rts, self->cts, self->timeout, self->timeout_char, self->buffer_size);
|
||||
}
|
||||
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_baudrate, MP_ARG_INT, {.u_int = 0} },
|
||||
{ MP_QSTR_bits, MP_ARG_INT, {.u_int = 0} },
|
||||
{ MP_QSTR_parity, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
|
||||
{ MP_QSTR_stop, MP_ARG_INT, {.u_int = 0} },
|
||||
{ MP_QSTR_tx, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = UART_PIN_NO_CHANGE} },
|
||||
{ MP_QSTR_rx, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = UART_PIN_NO_CHANGE} },
|
||||
{ MP_QSTR_rts, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = UART_PIN_NO_CHANGE} },
|
||||
{ MP_QSTR_cts, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = UART_PIN_NO_CHANGE} },
|
||||
{ MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
|
||||
{ MP_QSTR_timeout_char, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
|
||||
{ MP_QSTR_buffer_size, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
STATIC void machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_baudrate, ARG_bits, ARG_parity, ARG_stop, ARG_tx, ARG_rx, ARG_rts, ARG_cts, ARG_timeout, ARG_timeout_char };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_baudrate, MP_ARG_INT, {.u_int = 0} },
|
||||
{ MP_QSTR_bits, MP_ARG_INT, {.u_int = 0} },
|
||||
{ MP_QSTR_parity, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
|
||||
{ MP_QSTR_stop, MP_ARG_INT, {.u_int = 0} },
|
||||
{ MP_QSTR_tx, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = UART_PIN_NO_CHANGE} },
|
||||
{ MP_QSTR_rx, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = UART_PIN_NO_CHANGE} },
|
||||
{ MP_QSTR_rts, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = UART_PIN_NO_CHANGE} },
|
||||
{ MP_QSTR_cts, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = UART_PIN_NO_CHANGE} },
|
||||
{ MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
|
||||
{ MP_QSTR_timeout_char, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
|
||||
};
|
||||
enum { ARG_baudrate, ARG_bits, ARG_parity, ARG_stop, ARG_tx, ARG_rx, ARG_rts, ARG_cts, ARG_timeout, ARG_timeout_char, ARG_buffer_size };
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
@@ -245,6 +249,18 @@ STATIC mp_obj_t machine_uart_make_new(const mp_obj_type_t *type, size_t n_args,
|
||||
break;
|
||||
}
|
||||
|
||||
mp_map_t kw_args;
|
||||
mp_map_init_fixed_table(&kw_args, n_kw, args + n_args);
|
||||
|
||||
enum { ARG_baudrate, ARG_bits, ARG_parity, ARG_stop, ARG_tx, ARG_rx, ARG_rts, ARG_cts, ARG_timeout, ARG_timeout_char, ARG_buffer_size };
|
||||
mp_arg_val_t kargs[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args-1, args+1, &kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, kargs);
|
||||
|
||||
int bufsize = kargs[ARG_buffer_size].u_int;
|
||||
if (bufsize < 256) bufsize = 256;
|
||||
if (bufsize > 4096) bufsize = 4096;
|
||||
self->buffer_size = bufsize;
|
||||
|
||||
// Remove any existing configuration
|
||||
uart_driver_delete(self->uart_num);
|
||||
|
||||
@@ -253,13 +269,13 @@ STATIC mp_obj_t machine_uart_make_new(const mp_obj_type_t *type, size_t n_args,
|
||||
uart_param_config(self->uart_num, &uartcfg);
|
||||
|
||||
// RX and TX buffers are currently hardcoded at 256 and 256 bytes respectively.
|
||||
esp_err_t res = uart_driver_install(uart_num, 256, 0, 10, &UART_QUEUE[self->uart_num], 0);
|
||||
//esp_err_t res = uart_driver_install(uart_num, 256, 0, 10, &UART_QUEUE[self->uart_num], 0);
|
||||
esp_err_t res = uart_driver_install(uart_num, bufsize, 0, 0, NULL, 0);
|
||||
if (res != ESP_OK) {
|
||||
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "UART(%d) Error installing driver", uart_num));
|
||||
}
|
||||
|
||||
mp_map_t kw_args;
|
||||
mp_map_init_fixed_table(&kw_args, n_kw, args + n_args);
|
||||
|
||||
machine_uart_init_helper(self, n_args - 1, args + 1, &kw_args);
|
||||
|
||||
// Make sure pins are connected.
|
||||
@@ -305,14 +321,22 @@ STATIC mp_uint_t machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t siz
|
||||
return 0;
|
||||
}
|
||||
|
||||
TickType_t time_to_wait;
|
||||
int bytes_read = 0;
|
||||
mp_hal_set_wdt_tmo();
|
||||
if (self->timeout == 0) {
|
||||
time_to_wait = 0;
|
||||
} else {
|
||||
time_to_wait = pdMS_TO_TICKS(self->timeout);
|
||||
bytes_read = uart_read_bytes(self->uart_num, buf_in, size, 0);
|
||||
}
|
||||
else {
|
||||
int wait = self->timeout;
|
||||
MP_THREAD_GIL_EXIT();
|
||||
while (wait > 0) {
|
||||
bytes_read = uart_read_bytes(self->uart_num, buf_in, size, pdMS_TO_TICKS(10));
|
||||
if (bytes_read != 0) break;
|
||||
mp_hal_reset_wdt();
|
||||
wait -= 10;
|
||||
}
|
||||
MP_THREAD_GIL_ENTER();
|
||||
}
|
||||
|
||||
int bytes_read = uart_read_bytes(self->uart_num, buf_in, size, time_to_wait);
|
||||
|
||||
if (bytes_read < 0) {
|
||||
*errcode = MP_EAGAIN;
|
||||
|
||||
@@ -27,6 +27,10 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifdef CONFIG_MICROPY_USE_DISPLAY
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -1407,3 +1411,4 @@ const mp_obj_module_t mp_module_display = {
|
||||
.globals = (mp_obj_dict_t*)&display_module_globals,
|
||||
};
|
||||
|
||||
#endif // CONFIG_MICROPY_USE_DISPLAY
|
||||
|
||||
@@ -219,7 +219,6 @@ extern const struct _mp_obj_module_t mp_module_usocket;
|
||||
extern const struct _mp_obj_module_t mp_module_machine;
|
||||
extern const struct _mp_obj_module_t mp_module_network;
|
||||
extern const struct _mp_obj_module_t mp_module_ymodem;
|
||||
extern const struct _mp_obj_module_t mp_module_display;
|
||||
|
||||
#ifdef CONFIG_MICROPY_USE_CURL
|
||||
extern const struct _mp_obj_module_t mp_module_curl;
|
||||
@@ -235,6 +234,13 @@ extern const struct _mp_obj_module_t mp_module_ssh;
|
||||
#define BUILTIN_MODULE_SSH
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MICROPY_USE_DISPLAY
|
||||
extern const struct _mp_obj_module_t mp_module_display;
|
||||
#define BUILTIN_MODULE_DISPLAY { MP_OBJ_NEW_QSTR(MP_QSTR_display), (mp_obj_t)&mp_module_display },
|
||||
#else
|
||||
#define BUILTIN_MODULE_DISPLAY
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MICROPY_USE_GSM
|
||||
extern const struct _mp_obj_module_t mp_module_gsm;
|
||||
#define BUILTIN_MODULE_GSM { MP_OBJ_NEW_QSTR(MP_QSTR_gsm), (mp_obj_t)&mp_module_gsm },
|
||||
@@ -256,7 +262,7 @@ extern const struct _mp_obj_module_t mp_module_ota;
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_machine), (mp_obj_t)&mp_module_machine }, \
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_network), (mp_obj_t)&mp_module_network }, \
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_ymodem), (mp_obj_t)&mp_module_ymodem }, \
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_display), (mp_obj_t)&mp_module_display }, \
|
||||
BUILTIN_MODULE_DISPLAY \
|
||||
BUILTIN_MODULE_CURL \
|
||||
BUILTIN_MODULE_SSH \
|
||||
BUILTIN_MODULE_GSM \
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user