Skip to content

Commit b778f35

Browse files
authored
Merge pull request #8 from liangyingy/master
feature/T-PicoC3: Add T-PicoC3 board - Support T-PicoC3 - Add st7789 module
2 parents 609cd9e + e7dfbcd commit b778f35

File tree

11 files changed

+246
-15
lines changed

11 files changed

+246
-15
lines changed

.travis.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
language: c
2+
3+
branches:
4+
only:
5+
- master
6+
7+
8+
jobs:
9+
include:
10+
- stage: micropython_build
11+
env: NAME="micropython build"
12+
install:
13+
- sudo apt-get update
14+
- sudo apt-get install git make python3 python3-pip cmake
15+
script:
16+
- cp config_T5-4.7 config
17+
- make
18+
- cp config_T-CALL config
19+
- make
20+
- cp config_T-SIM7000G config
21+
- make

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,27 @@ $ cp config_T5-4.7 config
2626
$ make
2727
```
2828

29-
### T-T-CALL SIM800
29+
### T-CALL SIM800
3030

3131
```shell
3232
$ cp config_T-CALL config
3333
$ make
3434
```
3535

36+
### T-PicoC3
37+
38+
```shell
39+
$ cp config_T-PicoC3 config
40+
$ sudo apt install gcc-arm-none-eabi libnewlib-arm-none-eabi build-essential
41+
$ make
42+
```
43+
3644
## Supported Boards
3745

38-
- TTGO T-SIM7000G
39-
- TTGO T5-4.7
40-
- TTGO T-T-CALL SIM800
46+
- LilyGo T-SIM7000G
47+
- LilyGo T5-4.7
48+
- LilyGo T-T-CALL SIM800
49+
- LilyGo T-PicoC3
4150

4251
## Modules
4352

config_T-PicoC3

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_TARGET=rp2
2+
CONFIG_BOARD=LILYGO_T_PicoC3

extmod/display/st7789/Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
define st7789/info
3+
PKG_NAME:=st7789
4+
PKG_SOURCE_URL:=https://github.com/russhughes/st7789_mpy.git
5+
PKG_SOURCE_PROTO:=git
6+
PKG_SOURCE_VERSION:=master
7+
PKG_SOURCE_MD5:=
8+
endef
9+
10+
include $(INCLUDE_DIR)/download.mk
11+
include $(INCLUDE_DIR)/package.mk
12+
13+
# PKG_DEPEND:=LilyGo-EPD47
14+
# $(foreach var, $(PKG_DEPEND), make -C $(TOP_DIR)/libs/$(var);)
15+
all:
16+
$(eval $(st7789/info))
17+
$(call Package/prereq,$(TARGET_BUILD_DIR))
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
set(ST7789_DIR ${CMAKE_BINARY_DIR}/../st7789)
2+
3+
include(${ST7789_DIR}/st7789/micropython.cmake)

extmod/micropython.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,8 @@ endif()
99

1010
if(EXTMOD_GSM)
1111
include(${CMAKE_CURRENT_LIST_DIR}/network/gsm/src/micropython.cmake)
12+
endif()
13+
14+
if(EXTMOD_ST7789)
15+
include(${CMAKE_CURRENT_LIST_DIR}/display/st7789/src/micropython.cmake)
1216
endif()

include/package.mk

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,13 @@ endef
3434
##
3535
##
3636
define Package/patches
37+
cd $(1) ; \
38+
quilt import $(2)/* ; \
39+
quilt push -a ; \
40+
cd - ; \
3741
for patch in `ls $(2)` ; \
3842
do \
3943
if [ ! -e $(1)/prereq_$$patch ]; then \
40-
cd $(1) && \
41-
git apply --stat $(2)/$$patch && \
42-
git apply --check $(2)/$$patch && \
43-
git apply $(2)/$$patch && \
44-
cd - && \
4544
touch $(1)/prereq_$$patch ; \
4645
fi ; \
4746
done

micropython/micropython.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ define micropython/info
66
PKG_NAME:=micropython
77
PKG_SOURCE_URL:=https://github.com/micropython/micropython.git
88
PKG_SOURCE_PROTO:=git
9-
PKG_SOURCE_VERSION:=v1.17
9+
PKG_SOURCE_VERSION:=v1.18
1010
PKG_SOURCE_MD5:=639c7fcbe62a8252cf9367147d94c150
1111
endef
1212

1313
define micropython/prereq
1414
$(eval $(micropython/info))
15-
$(call Package/prereq,$(BUILD_DIR))
16-
$(call Package/patches,$(BUILD_DIR)/$(PKG_NAME),$(TOP_DIR)/$(PKG_NAME)/patches)
15+
$(call Package/prereq,$(TARGET_BUILD_DIR))
16+
$(call Package/patches,$(TARGET_BUILD_DIR)/$(PKG_NAME),$(TOP_DIR)/$(PKG_NAME)/patches)
1717
endef
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
Index: micropython/lib/pico-sdk/src/boards/include/boards/lilygo_t_picoc3.h
2+
===================================================================
3+
--- /dev/null
4+
+++ micropython/lib/pico-sdk/src/boards/include/boards/lilygo_t_picoc3.h
5+
@@ -0,0 +1,84 @@
6+
+/*
7+
+ * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
8+
+ *
9+
+ * SPDX-License-Identifier: BSD-3-Clause
10+
+ */
11+
+
12+
+// -----------------------------------------------------
13+
+// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
14+
+// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
15+
+// -----------------------------------------------------
16+
+
17+
+// This header may be included by other board headers as "boards/pico.h"
18+
+
19+
+#ifndef _BOARDS_PICO_H
20+
+#define _BOARDS_PICO_H
21+
+
22+
+// For board detection
23+
+#define RASPBERRYPI_PICO
24+
+
25+
+// --- UART ---
26+
+#ifndef PICO_DEFAULT_UART
27+
+#define PICO_DEFAULT_UART 0
28+
+#endif
29+
+#ifndef PICO_DEFAULT_UART_TX_PIN
30+
+#define PICO_DEFAULT_UART_TX_PIN 0
31+
+#endif
32+
+#ifndef PICO_DEFAULT_UART_RX_PIN
33+
+#define PICO_DEFAULT_UART_RX_PIN 1
34+
+#endif
35+
+
36+
+// --- LED ---
37+
+#ifndef PICO_DEFAULT_LED_PIN
38+
+#define PICO_DEFAULT_LED_PIN 25
39+
+#endif
40+
+// no PICO_DEFAULT_WS2812_PIN
41+
+
42+
+// --- I2C ---
43+
+#ifndef PICO_DEFAULT_I2C
44+
+#define PICO_DEFAULT_I2C 0
45+
+#endif
46+
+#ifndef PICO_DEFAULT_I2C_SDA_PIN
47+
+#define PICO_DEFAULT_I2C_SDA_PIN 4
48+
+#endif
49+
+#ifndef PICO_DEFAULT_I2C_SCL_PIN
50+
+#define PICO_DEFAULT_I2C_SCL_PIN 5
51+
+#endif
52+
+
53+
+// --- SPI ---
54+
+#ifndef PICO_DEFAULT_SPI
55+
+#define PICO_DEFAULT_SPI 0
56+
+#endif
57+
+#ifndef PICO_DEFAULT_SPI_SCK_PIN
58+
+#define PICO_DEFAULT_SPI_SCK_PIN 18
59+
+#endif
60+
+#ifndef PICO_DEFAULT_SPI_TX_PIN
61+
+#define PICO_DEFAULT_SPI_TX_PIN 19
62+
+#endif
63+
+#ifndef PICO_DEFAULT_SPI_RX_PIN
64+
+#define PICO_DEFAULT_SPI_RX_PIN 16
65+
+#endif
66+
+#ifndef PICO_DEFAULT_SPI_CSN_PIN
67+
+#define PICO_DEFAULT_SPI_CSN_PIN 17
68+
+#endif
69+
+
70+
+// --- FLASH ---
71+
+
72+
+#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
73+
+
74+
+#ifndef PICO_FLASH_SPI_CLKDIV
75+
+#define PICO_FLASH_SPI_CLKDIV 2
76+
+#endif
77+
+
78+
+#ifndef PICO_FLASH_SIZE_BYTES
79+
+#define PICO_FLASH_SIZE_BYTES (2 * 1024 * 1024)
80+
+#endif
81+
+
82+
+// Drive high to force power supply into PWM mode (lower ripple on 3V3 at light loads)
83+
+#define PICO_SMPS_MODE_PIN 23
84+
+
85+
+#ifndef PICO_RP2040_B0_SUPPORTED
86+
+#define PICO_RP2040_B0_SUPPORTED 1
87+
+#endif
88+
+
89+
+#endif
90+
Index: micropython/ports/rp2/boards/LILYGO_T_PicoC3/board.json
91+
===================================================================
92+
--- /dev/null
93+
+++ micropython/ports/rp2/boards/LILYGO_T_PicoC3/board.json
94+
@@ -0,0 +1,23 @@
95+
+{
96+
+ "deploy": [
97+
+ "../deploy.md"
98+
+ ],
99+
+ "docs": "",
100+
+ "features": [
101+
+ "WiFi ESP32-C3",
102+
+ "Bluetooth ESP32-C3",
103+
+ "LCD ST7789",
104+
+ "SPI Flash 4MB",
105+
+ "Battery",
106+
+ "USB TYPE-C"
107+
+ ],
108+
+ "id": "rp2-pico",
109+
+ "images": [
110+
+ "rp2-pico.jpg"
111+
+ ],
112+
+ "mcu": "rp2040",
113+
+ "product": "Pico",
114+
+ "thumbnail": "",
115+
+ "url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
116+
+ "vendor": "Raspberry Pi"
117+
+}
118+
Index: micropython/ports/rp2/boards/LILYGO_T_PicoC3/mpconfigboard.cmake
119+
===================================================================
120+
--- /dev/null
121+
+++ micropython/ports/rp2/boards/LILYGO_T_PicoC3/mpconfigboard.cmake
122+
@@ -0,0 +1,2 @@
123+
+# cmake file for Raspberry Pi Pico
124+
+set(EXTMOD_ST7789 1)
125+
\ No newline at end of file
126+
Index: micropython/ports/rp2/boards/LILYGO_T_PicoC3/mpconfigboard.h
127+
===================================================================
128+
--- /dev/null
129+
+++ micropython/ports/rp2/boards/LILYGO_T_PicoC3/mpconfigboard.h
130+
@@ -0,0 +1,3 @@
131+
+// Board and hardware specific configuration
132+
+#define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico"
133+
+#define MICROPY_HW_FLASH_STORAGE_BYTES (1408 * 1024)

target/esp32.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ endef
2828
define esp32/compile
2929
$(TARGET_BUILD_DIR)/esp-idf/install.sh
3030
. $(TARGET_BUILD_DIR)/esp-idf/export.sh && \
31-
make -C $(BUILD_DIR)/micropython/ports/esp32 \
32-
BOARD=$(BOARD) BUILD=$(BUILD_DIR)/$(TARGET)/$(BOARD) \
31+
make -C $(TARGET_BUILD_DIR)/micropython/ports/esp32 \
32+
BOARD=$(BOARD) BUILD=$(TARGET_BUILD_DIR)/$(BOARD) \
3333
USER_C_MODULES=$(TOP_DIR)/extmod/micropython.cmake \
3434
EXTMOD_FROZEN_DIR=$(TOP_DIR)/extmod
3535
endef
@@ -38,7 +38,7 @@ endef
3838
define esp32/install
3939
[ -d $(BIN_DIR) ] && mkdir -p $(BIN_DIR)/esp32/$(BOARD)
4040
img_name=LilyGo-MicroPython_$(TARGET)_$(BOARD) && \
41-
cd $(BUILD_DIR)/micropython && \
41+
cd $(TARGET_BUILD_DIR)/micropython && \
4242
micropython_version=`git show -s --pretty=format:%h` && \
4343
img_name=$${img_name}_MPY-$${micropython_version} && \
4444
cd $(TARGET_BUILD_DIR)/$(PKG_NAME) && \

0 commit comments

Comments
 (0)