Skip to content

Commit

Permalink
update micropython library to ver1.19 and update readme files
Browse files Browse the repository at this point in the history
  • Loading branch information
benpoon-microchip committed Apr 4, 2023
1 parent b67a45b commit a748fac
Show file tree
Hide file tree
Showing 174 changed files with 3,568 additions and 1,590 deletions.
4 changes: 3 additions & 1 deletion example_scripts/http_get/main.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import network
import socket

ssid = 'demo_ap'
password = 'password'
nic=network.WLAN(network.STA_IF)
nic.active(True)
nic.connect('mchp_demo', 'mchp5678')
nic.connect(ssid, password)
while not nic.isconnected():
pass
print("wifi connection is done")
Expand Down
9 changes: 7 additions & 2 deletions example_scripts/http_server/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import umachine
import network

ssid = 'demo_ap'
password = '12345678'

pins = [umachine.Pin(i, umachine.Pin.IN) for i in (16, 41, 47)]

html = """<!DOCTYPE html>
Expand All @@ -10,10 +15,10 @@
</html>
"""

import network

nic=network.WLAN(network.STA_IF)
nic.active(True)
nic.connect('mchp_demo', 'mchp5678')
nic.connect(ssid, password)
while not nic.isconnected():
pass
print("wifi connection is done")
Expand Down
8 changes: 8 additions & 0 deletions example_scripts/http_server/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Highlights
* This example show the device acting as TCP server, with a simple HTTP website to show some GPIO's value
* Edit main.py, input variables *ssid* and *password* with the Target AP SSID and password
* Console log display the assigned IP address
* Connect your PC to the same network, browser the device webpge by typing http://<DEIVCE_IP_ADDR>, the webpage show the pin 16, 41, 47's value
</p>
<p align="center"><img width="500" src="./../../images/tcp_server_webpage.jpg">
</p>
4 changes: 3 additions & 1 deletion example_scripts/tcp_client/main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import network
import socket

ssid = 'demo_ap'
password = '12345678'
ip = '192.168.2.147'
port = 6666

nic=network.WLAN(network.STA_IF)
nic.active(True)
nic.connect('mchp_demo', 'mchp5678')
nic.connect(ssid, password)
while not nic.isconnected():
pass
print("wifi connection is done")
Expand Down
6 changes: 6 additions & 0 deletions example_scripts/tcp_client/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Highlights
* This example show the device acting as TCP client, connect to the TCP server that running on PC
* Edit main.py, input variables *ssid* and *password* with the Target AP SSID and password
* Edit main.py, input *ip* with your PC's IP address
* Connect your PC to the same network, execute utilities/tcp_server.py on your PC
* Power on the board after the TCP server start running on your PC
4 changes: 3 additions & 1 deletion example_scripts/tcp_server_with_multiple_socket/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@

i = 0
connections = []
ssid = 'demo_ap'
password = '12345678'

nic=network.WLAN(network.STA_IF)
nic.active(True)
nic.disconnect()
nic.connect('mchp_demo', 'mchp5678')
nic.connect(ssid, password)
while not nic.isconnected():
pass
print("wifi connection is done")
Expand Down
6 changes: 6 additions & 0 deletions example_scripts/tcp_server_with_multiple_socket/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Highlights
* This example show the device is acting as TCP server, which can accept mutliple sockets
* Edit main.py, input variables *ssid* and *password* with the Target AP SSID and password
* Console log display the assigned IP address
* Edit utilities/tcp_client.py, modify the *ip* value
* Connect your PC to the same network, run utilities/tcp_client.py to connect the TCP server running on the device
Original file line number Diff line number Diff line change
@@ -1,13 +1,51 @@
// Automatically generated by makemoduledefs.py.

#include "../../mpconfigport.h"
#if (MICROPY_PY_ARRAY)
extern const struct _mp_obj_module_t mp_module_uarray;
#define MODULE_DEF_MP_QSTR_UARRAY { MP_ROM_QSTR(MP_QSTR_uarray), MP_ROM_PTR(&mp_module_uarray) },
#else
#define MODULE_DEF_MP_QSTR_UARRAY
#endif

//#if MICROPY_PY_GC && MICROPY_ENABLE_GC
extern const struct _mp_obj_module_t mp_module_gc;
extern const struct _mp_obj_module_t mp_module_array;
extern const struct _mp_obj_module_t mp_module_collections;
extern const struct _mp_obj_module_t mp_module_ustruct;
extern const struct _mp_obj_module_t mp_module_ujson;
extern const struct _mp_obj_module_t mp_module_uselect;
#define MODULE_DEF_MP_QSTR_GC { MP_ROM_QSTR(MP_QSTR_gc), MP_ROM_PTR(&mp_module_gc) },
#define MODULE_DEF_MP_QSTR_ARRAY { MP_ROM_QSTR(MP_QSTR_array), MP_ROM_PTR(&mp_type_array) },
#define MODULE_DEF_MP_QSTR_UCOLLECTIONS { MP_ROM_QSTR(MP_QSTR_ucollections), MP_ROM_PTR(&mp_module_collections) },
#define MODULE_DEF_MP_QSTR_USTRUCT { MP_ROM_QSTR(MP_QSTR_ustruct), MP_ROM_PTR(&mp_module_ustruct) },
#define MODULE_DEF_MP_QSTR_UJSON { MP_ROM_QSTR(MP_QSTR_ujson), MP_ROM_PTR(&mp_module_ujson) },
#define MODULE_DEF_MP_QSTR_USELECT { MP_ROM_QSTR(MP_QSTR_uselect), MP_ROM_PTR(&mp_module_uselect) },


//#else
// #define MODULE_DEF_MP_QSTR_GC
//#endif

extern const struct _mp_obj_module_t pyb_module;
extern const struct _mp_obj_module_t test_module;
extern const struct _mp_obj_module_t mp_module_network;
extern const struct _mp_obj_module_t mp_module_machine;
extern const struct _mp_obj_module_t mp_module_usocket;
extern const struct _mp_obj_module_t utime_module;


#define MICROPY_REGISTERED_MODULES \
MODULE_DEF_MP_QSTR_UARRAY \
MODULE_DEF_MP_QSTR_ARRAY \
MODULE_DEF_MP_QSTR_GC \
MODULE_DEF_MP_QSTR_UCOLLECTIONS \
MODULE_DEF_MP_QSTR_USTRUCT \
MODULE_DEF_MP_QSTR_USELECT \
{ MP_ROM_QSTR(MP_QSTR_pyb), MP_ROM_PTR(&pyb_module) }, \
{ MP_ROM_QSTR(MP_QSTR_test), MP_ROM_PTR(&test_module) }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_network), (mp_obj_t)&mp_module_network }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_umachine), (mp_obj_t)&mp_module_machine }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_socket), (mp_obj_t)&mp_module_usocket }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_utime), (mp_obj_t)&utime_module }, \
\
// MICROPY_REGISTERED_MODULES
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by py/makeversionhdr.py
#define MICROPY_GIT_TAG "v1.18-330-gd242a9b7f-dirty"
#define MICROPY_GIT_HASH "d242a9b7f-dirty"
#define MICROPY_BUILD_DATE "2022-04-13"
#define MICROPY_GIT_TAG "v1.19"
#define MICROPY_GIT_HASH ""
#define MICROPY_BUILD_DATE "2023-04-01"
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ QDEF(MP_QSTR_active, 60009, 6, "active")
QDEF(MP_QSTR_addr, 31414, 4, "addr")
QDEF(MP_QSTR_addrsize, 37267, 8, "addrsize")
QDEF(MP_QSTR_arg, 13457, 3, "arg")
QDEF(MP_QSTR_array, 29308, 5, "array")
QDEF(MP_QSTR_atten, 20655, 5, "atten")
QDEF(MP_QSTR_authmode, 26062, 8, "authmode")
QDEF(MP_QSTR_baudrate, 55541, 8, "baudrate")
Expand All @@ -260,6 +261,7 @@ QDEF(MP_QSTR_bits, 26697, 4, "bits")
QDEF(MP_QSTR_block, 26092, 5, "block")
QDEF(MP_QSTR_bound_method, 41623, 12, "bound_method")
QDEF(MP_QSTR_bssid, 15434, 5, "bssid")
QDEF(MP_QSTR_calcsize, 14413, 8, "calcsize")
QDEF(MP_QSTR_callback, 61516, 8, "callback")
QDEF(MP_QSTR_channel, 37158, 7, "channel")
QDEF(MP_QSTR_closure, 51828, 7, "closure")
Expand All @@ -274,6 +276,8 @@ QDEF(MP_QSTR_dhcp_hostname, 18850, 13, "dhcp_hostname")
QDEF(MP_QSTR_dict_view, 43309, 9, "dict_view")
QDEF(MP_QSTR_disable, 30353, 7, "disable")
QDEF(MP_QSTR_disconnect, 34213, 10, "disconnect")
QDEF(MP_QSTR_dump, 12265, 4, "dump")
QDEF(MP_QSTR_dumps, 11642, 5, "dumps")
QDEF(MP_QSTR_elapsed_millis, 49806, 14, "elapsed_millis")
QDEF(MP_QSTR_enable, 56836, 6, "enable")
QDEF(MP_QSTR_enumerate, 47729, 9, "enumerate")
Expand Down Expand Up @@ -305,6 +309,8 @@ QDEF(MP_QSTR_isconnected, 39296, 11, "isconnected")
QDEF(MP_QSTR_isenabled, 58778, 9, "isenabled")
QDEF(MP_QSTR_iterator, 48711, 8, "iterator")
QDEF(MP_QSTR_listen, 3788, 6, "listen")
QDEF(MP_QSTR_load, 9315, 4, "load")
QDEF(MP_QSTR_loads, 45232, 5, "loads")
QDEF(MP_QSTR_mac, 17322, 3, "mac")
QDEF(MP_QSTR_makefile, 54721, 8, "makefile")
QDEF(MP_QSTR_max, 17329, 3, "max")
Expand All @@ -320,11 +326,14 @@ QDEF(MP_QSTR_mode, 49190, 4, "mode")
QDEF(MP_QSTR_modify, 26357, 6, "modify")
QDEF(MP_QSTR_module, 39359, 6, "module")
QDEF(MP_QSTR_mosi, 49693, 4, "mosi")
QDEF(MP_QSTR_namedtuple, 5662, 10, "namedtuple")
QDEF(MP_QSTR_network, 10331, 7, "network")
QDEF(MP_QSTR_oct, 23805, 3, "oct")
QDEF(MP_QSTR_off, 23690, 3, "off")
QDEF(MP_QSTR_on, 28516, 2, "on")
QDEF(MP_QSTR_opt_level, 26503, 9, "opt_level")
QDEF(MP_QSTR_pack, 53692, 4, "pack")
QDEF(MP_QSTR_pack_into, 43295, 9, "pack_into")
QDEF(MP_QSTR_parity, 1346, 6, "parity")
QDEF(MP_QSTR_password, 28570, 8, "password")
QDEF(MP_QSTR_pend_throw, 29939, 10, "pend_throw")
Expand Down Expand Up @@ -361,6 +370,7 @@ QDEF(MP_QSTR_select, 16781, 6, "select")
QDEF(MP_QSTR_sendall, 40760, 7, "sendall")
QDEF(MP_QSTR_sendbreak, 4550, 9, "sendbreak")
QDEF(MP_QSTR_sendto, 802, 6, "sendto")
QDEF(MP_QSTR_separators, 3307, 10, "separators")
QDEF(MP_QSTR_setblocking, 6254, 11, "setblocking")
QDEF(MP_QSTR_setsockopt, 59448, 10, "setsockopt")
QDEF(MP_QSTR_settimeout, 35548, 10, "settimeout")
Expand All @@ -379,10 +389,16 @@ QDEF(MP_QSTR_toggle, 17335, 6, "toggle")
QDEF(MP_QSTR_trigger, 35997, 7, "trigger")
QDEF(MP_QSTR_tx, 28553, 2, "tx")
QDEF(MP_QSTR_txbuf, 50808, 5, "txbuf")
QDEF(MP_QSTR_uarray, 34441, 6, "uarray")
QDEF(MP_QSTR_ucollections, 39445, 12, "ucollections")
QDEF(MP_QSTR_ujson, 12520, 5, "ujson")
QDEF(MP_QSTR_umachine, 32661, 8, "umachine")
QDEF(MP_QSTR_unpack, 15367, 6, "unpack")
QDEF(MP_QSTR_unpack_from, 27918, 11, "unpack_from")
QDEF(MP_QSTR_unregister, 54295, 10, "unregister")
QDEF(MP_QSTR_uselect, 36440, 7, "uselect")
QDEF(MP_QSTR_usocket, 117, 7, "usocket")
QDEF(MP_QSTR_ustruct, 2119, 7, "ustruct")
QDEF(MP_QSTR_width, 29987, 5, "width")
QDEF(MP_QSTR_write_readinto, 33929, 14, "write_readinto")
QDEF(MP_QSTR_writeto, 14595, 7, "writeto")
Expand All @@ -395,4 +411,3 @@ QDEF(MP_QSTR_mktime, 11158, 6, "mktime")
QDEF(MP_QSTR_time, 49648, 4, "time")
QDEF(MP_QSTR_sleep, 10218, 5, "sleep")
QDEF(MP_QSTR_sleep_ms, 25355, 8, "sleep_ms")

10 changes: 6 additions & 4 deletions firmware/src/config/pic32mz_w1_curiosity_freertos/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@
#define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
#define MICROPY_PY___FILE__ (0)
#define MICROPY_PY_GC (1)
#define MICROPY_PY_ARRAY (0)
#define MICROPY_PY_COLLECTIONS (0)
#define MICROPY_PY_ARRAY (1)
#define MICROPY_PY_COLLECTIONS (1)
#define MICROPY_PY_MATH (0)
#define MICROPY_PY_CMATH (0)
#define MICROPY_PY_IO (0)
#define MICROPY_PY_STRUCT (0)
#define MICROPY_PY_STRUCT (1)
#define MICROPY_PY_SYS (0)
#define MICROPY_CPYTHON_COMPAT (0)
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
Expand Down Expand Up @@ -90,6 +90,7 @@ typedef int mp_off_t;
#define MICROPY_PORT_BUILTINS \
{ MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },

#if 0
// extra builtin modules to add to the list of known ones
extern const struct _mp_obj_module_t pyb_module;
extern const struct _mp_obj_module_t test_module;
Expand All @@ -106,7 +107,7 @@ extern const struct _mp_obj_module_t utime_module;
{ MP_OBJ_NEW_QSTR(MP_QSTR_socket), (mp_obj_t)&mp_module_usocket }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_utime), (mp_obj_t)&utime_module }, \


#endif

#define MP_STATE_PORT MP_STATE_VM

Expand All @@ -130,5 +131,6 @@ typedef unsigned int uintptr_t;
#define MICROPY_PY_UTIME_MP_HAL (1)
#define MICROPY_PY_USELECT (1)
#define MICROPY_EVENT_POLL_HOOK
//#define MICROPY_PY_UJSON (1)


1 change: 1 addition & 0 deletions firmware/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
#include "py/gc.h"
#include "py/mphal.h"
#include "py/mperrno.h"
#include "py/builtin.h"
#include "shared/runtime/pyexec.h"
#include "shared/readline/readline.h"
// *****************************************************************************
Expand Down
6 changes: 4 additions & 2 deletions firmware/src/third_party/mp/drivers/bus/qspi.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@

#include "py/mphal.h"

#define MP_SPI_ADDR_IS_32B(addr) (addr & 0xff000000)
#ifndef MICROPY_HW_SPI_ADDR_IS_32BIT
#define MICROPY_HW_SPI_ADDR_IS_32BIT(addr) (addr & 0xff000000)
#endif

enum {
MP_QSPI_IOCTL_INIT,
Expand Down Expand Up @@ -57,7 +59,7 @@ typedef struct _mp_soft_qspi_obj_t {
extern const mp_qspi_proto_t mp_soft_qspi_proto;

static inline uint8_t mp_spi_set_addr_buff(uint8_t *buf, uint32_t addr) {
if (MP_SPI_ADDR_IS_32B(addr)) {
if (MICROPY_HW_SPI_ADDR_IS_32BIT(addr)) {
buf[0] = addr >> 24;
buf[1] = addr >> 16;
buf[2] = addr >> 8;
Expand Down
4 changes: 3 additions & 1 deletion firmware/src/third_party/mp/drivers/dht/dht.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
from mimxrt import dht_readinto
elif sys.platform == "rp2":
from rp2 import dht_readinto
else:
elif sys.platform == "pyboard":
from pyb import dht_readinto
else:
from machine import dht_readinto


class DHTBase:
Expand Down
Loading

0 comments on commit a748fac

Please sign in to comment.