Merge branch 'new_master' into new_freq_in

This commit is contained in:
sommersoft 2019-02-22 23:12:11 +00:00
commit a1060747f8
78 changed files with 1177 additions and 931 deletions

View File

@ -4,7 +4,7 @@ language: c
compiler:
- gcc
git:
depth: 1
depth: 6
# Each item under 'env' is a separate Travis job to execute.
# They run in separate environments, so each one must take the time
@ -56,7 +56,6 @@ notifications:
before_script:
# Expand the git tree back to 4.0.0-alpha.1 and then fetch the latest tag.
- LAST_TAG=`git ls-remote --quiet --tags --sort=version:refname | egrep -o "refs/tags/[0-9]+.*\$" | tail -n 1`
- git fetch --shallow-exclude=4.0.0-alpha.1 || git fetch --unshallow
- git fetch --depth 1 origin $LAST_TAG:$LAST_TAG
- git describe --dirty --always --tags
- function var_search () { case "$1" in *$2*) true;; *) false;; esac; }

View File

@ -11,7 +11,7 @@
//! <2012/12/20> V1.1.0
//! 1. Optimize code
//! 2. Add reg_dhcp_cbfunc()
//! 3. Add DHCP_stop()
//! 3. Add DHCP_stop()
//! 4. Integrate check_DHCP_state() & DHCP_run() to DHCP_run()
//! 5. Don't care system endian
//! 6. Add comments
@ -22,30 +22,30 @@
//!
//! Copyright (c) 2013, WIZnet Co., LTD.
//! All rights reserved.
//!
//! Redistribution and use in source and binary forms, with or without
//! modification, are permitted provided that the following conditions
//! are met:
//!
//! * Redistributions of source code must retain the above copyright
//! notice, this list of conditions and the following disclaimer.
//!
//! Redistribution and use in source and binary forms, with or without
//! modification, are permitted provided that the following conditions
//! are met:
//!
//! * Redistributions of source code must retain the above copyright
//! notice, this list of conditions and the following disclaimer.
//! * Redistributions in binary form must reproduce the above copyright
//! notice, this list of conditions and the following disclaimer in the
//! documentation and/or other materials provided with the distribution.
//! * Neither the name of the <ORGANIZATION> nor the names of its
//! contributors may be used to endorse or promote products derived
//! from this software without specific prior written permission.
//!
//! documentation and/or other materials provided with the distribution.
//! * Neither the name of the <ORGANIZATION> nor the names of its
//! contributors may be used to endorse or promote products derived
//! from this software without specific prior written permission.
//!
//! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
//! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
//! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
//! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
//! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
//! LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
//! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
//! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
//! LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
//! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
//! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
//! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
//! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
//! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
//! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
//! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
//! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
//! THE POSSIBILITY OF SUCH DAMAGE.
//
//*****************************************************************************
@ -59,7 +59,7 @@
#ifdef _DHCP_DEBUG_
#include <stdio.h>
#endif
#endif
/* DHCP state machine. */
#define STATE_DHCP_INIT 0 ///< Initialize
@ -70,7 +70,7 @@
#define STATE_DHCP_RELEASE 5 ///< No use
#define STATE_DHCP_STOP 6 ///< Stop processing DHCP
#define DHCP_FLAGSBROADCAST 0x8000 ///< The broadcast value of flags in @ref RIP_MSG
#define DHCP_FLAGSBROADCAST 0x8000 ///< The broadcast value of flags in @ref RIP_MSG
#define DHCP_FLAGSUNICAST 0x0000 ///< The unicast value of flags in @ref RIP_MSG
/* DHCP message OP code */
@ -99,7 +99,7 @@
#define OPT_SIZE 312 /// Max OPT size of @ref RIP_MSG
#define RIP_MSG_SIZE (236+OPT_SIZE) /// Max size of @ref RIP_MSG
/*
/*
* @brief DHCP option and value (cf. RFC1533)
*/
enum
@ -171,7 +171,7 @@ enum
/*
* @brief DHCP message format
*/
*/
typedef struct {
uint8_t op; ///< @ref DHCP_BOOTREQUEST or @ref DHCP_BOOTREPLY
uint8_t htype; ///< @ref DHCP_HTYPE10MB or @ref DHCP_HTYPE100MB
@ -182,7 +182,7 @@ typedef struct {
uint16_t flags; ///< @ref DHCP_FLAGSBROADCAST or @ref DHCP_FLAGSUNICAST
uint8_t ciaddr[4]; ///< @ref Request IP to DHCP sever
uint8_t yiaddr[4]; ///< @ref Offered IP from DHCP server
uint8_t siaddr[4]; ///< No use
uint8_t siaddr[4]; ///< No use
uint8_t giaddr[4]; ///< No use
uint8_t chaddr[16]; ///< DHCP client 6bytes MAC address. Others is filled to zero
uint8_t sname[64]; ///< No use
@ -205,7 +205,7 @@ uint8_t DHCP_allocated_dns[4] = {0, }; // DNS address from DHCP
int8_t dhcp_state = STATE_DHCP_INIT; // DHCP state
int8_t dhcp_retry_count = 0;
int8_t dhcp_retry_count = 0;
uint32_t dhcp_lease_time = INFINITE_LEASETIME;
volatile uint32_t dhcp_tick_1s = 0; // unit 1 second
@ -215,7 +215,7 @@ uint32_t DHCP_XID; // Any number
RIP_MSG* pDHCPMSG; // Buffer pointer for DHCP processing
uint8_t HOST_NAME[] = DCHP_HOST_NAME;
uint8_t HOST_NAME[] = DCHP_HOST_NAME;
uint8_t DHCP_CHADDR[6]; // DHCP Client MAC address.
@ -306,9 +306,9 @@ void makeDHCPMSG(void)
*(ptmp+0) = (uint8_t)((DHCP_XID & 0xFF000000) >> 24);
*(ptmp+1) = (uint8_t)((DHCP_XID & 0x00FF0000) >> 16);
*(ptmp+2) = (uint8_t)((DHCP_XID & 0x0000FF00) >> 8);
*(ptmp+3) = (uint8_t)((DHCP_XID & 0x000000FF) >> 0);
*(ptmp+3) = (uint8_t)((DHCP_XID & 0x000000FF) >> 0);
pDHCPMSG->secs = DHCP_SECS;
ptmp = (uint8_t*)(&pDHCPMSG->flags);
ptmp = (uint8_t*)(&pDHCPMSG->flags);
*(ptmp+0) = (uint8_t)((DHCP_FLAGSBROADCAST & 0xFF00) >> 8);
*(ptmp+1) = (uint8_t)((DHCP_FLAGSBROADCAST & 0x00FF) >> 0);
@ -356,16 +356,16 @@ void send_DHCP_DISCOVER(void)
uint16_t i;
uint8_t ip[4];
uint16_t k = 0;
makeDHCPMSG();
k = 4; // because MAGIC_COOKIE already made by makeDHCPMSG()
// Option Request Param
pDHCPMSG->OPT[k++] = dhcpMessageType;
pDHCPMSG->OPT[k++] = 0x01;
pDHCPMSG->OPT[k++] = DHCP_DISCOVER;
// Client identifier
pDHCPMSG->OPT[k++] = dhcpClientIdentifier;
pDHCPMSG->OPT[k++] = 0x07;
@ -376,10 +376,10 @@ void send_DHCP_DISCOVER(void)
pDHCPMSG->OPT[k++] = DHCP_CHADDR[3];
pDHCPMSG->OPT[k++] = DHCP_CHADDR[4];
pDHCPMSG->OPT[k++] = DHCP_CHADDR[5];
// host name
pDHCPMSG->OPT[k++] = hostName;
pDHCPMSG->OPT[k++] = 0; // fill zero length of hostname
pDHCPMSG->OPT[k++] = 0; // fill zero length of hostname
for(i = 0 ; HOST_NAME[i] != 0; i++)
pDHCPMSG->OPT[k++] = HOST_NAME[i];
pDHCPMSG->OPT[k++] = DHCP_CHADDR[3];
@ -432,18 +432,18 @@ void send_DHCP_REQUEST(void)
ip[0] = DHCP_SIP[0];
ip[1] = DHCP_SIP[1];
ip[2] = DHCP_SIP[2];
ip[3] = DHCP_SIP[3];
ip[3] = DHCP_SIP[3];
}
else
{
ip[0] = 255;
ip[1] = 255;
ip[2] = 255;
ip[3] = 255;
ip[3] = 255;
}
k = 4; // because MAGIC_COOKIE already made by makeDHCPMSG()
// Option Request Param.
pDHCPMSG->OPT[k++] = dhcpMessageType;
pDHCPMSG->OPT[k++] = 0x01;
@ -467,7 +467,7 @@ void send_DHCP_REQUEST(void)
pDHCPMSG->OPT[k++] = DHCP_allocated_ip[1];
pDHCPMSG->OPT[k++] = DHCP_allocated_ip[2];
pDHCPMSG->OPT[k++] = DHCP_allocated_ip[3];
pDHCPMSG->OPT[k++] = dhcpServerIdentifier;
pDHCPMSG->OPT[k++] = 0x04;
pDHCPMSG->OPT[k++] = DHCP_SIP[0];
@ -485,7 +485,7 @@ void send_DHCP_REQUEST(void)
pDHCPMSG->OPT[k++] = DHCP_CHADDR[4];
pDHCPMSG->OPT[k++] = DHCP_CHADDR[5];
pDHCPMSG->OPT[k - (i+3+1)] = i+3; // length of hostname
pDHCPMSG->OPT[k++] = dhcpParamRequest;
pDHCPMSG->OPT[k++] = 0x08;
pDHCPMSG->OPT[k++] = subnetMask;
@ -503,7 +503,7 @@ void send_DHCP_REQUEST(void)
#ifdef _DHCP_DEBUG_
printf("> Send DHCP_REQUEST\r\n");
#endif
WIZCHIP_EXPORT(sendto)(DHCP_SOCKET, (uint8_t *)pDHCPMSG, RIP_MSG_SIZE, ip, DHCP_SERVER_PORT);
}
@ -514,11 +514,11 @@ void send_DHCP_DECLINE(void)
int i;
uint8_t ip[4];
uint16_t k = 0;
makeDHCPMSG();
k = 4; // because MAGIC_COOKIE already made by makeDHCPMSG()
*((uint8_t*)(&pDHCPMSG->flags)) = ((DHCP_FLAGSUNICAST & 0xFF00)>> 8);
*((uint8_t*)(&pDHCPMSG->flags)+1) = (DHCP_FLAGSUNICAST & 0x00FF);
@ -577,15 +577,15 @@ int8_t parseDHCPMSG(void)
uint8_t * p;
uint8_t * e;
uint8_t type;
uint8_t type = 0;
uint8_t opt_len;
if((len = getSn_RX_RSR(DHCP_SOCKET)) > 0)
{
len = WIZCHIP_EXPORT(recvfrom)(DHCP_SOCKET, (uint8_t *)pDHCPMSG, len, svr_addr, &svr_port);
#ifdef _DHCP_DEBUG_
#ifdef _DHCP_DEBUG_
printf("DHCP message : %d.%d.%d.%d(%d) %d received. \r\n",svr_addr[0],svr_addr[1],svr_addr[2], svr_addr[3],svr_port, len);
#endif
#endif
}
else return 0;
if (svr_port == DHCP_SERVER_PORT) {
@ -624,7 +624,7 @@ int8_t parseDHCPMSG(void)
break;
case routersOnSubnet :
p++;
opt_len = *p++;
opt_len = *p++;
DHCP_allocated_gw[0] = *p++;
DHCP_allocated_gw[1] = *p++;
DHCP_allocated_gw[2] = *p++;
@ -632,8 +632,8 @@ int8_t parseDHCPMSG(void)
p = p + (opt_len - 4);
break;
case dns :
p++;
opt_len = *p++;
p++;
opt_len = *p++;
DHCP_allocated_dns[0] = *p++;
DHCP_allocated_dns[1] = *p++;
DHCP_allocated_dns[2] = *p++;
@ -647,7 +647,7 @@ int8_t parseDHCPMSG(void)
dhcp_lease_time = (dhcp_lease_time << 8) + *p++;
dhcp_lease_time = (dhcp_lease_time << 8) + *p++;
dhcp_lease_time = (dhcp_lease_time << 8) + *p++;
#ifdef _DHCP_DEBUG_
#ifdef _DHCP_DEBUG_
dhcp_lease_time = 10;
#endif
break;
@ -740,7 +740,7 @@ uint8_t DHCP_run(void)
case STATE_DHCP_LEASED :
ret = DHCP_IP_LEASED;
if ((dhcp_lease_time != INFINITE_LEASETIME) && ((dhcp_lease_time/2) < dhcp_tick_1s)) {
#ifdef _DHCP_DEBUG_
printf("> Maintains the IP address \r\n");
#endif
@ -750,7 +750,7 @@ uint8_t DHCP_run(void)
OLD_allocated_ip[1] = DHCP_allocated_ip[1];
OLD_allocated_ip[2] = DHCP_allocated_ip[2];
OLD_allocated_ip[3] = DHCP_allocated_ip[3];
DHCP_XID++;
send_DHCP_REQUEST();
@ -765,21 +765,21 @@ uint8_t DHCP_run(void)
ret = DHCP_IP_LEASED;
if (type == DHCP_ACK) {
dhcp_retry_count = 0;
if (OLD_allocated_ip[0] != DHCP_allocated_ip[0] ||
if (OLD_allocated_ip[0] != DHCP_allocated_ip[0] ||
OLD_allocated_ip[1] != DHCP_allocated_ip[1] ||
OLD_allocated_ip[2] != DHCP_allocated_ip[2] ||
OLD_allocated_ip[3] != DHCP_allocated_ip[3])
OLD_allocated_ip[3] != DHCP_allocated_ip[3])
{
ret = DHCP_IP_CHANGED;
dhcp_ip_update();
#ifdef _DHCP_DEBUG_
printf(">IP changed.\r\n");
#endif
}
#ifdef _DHCP_DEBUG_
else printf(">IP is continued.\r\n");
#endif
#endif
reset_DHCP_timeout();
dhcp_state = STATE_DHCP_LEASED;
} else if (type == DHCP_NAK) {
@ -809,7 +809,7 @@ void DHCP_stop(void)
uint8_t check_DHCP_timeout(void)
{
uint8_t ret = DHCP_RUNNING;
if (dhcp_retry_count < MAX_DHCP_RETRY) {
if (dhcp_tick_next < dhcp_tick_1s) {
@ -818,7 +818,7 @@ uint8_t check_DHCP_timeout(void)
// printf("<<timeout>> state : STATE_DHCP_DISCOVER\r\n");
send_DHCP_DISCOVER();
break;
case STATE_DHCP_REQUEST :
// printf("<<timeout>> state : STATE_DHCP_REQUEST\r\n");
@ -827,10 +827,10 @@ uint8_t check_DHCP_timeout(void)
case STATE_DHCP_REREQUEST :
// printf("<<timeout>> state : STATE_DHCP_REREQUEST\r\n");
send_DHCP_REQUEST();
break;
default :
break;
}
@ -892,7 +892,7 @@ int8_t check_DHCP_leasedIP(void)
return 0;
}
}
}
void DHCP_init(uint8_t s, DHCP_INIT_BUFFER_TYPE* buf)
{
@ -903,11 +903,11 @@ void DHCP_init(uint8_t s, DHCP_INIT_BUFFER_TYPE* buf)
// assign temporary mac address, you should be set SHAR before call this function.
DHCP_CHADDR[0] = 0x00;
DHCP_CHADDR[1] = 0x08;
DHCP_CHADDR[2] = 0xdc;
DHCP_CHADDR[2] = 0xdc;
DHCP_CHADDR[3] = 0x00;
DHCP_CHADDR[4] = 0x00;
DHCP_CHADDR[5] = 0x00;
setSHAR(DHCP_CHADDR);
DHCP_CHADDR[5] = 0x00;
setSHAR(DHCP_CHADDR);
}
DHCP_SOCKET = s; // SOCK_DHCP
@ -941,7 +941,7 @@ void getIPfromDHCP(uint8_t* ip)
{
ip[0] = DHCP_allocated_ip[0];
ip[1] = DHCP_allocated_ip[1];
ip[2] = DHCP_allocated_ip[2];
ip[2] = DHCP_allocated_ip[2];
ip[3] = DHCP_allocated_ip[3];
}
@ -950,7 +950,7 @@ void getGWfromDHCP(uint8_t* ip)
ip[0] =DHCP_allocated_gw[0];
ip[1] =DHCP_allocated_gw[1];
ip[2] =DHCP_allocated_gw[2];
ip[3] =DHCP_allocated_gw[3];
ip[3] =DHCP_allocated_gw[3];
}
void getSNfromDHCP(uint8_t* ip)
@ -958,7 +958,7 @@ void getSNfromDHCP(uint8_t* ip)
ip[0] = DHCP_allocated_sn[0];
ip[1] = DHCP_allocated_sn[1];
ip[2] = DHCP_allocated_sn[2];
ip[3] = DHCP_allocated_sn[3];
ip[3] = DHCP_allocated_sn[3];
}
void getDNSfromDHCP(uint8_t* ip)
@ -966,14 +966,10 @@ void getDNSfromDHCP(uint8_t* ip)
ip[0] = DHCP_allocated_dns[0];
ip[1] = DHCP_allocated_dns[1];
ip[2] = DHCP_allocated_dns[2];
ip[3] = DHCP_allocated_dns[3];
ip[3] = DHCP_allocated_dns[3];
}
uint32_t getDHCPLeasetime(void)
{
return dhcp_lease_time;
}

View File

@ -292,7 +292,11 @@ STATIC mp_obj_t mod_ujson_loads(mp_obj_t obj) {
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_ujson_loads_obj, mod_ujson_loads);
STATIC const mp_rom_map_elem_t mp_module_ujson_globals_table[] = {
#if CIRCUITPY
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_json) },
#else
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ujson) },
#endif
{ MP_ROM_QSTR(MP_QSTR_dump), MP_ROM_PTR(&mod_ujson_dump_obj) },
{ MP_ROM_QSTR(MP_QSTR_dumps), MP_ROM_PTR(&mod_ujson_dumps_obj) },
{ MP_ROM_QSTR(MP_QSTR_load), MP_ROM_PTR(&mod_ujson_load_obj) },

View File

@ -405,7 +405,11 @@ STATIC MP_DEFINE_CONST_DICT(re_locals_dict, re_locals_dict_table);
STATIC const mp_obj_type_t re_type = {
{ &mp_type_type },
#if CIRCUITPY
.name = MP_QSTR_re,
#else
.name = MP_QSTR_ure,
#endif
.print = re_print,
.locals_dict = (void*)&re_locals_dict,
};
@ -462,7 +466,11 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_re_sub_obj, 3, 5, mod_re_sub);
#endif
STATIC const mp_rom_map_elem_t mp_module_re_globals_table[] = {
#if CIRCUITPY
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_re) },
#else
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ure) },
#endif
{ MP_ROM_QSTR(MP_QSTR_compile), MP_ROM_PTR(&mod_re_compile_obj) },
{ MP_ROM_QSTR(MP_QSTR_match), MP_ROM_PTR(&mod_re_match_obj) },
{ MP_ROM_QSTR(MP_QSTR_search), MP_ROM_PTR(&mod_re_search_obj) },

View File

@ -38,6 +38,8 @@
#define FSUSER_NO_FILESYSTEM (0x0008) // the block device has no filesystem on it
// Device is writable over USB and read-only to MicroPython.
#define FSUSER_USB_WRITABLE (0x0010)
// Bit set when the above flag is checked before opening a file for write.
#define FSUSER_CONCURRENT_WRITE_PROTECTED (0x0020)
typedef struct _fs_user_mount_t {
mp_obj_base_t base;

View File

@ -34,6 +34,7 @@
#include "py/mperrno.h"
#include "lib/oofatfs/ff.h"
#include "extmod/vfs_fat.h"
#include "supervisor/filesystem.h"
// this table converts from FRESULT to POSIX errno
const byte fresult_to_errno_table[20] = {
@ -186,12 +187,15 @@ STATIC mp_obj_t file_open(fs_user_mount_t *vfs, const mp_obj_type_t *type, mp_ar
break;
}
}
assert(vfs != NULL);
if ((mode & FA_WRITE) != 0 && !filesystem_is_writable_by_python(vfs)) {
mp_raise_OSError(MP_EROFS);
}
pyb_file_obj_t *o = m_new_obj_with_finaliser(pyb_file_obj_t);
o->base.type = type;
const char *fname = mp_obj_str_get_str(args[0].u_obj);
assert(vfs != NULL);
FRESULT res = f_open(&vfs->fatfs, &o->fp, fname, mode);
if (res != FR_OK) {
m_del_obj(pyb_file_obj_t, o);

@ -1 +1 @@
Subproject commit d86fc7e81d51465ca1eae6f8c1141f81f065f5aa
Subproject commit 3e6bf71c75c9ed4ada51ab69f8bd196dad18c0c1

@ -1 +1 @@
Subproject commit f4ee725fb93fd1a31666d3f71d10c94eb96df7c8
Subproject commit 1d38fd81edd30f1bd70c0cfe77819ab610ea89a3

@ -1 +1 @@
Subproject commit 412392c8bdb6b4378e007eb7974c76b92fa9ff1d
Subproject commit a1686803566793ec2de7e043bf6822e47cfa31d1

@ -1 +1 @@
Subproject commit 03c24157d46672c723021686f7a838cfeb2db2ba
Subproject commit 409e90902ac49720c4add985e8e1a1660bbe63a0

@ -1 +1 @@
Subproject commit f5e70e09250f2a25ebb6487a30a763041644c5d3
Subproject commit dbfabac857123443506a3a1de9b5917d58248820

@ -1 +1 @@
Subproject commit ec11164ec6682094a48d0f9848d2c4c89c08f3bc
Subproject commit aa4428f304b982aa19a5800822e78c47dc8a3b6c

@ -1 +1 @@
Subproject commit 6298cd363811ad6ac10d4325c898be87a70d7bb2
Subproject commit a03f9011279f9e630549432589463912831fcee1

@ -1 +1 @@
Subproject commit 4421e79661002ff8da6c0c4f22940ec843ee300b
Subproject commit a8894480283e3b81f39a3db5716b443963abc56f

@ -1 +1 @@
Subproject commit 72e8f3855ecd136641d536a49311c38ee4f76f33
Subproject commit 6e35cd2b40575a20e2904b096508325cef4a71d3

@ -1 +1 @@
Subproject commit eae584918e72ff5fa323825470f276b31829ef9f
Subproject commit 893c5ec6a9aeef38284985074c2058e87754ad3d

@ -1 +1 @@
Subproject commit c92c22ff029ee05bd392299cf25887e9af48903a
Subproject commit 2df8a671a5a3d055b75df278fb354b558718b56d

@ -1 +1 @@
Subproject commit 29b49199beb8e9b5fead83e5cd36105f8746f1d7
Subproject commit 55874813f82157b7509729b1a0c66e68f86e2d07

View File

@ -89,6 +89,9 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
}
// source is a lexer, parse and compile the script
qstr source_name = lex->source_name;
if (input_kind == MP_PARSE_FILE_INPUT) {
mp_store_global(MP_QSTR___file__, MP_OBJ_NEW_QSTR(source_name));
}
mp_parse_tree_t parse_tree = mp_parse(lex, input_kind);
module_fun = mp_compile(&parse_tree, source_name, MP_EMIT_OPT_NONE, exec_flags & EXEC_FLAG_IS_REPL);
// Clear the parse tree because it has a heap pointer we don't need anymore.

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-02-15 19:19-0500\n"
"POT-Creation-Date: 2019-02-17 23:36-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -1336,7 +1336,7 @@ msgstr ""
msgid "3-arg pow() not supported"
msgstr ""
#: py/modbuiltins.c:517
#: py/modbuiltins.c:521
msgid "must use keyword argument for key function"
msgstr ""
@ -2709,7 +2709,7 @@ msgstr "Baudrate tidak didukung"
msgid "Group full"
msgstr ""
#: shared-module/displayio/Group.c:73
#: shared-module/displayio/Group.c:73 shared-module/displayio/Group.c:112
msgid "Layer must be a Group or TileGrid subclass."
msgstr ""
@ -2843,19 +2843,27 @@ msgid ""
"exit safe mode.\n"
msgstr ""
#, fuzzy
#~ msgid "buffer_size must be >= 1"
#~ msgstr "buffers harus mempunyai panjang yang sama"
#~ msgid "Not enough pins available"
#~ msgstr "Pin yang tersedia tidak cukup"
#~ msgid "busio.UART not available"
#~ msgstr "busio.UART tidak tersedia"
#~ msgid ""
#~ "Please file an issue here with the contents of your CIRCUITPY drive:\n"
#~ msgstr ""
#~ "Silahkan taruh masalah disini dengan isi dari CIRCUITPY drive: anda \n"
#~ msgid "Looks like our core CircuitPython code crashed hard. Whoops!\n"
#~ msgstr ""
#~ "Sepertinya inti kode CircuitPython kita crash dengan sangat keras. Ups!\n"
#, fuzzy
#~ msgid "unicode_characters must be a string"
#~ msgstr "keyword harus berupa string"
#~ msgid "unpack requires a buffer of %d bytes"
#~ msgstr "Gagal untuk megalokasikan buffer RX dari %d byte"
#~ msgid "All PWM peripherals are in use"
#~ msgstr "Semua perangkat PWM sedang digunakan"
#~ msgid "Invalid UUID string length"
#~ msgstr "Panjang string UUID tidak valid"
#~ msgid "Invalid UUID parameter"
#~ msgstr "Parameter UUID tidak valid"
#~ msgid ""
#~ "enough power for the whole circuit and press reset (after ejecting "
@ -2864,24 +2872,16 @@ msgstr ""
#~ "tegangan cukup untuk semua sirkuit dan tekan reset (setelah mencabut "
#~ "CIRCUITPY).\n"
#~ msgid "Invalid UUID parameter"
#~ msgstr "Parameter UUID tidak valid"
#~ msgid "Invalid UUID string length"
#~ msgstr "Panjang string UUID tidak valid"
#~ msgid "All PWM peripherals are in use"
#~ msgstr "Semua perangkat PWM sedang digunakan"
#, fuzzy
#~ msgid "unpack requires a buffer of %d bytes"
#~ msgstr "Gagal untuk megalokasikan buffer RX dari %d byte"
#~ msgid "unicode_characters must be a string"
#~ msgstr "keyword harus berupa string"
#~ msgid "Looks like our core CircuitPython code crashed hard. Whoops!\n"
#~ msgstr ""
#~ "Sepertinya inti kode CircuitPython kita crash dengan sangat keras. Ups!\n"
#~ msgid ""
#~ "Please file an issue here with the contents of your CIRCUITPY drive:\n"
#~ msgstr ""
#~ "Silahkan taruh masalah disini dengan isi dari CIRCUITPY drive: anda \n"
#~ msgid "busio.UART not available"
#~ msgstr "busio.UART tidak tersedia"
#~ msgid "Not enough pins available"
#~ msgstr "Pin yang tersedia tidak cukup"
#, fuzzy
#~ msgid "buffer_size must be >= 1"
#~ msgstr "buffers harus mempunyai panjang yang sama"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-02-15 19:19-0500\n"
"POT-Creation-Date: 2019-02-17 23:36-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -1302,7 +1302,7 @@ msgstr ""
msgid "3-arg pow() not supported"
msgstr ""
#: py/modbuiltins.c:517
#: py/modbuiltins.c:521
msgid "must use keyword argument for key function"
msgstr ""
@ -2667,7 +2667,7 @@ msgstr ""
msgid "Group full"
msgstr ""
#: shared-module/displayio/Group.c:73
#: shared-module/displayio/Group.c:73 shared-module/displayio/Group.c:112
msgid "Layer must be a Group or TileGrid subclass."
msgstr ""

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-02-15 19:19-0500\n"
"POT-Creation-Date: 2019-02-17 23:36-0500\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -1302,7 +1302,7 @@ msgstr ""
msgid "3-arg pow() not supported"
msgstr ""
#: py/modbuiltins.c:517
#: py/modbuiltins.c:521
msgid "must use keyword argument for key function"
msgstr ""
@ -2667,7 +2667,7 @@ msgstr ""
msgid "Group full"
msgstr ""
#: shared-module/displayio/Group.c:73
#: shared-module/displayio/Group.c:73 shared-module/displayio/Group.c:112
msgid "Layer must be a Group or TileGrid subclass."
msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-02-15 19:19-0500\n"
"POT-Creation-Date: 2019-02-17 23:36-0500\n"
"PO-Revision-Date: 2018-08-24 22:56-0500\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -1339,7 +1339,7 @@ msgstr "ord() espera un carácter, pero encontró un string de longitud %d"
msgid "3-arg pow() not supported"
msgstr "pow() con 3 argumentos no soportado"
#: py/modbuiltins.c:517
#: py/modbuiltins.c:521
msgid "must use keyword argument for key function"
msgstr "debe utilizar argumento de palabra clave para la función clave"
@ -2737,7 +2737,7 @@ msgstr "tipo de bitmap no soportado"
msgid "Group full"
msgstr "Group lleno"
#: shared-module/displayio/Group.c:73
#: shared-module/displayio/Group.c:73 shared-module/displayio/Group.c:112
msgid "Layer must be a Group or TileGrid subclass."
msgstr ""
@ -2881,89 +2881,14 @@ msgstr ""
"El botón reset fue presionado mientras arrancaba CircuitPython. Presiona "
"otra vez para salir del modo seguro.\n"
#, fuzzy
#~ msgid "buffer_size must be >= 1"
#~ msgstr "los buffers deben de tener la misma longitud"
#~ msgid "Not enough pins available"
#~ msgstr "No hay suficientes pines disponibles"
#, fuzzy
#~ msgid "Group must have %q at least 1"
#~ msgstr "Group debe tener size de minimo 1"
#~ msgid "busio.UART not available"
#~ msgstr "busio.UART no disponible"
#~ msgid "Baud rate too high for this SPI peripheral"
#~ msgstr "Baud rate demasiado alto para este periférico SPI"
#~ msgid "Invalid UUID parameter"
#~ msgstr "Parámetro UUID inválido"
#~ msgid "row buffer must be a bytearray or array of type 'b' or 'B'"
#~ msgstr "row buffer deberia ser un bytearray o array de tipo 'b' o 'B'"
#~ msgid "row data must be a buffer"
#~ msgstr "row data debe ser un buffer"
#, fuzzy
#~ msgid "unicode_characters must be a string"
#~ msgstr "palabras clave deben ser strings"
#~ msgid "index must be int"
#~ msgstr "indice debe ser int"
#~ msgid "Can not query for the device address."
#~ msgstr "No se puede consultar la dirección del dispositivo."
#~ msgid "All PWM peripherals are in use"
#~ msgstr "Todos los periféricos PWM en uso"
#~ msgid "Looks like our core CircuitPython code crashed hard. Whoops!\n"
#~ msgstr ""
#~ "Parece que nuestro código CircuitPython dejó de funcionar. Whoops!\n"
#~ msgid "Group empty"
#~ msgstr "Group vacío"
#~ msgid "Wrong address length"
#~ msgstr "Longitud de address erronea"
#~ msgid "Can encode UUID into the advertisement packet."
#~ msgstr "Se puede codificar el UUID en el paquete de anuncio."
#~ msgid "Invalid Service type"
#~ msgstr "Tipo de Servicio inválido"
#~ msgid "Invalid UUID string length"
#~ msgstr "Longitud de string UUID inválida"
#~ msgid "Can not add Service."
#~ msgstr "No se puede agregar el Servicio."
#~ msgid "displayio is a work in progress"
#~ msgstr "displayio todavia esta en desarrollo"
#~ msgid ""
#~ "enough power for the whole circuit and press reset (after ejecting "
#~ "CIRCUITPY).\n"
#~ msgstr ""
#~ "suficiente poder para todo el circuito y presiona reset (después de "
#~ "expulsar CIRCUITPY).\n"
#, fuzzy
#~ msgid "unpack requires a buffer of %d bytes"
#~ msgstr "Falló la asignación del buffer RX de %d bytes"
#~ msgid "Can not encode UUID, to check length."
#~ msgstr "No se puede codificar el UUID, para revisar la longitud."
#~ msgid "Wrong number of bytes provided"
#~ msgstr "Numero erroneo de bytes dados"
#~ msgid "Cannot apply GAP parameters."
#~ msgstr "No se pueden aplicar los parámetros GAP."
#~ msgid "Can not apply device name in the stack."
#~ msgstr "No se puede aplicar el nombre del dispositivo en el stack."
#~ msgid "Cannot set PPCP parameters."
#~ msgstr "No se pueden establecer los parámetros PPCP."
#~ msgid "Can not apply advertisement data. status: 0x%02x"
#~ msgstr "No se puede aplicar los datos de anuncio. status: 0x%02x"
#, fuzzy
#~ msgid ""
@ -2972,11 +2897,86 @@ msgstr ""
#~ "Por favor registra un issue en la siguiente URL con el contenidos de tu "
#~ "unidad de almacenamiento CIRCUITPY:\n"
#~ msgid "Can not apply advertisement data. status: 0x%02x"
#~ msgstr "No se puede aplicar los datos de anuncio. status: 0x%02x"
#~ msgid "Cannot set PPCP parameters."
#~ msgstr "No se pueden establecer los parámetros PPCP."
#~ msgid "busio.UART not available"
#~ msgstr "busio.UART no disponible"
#~ msgid "Can not apply device name in the stack."
#~ msgstr "No se puede aplicar el nombre del dispositivo en el stack."
#~ msgid "Not enough pins available"
#~ msgstr "No hay suficientes pines disponibles"
#~ msgid "Cannot apply GAP parameters."
#~ msgstr "No se pueden aplicar los parámetros GAP."
#~ msgid "Wrong number of bytes provided"
#~ msgstr "Numero erroneo de bytes dados"
#~ msgid "Can not encode UUID, to check length."
#~ msgstr "No se puede codificar el UUID, para revisar la longitud."
#, fuzzy
#~ msgid "unpack requires a buffer of %d bytes"
#~ msgstr "Falló la asignación del buffer RX de %d bytes"
#~ msgid ""
#~ "enough power for the whole circuit and press reset (after ejecting "
#~ "CIRCUITPY).\n"
#~ msgstr ""
#~ "suficiente poder para todo el circuito y presiona reset (después de "
#~ "expulsar CIRCUITPY).\n"
#~ msgid "displayio is a work in progress"
#~ msgstr "displayio todavia esta en desarrollo"
#~ msgid "Can not add Service."
#~ msgstr "No se puede agregar el Servicio."
#~ msgid "Invalid UUID string length"
#~ msgstr "Longitud de string UUID inválida"
#~ msgid "Invalid Service type"
#~ msgstr "Tipo de Servicio inválido"
#~ msgid "Can encode UUID into the advertisement packet."
#~ msgstr "Se puede codificar el UUID en el paquete de anuncio."
#~ msgid "Wrong address length"
#~ msgstr "Longitud de address erronea"
#~ msgid "Group empty"
#~ msgstr "Group vacío"
#~ msgid "Looks like our core CircuitPython code crashed hard. Whoops!\n"
#~ msgstr ""
#~ "Parece que nuestro código CircuitPython dejó de funcionar. Whoops!\n"
#~ msgid "All PWM peripherals are in use"
#~ msgstr "Todos los periféricos PWM en uso"
#~ msgid "Can not query for the device address."
#~ msgstr "No se puede consultar la dirección del dispositivo."
#~ msgid "index must be int"
#~ msgstr "indice debe ser int"
#, fuzzy
#~ msgid "unicode_characters must be a string"
#~ msgstr "palabras clave deben ser strings"
#~ msgid "row data must be a buffer"
#~ msgstr "row data debe ser un buffer"
#~ msgid "row buffer must be a bytearray or array of type 'b' or 'B'"
#~ msgstr "row buffer deberia ser un bytearray o array de tipo 'b' o 'B'"
#~ msgid "Invalid UUID parameter"
#~ msgstr "Parámetro UUID inválido"
#~ msgid "Baud rate too high for this SPI peripheral"
#~ msgstr "Baud rate demasiado alto para este periférico SPI"
#, fuzzy
#~ msgid "Group must have %q at least 1"
#~ msgstr "Group debe tener size de minimo 1"
#, fuzzy
#~ msgid "buffer_size must be >= 1"
#~ msgstr "los buffers deben de tener la misma longitud"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-02-15 19:19-0500\n"
"POT-Creation-Date: 2019-02-17 23:36-0500\n"
"PO-Revision-Date: 2018-12-20 22:15-0800\n"
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
"Language-Team: fil\n"
@ -1340,7 +1340,7 @@ msgstr "ord() umaasa ng character pero string ng %d haba ang nakita"
msgid "3-arg pow() not supported"
msgstr "3-arg pow() hindi suportado"
#: py/modbuiltins.c:517
#: py/modbuiltins.c:521
msgid "must use keyword argument for key function"
msgstr "dapat gumamit ng keyword argument para sa key function"
@ -2743,7 +2743,7 @@ msgstr "Hindi supportadong tipo ng bitmap"
msgid "Group full"
msgstr "Puno ang group"
#: shared-module/displayio/Group.c:73
#: shared-module/displayio/Group.c:73 shared-module/displayio/Group.c:112
msgid "Layer must be a Group or TileGrid subclass."
msgstr ""
@ -2887,64 +2887,39 @@ msgstr ""
"Ang reset button ay pinindot habang nag boot ang CircuitPython. Pindutin "
"ulit para lumabas sa safe mode.\n"
#, fuzzy
#~ msgid "buffer_size must be >= 1"
#~ msgstr "aarehas na haba dapat ang buffer slices"
#~ msgid "Not enough pins available"
#~ msgstr "Hindi sapat ang magagamit na pins"
#, fuzzy
#~ msgid "Group must have %q at least 1"
#~ msgstr "Group dapat ay hindi baba sa 1 na haba"
#~ msgid "busio.UART not available"
#~ msgstr "busio.UART hindi available"
#, fuzzy
#~ msgid "palette must be displayio.Palette"
#~ msgstr "ang palette ay dapat 32 bytes ang haba"
#~ msgid "Can not apply advertisement data. status: 0x%02x"
#~ msgstr "Hindi ma i-apply ang advertisement data. status: 0x%02x"
#~ msgid "Invalid UUID parameter"
#~ msgstr "Mali ang UUID parameter"
#~ msgid "row buffer must be a bytearray or array of type 'b' or 'B'"
#~ msgstr "ang row buffer ay dapat bytearray o array na type b or B"
#~ msgid "row data must be a buffer"
#~ msgstr "row data ay dapat na buffer"
#, fuzzy
#~ msgid "unicode_characters must be a string"
#~ msgstr "ang keywords dapat strings"
#~ msgid "index must be int"
#~ msgstr "index ay dapat int"
#~ msgid "Can not query for the device address."
#~ msgstr "Hindi maaaring mag-query para sa address ng device."
#~ msgid "All PWM peripherals are in use"
#~ msgstr "Lahat ng PWM peripherals ay ginagamit"
#~ msgid "Looks like our core CircuitPython code crashed hard. Whoops!\n"
#~ msgid ""
#~ "Please file an issue here with the contents of your CIRCUITPY drive:\n"
#~ msgstr ""
#~ "Mukhang ang core CircuitPython code ay nag-crash ng malakas. Aray!\n"
#~ "Mag-file ng isang isyu dito gamit ang mga nilalaman ng iyong CIRCUITPY "
#~ "drive:\n"
#~ msgid "Group empty"
#~ msgstr "Walang laman ang group"
#~ msgid "Cannot set PPCP parameters."
#~ msgstr "Hindi ma-set ang PPCP parameters."
#~ msgid "Wrong address length"
#~ msgstr "Mali ang address length"
#~ msgid "Can not apply device name in the stack."
#~ msgstr "Hindi maaaring ma-aplay ang device name sa stack."
#~ msgid "Can encode UUID into the advertisement packet."
#~ msgstr "Maaring i-encode ang UUID sa advertisement packet."
#~ msgid "Cannot apply GAP parameters."
#~ msgstr "Hindi ma-apply ang GAP parameters."
#~ msgid "Invalid Service type"
#~ msgstr "Mali ang tipo ng serbisyo"
#~ msgid "Wrong number of bytes provided"
#~ msgstr "Mali ang bilang ng bytes"
#~ msgid "Invalid UUID string length"
#~ msgstr "Mali ang UUID string length"
#~ msgid "Can not encode UUID, to check length."
#~ msgstr "Hindi ma-encode UUID, para suriin ang haba."
#~ msgid "Can not add Service."
#~ msgstr "Hindi maidaragdag ang serbisyo."
#~ msgid "displayio is a work in progress"
#~ msgstr "displayio ay nasa gitna ng konstruksiyon"
#, fuzzy
#~ msgid "unpack requires a buffer of %d bytes"
#~ msgstr "Nabigong ilaan ang RX buffer ng %d bytes"
#~ msgid ""
#~ "enough power for the whole circuit and press reset (after ejecting "
@ -2953,36 +2928,61 @@ msgstr ""
#~ "ay nagbibigay ng sapat na power para sa buong circuit at i-press ang "
#~ "reset (pagkatapos i-eject ang CIRCUITPY).\n"
#, fuzzy
#~ msgid "unpack requires a buffer of %d bytes"
#~ msgstr "Nabigong ilaan ang RX buffer ng %d bytes"
#~ msgid "displayio is a work in progress"
#~ msgstr "displayio ay nasa gitna ng konstruksiyon"
#~ msgid "Can not encode UUID, to check length."
#~ msgstr "Hindi ma-encode UUID, para suriin ang haba."
#~ msgid "Can not add Service."
#~ msgstr "Hindi maidaragdag ang serbisyo."
#~ msgid "Wrong number of bytes provided"
#~ msgstr "Mali ang bilang ng bytes"
#~ msgid "Invalid UUID string length"
#~ msgstr "Mali ang UUID string length"
#~ msgid "Cannot apply GAP parameters."
#~ msgstr "Hindi ma-apply ang GAP parameters."
#~ msgid "Invalid Service type"
#~ msgstr "Mali ang tipo ng serbisyo"
#~ msgid "Can not apply device name in the stack."
#~ msgstr "Hindi maaaring ma-aplay ang device name sa stack."
#~ msgid "Can encode UUID into the advertisement packet."
#~ msgstr "Maaring i-encode ang UUID sa advertisement packet."
#~ msgid "Cannot set PPCP parameters."
#~ msgstr "Hindi ma-set ang PPCP parameters."
#~ msgid "Wrong address length"
#~ msgstr "Mali ang address length"
#~ msgid ""
#~ "Please file an issue here with the contents of your CIRCUITPY drive:\n"
#~ msgid "Group empty"
#~ msgstr "Walang laman ang group"
#~ msgid "Looks like our core CircuitPython code crashed hard. Whoops!\n"
#~ msgstr ""
#~ "Mag-file ng isang isyu dito gamit ang mga nilalaman ng iyong CIRCUITPY "
#~ "drive:\n"
#~ "Mukhang ang core CircuitPython code ay nag-crash ng malakas. Aray!\n"
#~ msgid "Can not apply advertisement data. status: 0x%02x"
#~ msgstr "Hindi ma i-apply ang advertisement data. status: 0x%02x"
#~ msgid "All PWM peripherals are in use"
#~ msgstr "Lahat ng PWM peripherals ay ginagamit"
#~ msgid "busio.UART not available"
#~ msgstr "busio.UART hindi available"
#~ msgid "Can not query for the device address."
#~ msgstr "Hindi maaaring mag-query para sa address ng device."
#~ msgid "Not enough pins available"
#~ msgstr "Hindi sapat ang magagamit na pins"
#~ msgid "index must be int"
#~ msgstr "index ay dapat int"
#, fuzzy
#~ msgid "unicode_characters must be a string"
#~ msgstr "ang keywords dapat strings"
#~ msgid "row data must be a buffer"
#~ msgstr "row data ay dapat na buffer"
#~ msgid "row buffer must be a bytearray or array of type 'b' or 'B'"
#~ msgstr "ang row buffer ay dapat bytearray o array na type b or B"
#~ msgid "Invalid UUID parameter"
#~ msgstr "Mali ang UUID parameter"
#, fuzzy
#~ msgid "palette must be displayio.Palette"
#~ msgstr "ang palette ay dapat 32 bytes ang haba"
#, fuzzy
#~ msgid "Group must have %q at least 1"
#~ msgstr "Group dapat ay hindi baba sa 1 na haba"
#, fuzzy
#~ msgid "buffer_size must be >= 1"
#~ msgstr "aarehas na haba dapat ang buffer slices"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-02-15 19:19-0500\n"
"POT-Creation-Date: 2019-02-17 23:36-0500\n"
"PO-Revision-Date: 2018-12-23 20:05+0100\n"
"Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n"
"Language-Team: fr\n"
@ -1337,7 +1337,7 @@ msgstr "ord() attend un caractère mais une chaîne de longueur %d a été trouv
msgid "3-arg pow() not supported"
msgstr "pow() avec 3 arguments non supporté"
#: py/modbuiltins.c:517
#: py/modbuiltins.c:521
msgid "must use keyword argument for key function"
msgstr "il faut utiliser un argument nommé pour une fonction key"
@ -2759,7 +2759,7 @@ msgstr "type de bitmap non supporté"
msgid "Group full"
msgstr "Groupe plein"
#: shared-module/displayio/Group.c:73
#: shared-module/displayio/Group.c:73 shared-module/displayio/Group.c:112
msgid "Layer must be a Group or TileGrid subclass."
msgstr ""
@ -2909,76 +2909,34 @@ msgstr ""
"Le bouton 'reset' a été appuyé pendant le démarrage de CircuitPython. "
"Appuyer denouveau pour quitter de le mode sans-échec.\n"
#, fuzzy
#~ msgid "buffer_size must be >= 1"
#~ msgstr "les slices de tampon doivent être de longueurs égales"
#~ msgid "Not enough pins available"
#~ msgstr "Pas assez de broches disponibles"
#, fuzzy
#~ msgid "Group must have %q at least 1"
#~ msgstr "Le tampon doit être de longueur au moins 1"
#~ msgid "busio.UART not available"
#~ msgstr "busio.UART n'est pas disponible"
#~ msgid "Cannot set PPCP parameters."
#~ msgstr "Impossible d'appliquer les paramètres PPCP"
#~ msgid "Can not query for the device address."
#~ msgstr "Impossible d'obtenir l'adresse du périphérique"
#~ msgid "Invalid UUID parameter"
#~ msgstr "Paramètre UUID invalide"
#~ msgid "Can not encode UUID, to check length."
#~ msgstr "Impossible d'encoder l'UUID pour vérifier la longueur."
#, fuzzy
#~ msgid "row buffer must be a bytearray or array of type 'b' or 'B'"
#~ msgid "Cannot apply GAP parameters."
#~ msgstr "Impossible d'appliquer les paramètres GAP"
#~ msgid ""
#~ "Please file an issue here with the contents of your CIRCUITPY drive:\n"
#~ msgstr ""
#~ "le tampon de ligne doit être un bytearray ou un tableau de type 'b' ou 'B'"
#~ "SVP, remontez le problème là avec le contenu du lecteur CIRCUITPY:\n"
#~ msgid "Looks like our core CircuitPython code crashed hard. Whoops!\n"
#~ msgstr ""
#~ "Il semblerait que votre code CircuitPython a durement planté. Oups!\n"
#, fuzzy
#~ msgid "row data must be a buffer"
#~ msgstr "les données de ligne doivent être un tampon"
#, fuzzy
#~ msgid "unicode_characters must be a string"
#~ msgstr "les noms doivent être des chaînes de caractère"
#~ msgid "index must be int"
#~ msgstr "l'index doit être un entier"
#, fuzzy
#~ msgid "palette must be displayio.Palette"
#~ msgstr "la palette doit être une displayio.Palette"
#, fuzzy
#~ msgid "All PWM peripherals are in use"
#~ msgstr "Tous les périphériques PWM sont utilisés"
#, fuzzy
#~ msgid "value_size must be power of two"
#~ msgstr "value_size doit être une puissance de 2"
#, fuzzy
#~ msgid "Group empty"
#~ msgstr "Groupe vide"
#~ msgid "Wrong address length"
#~ msgstr "Mauvaise longueur d'adresse"
#~ msgid "Can not add Service."
#~ msgstr "Impossible d'ajouter le Service"
#~ msgid "Can not add Characteristic."
#~ msgstr "Impossible d'ajouter la Characteristic."
#~ msgid "Invalid UUID string length"
#~ msgstr "Longeur de chaîne UUID invalide"
#~ msgid "Can not apply device name in the stack."
#~ msgstr "Impossible d'appliquer le nom de périphérique dans la pile"
#~ msgid "displayio is a work in progress"
#~ msgstr "displayio est en cours de développement"
#~ msgid "Invalid Service type"
#~ msgstr "Type de service invalide"
#, fuzzy
#~ msgid "unpack requires a buffer of %d bytes"
#~ msgstr "Echec de l'allocation de %d octets du tampon RX"
#~ msgid "Wrong number of bytes provided"
#~ msgstr "mauvais nombre d'octets fourni'"
#~ msgid ""
#~ "enough power for the whole circuit and press reset (after ejecting "
@ -2988,30 +2946,72 @@ msgstr ""
#~ "'reset' (après avoir éjecter CIRCUITPY).\n"
#, fuzzy
#~ msgid "Wrong number of bytes provided"
#~ msgstr "mauvais nombre d'octets fourni'"
#~ msgid "unpack requires a buffer of %d bytes"
#~ msgstr "Echec de l'allocation de %d octets du tampon RX"
#~ msgid "Looks like our core CircuitPython code crashed hard. Whoops!\n"
#~ msgstr ""
#~ "Il semblerait que votre code CircuitPython a durement planté. Oups!\n"
#~ msgid "Invalid Service type"
#~ msgstr "Type de service invalide"
#~ msgid ""
#~ "Please file an issue here with the contents of your CIRCUITPY drive:\n"
#~ msgstr ""
#~ "SVP, remontez le problème là avec le contenu du lecteur CIRCUITPY:\n"
#~ msgid "displayio is a work in progress"
#~ msgstr "displayio est en cours de développement"
#~ msgid "Cannot apply GAP parameters."
#~ msgstr "Impossible d'appliquer les paramètres GAP"
#~ msgid "Can not apply device name in the stack."
#~ msgstr "Impossible d'appliquer le nom de périphérique dans la pile"
#~ msgid "Can not encode UUID, to check length."
#~ msgstr "Impossible d'encoder l'UUID pour vérifier la longueur."
#~ msgid "Invalid UUID string length"
#~ msgstr "Longeur de chaîne UUID invalide"
#~ msgid "Can not query for the device address."
#~ msgstr "Impossible d'obtenir l'adresse du périphérique"
#~ msgid "Can not add Characteristic."
#~ msgstr "Impossible d'ajouter la Characteristic."
#~ msgid "Can not add Service."
#~ msgstr "Impossible d'ajouter le Service"
#~ msgid "Wrong address length"
#~ msgstr "Mauvaise longueur d'adresse"
#, fuzzy
#~ msgid "busio.UART not available"
#~ msgstr "busio.UART n'est pas disponible"
#~ msgid "Group empty"
#~ msgstr "Groupe vide"
#~ msgid "Not enough pins available"
#~ msgstr "Pas assez de broches disponibles"
#, fuzzy
#~ msgid "value_size must be power of two"
#~ msgstr "value_size doit être une puissance de 2"
#, fuzzy
#~ msgid "All PWM peripherals are in use"
#~ msgstr "Tous les périphériques PWM sont utilisés"
#, fuzzy
#~ msgid "palette must be displayio.Palette"
#~ msgstr "la palette doit être une displayio.Palette"
#~ msgid "index must be int"
#~ msgstr "l'index doit être un entier"
#, fuzzy
#~ msgid "unicode_characters must be a string"
#~ msgstr "les noms doivent être des chaînes de caractère"
#, fuzzy
#~ msgid "row data must be a buffer"
#~ msgstr "les données de ligne doivent être un tampon"
#, fuzzy
#~ msgid "row buffer must be a bytearray or array of type 'b' or 'B'"
#~ msgstr ""
#~ "le tampon de ligne doit être un bytearray ou un tableau de type 'b' ou 'B'"
#~ msgid "Invalid UUID parameter"
#~ msgstr "Paramètre UUID invalide"
#~ msgid "Cannot set PPCP parameters."
#~ msgstr "Impossible d'appliquer les paramètres PPCP"
#, fuzzy
#~ msgid "Group must have %q at least 1"
#~ msgstr "Le tampon doit être de longueur au moins 1"
#, fuzzy
#~ msgid "buffer_size must be >= 1"
#~ msgstr "les slices de tampon doivent être de longueurs égales"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-02-15 19:19-0500\n"
"POT-Creation-Date: 2019-02-17 23:36-0500\n"
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
"Language-Team: \n"
@ -1337,7 +1337,7 @@ msgstr ""
msgid "3-arg pow() not supported"
msgstr "pow() con tre argmomenti non supportata"
#: py/modbuiltins.c:517
#: py/modbuiltins.c:521
msgid "must use keyword argument for key function"
msgstr ""
@ -2747,7 +2747,7 @@ msgstr "tipo di bitmap non supportato"
msgid "Group full"
msgstr "Gruppo pieno"
#: shared-module/displayio/Group.c:73
#: shared-module/displayio/Group.c:73 shared-module/displayio/Group.c:112
msgid "Layer must be a Group or TileGrid subclass."
msgstr ""
@ -2883,79 +2883,22 @@ msgid ""
"exit safe mode.\n"
msgstr ""
#, fuzzy
#~ msgid "buffer_size must be >= 1"
#~ msgstr "slice del buffer devono essere della stessa lunghezza"
#~ msgid "row data must be a buffer"
#~ msgstr "valori della riga devono essere un buffer"
#~ msgid "Not enough pins available"
#~ msgstr "Non sono presenti abbastanza pin"
#, fuzzy
#~ msgid "Group must have %q at least 1"
#~ msgstr "Il gruppo deve avere dimensione almeno 1"
#~ msgid "busio.UART not available"
#~ msgstr "busio.UART non ancora implementato"
#~ msgid "Invalid UUID parameter"
#~ msgstr "Parametro UUID non valido"
#~ msgid "Group empty"
#~ msgstr "Gruppo vuoto"
#~ msgid "Can not encode UUID, to check length."
#~ msgstr "Non è possibile codificare l'UUID, lunghezza da controllare."
#, fuzzy
#~ msgid "All PWM peripherals are in use"
#~ msgstr "Tutte le periferiche SPI sono in uso"
#~ msgid "unpack requires a buffer of %d bytes"
#~ msgstr "Fallita allocazione del buffer RX di %d byte"
#~ msgid "row buffer must be a bytearray or array of type 'b' or 'B'"
#~ msgstr ""
#~ "buffer di riga deve essere un bytearray o un array di tipo 'b' o 'B'"
#, fuzzy
#~ msgid "unicode_characters must be a string"
#~ msgstr "argomenti nominati devono essere stringhe"
#~ msgid "index must be int"
#~ msgstr "l'indice deve essere int"
#~ msgid "Invalid Service type"
#~ msgstr "Tipo di servizio non valido"
#, fuzzy
#~ msgid "Wrong number of bytes provided"
#~ msgstr "numero di argomenti errato"
#~ msgid "Looks like our core CircuitPython code crashed hard. Whoops!\n"
#~ msgstr ""
#~ "Sembra che il codice del core di CircuitPython sia crashato malamente. "
#~ "Whoops!\n"
#~ msgid "Can not add Characteristic."
#~ msgstr "Non è possibile aggiungere Characteristic."
#~ msgid "Cannot apply GAP parameters."
#~ msgstr "Impossibile applicare i parametri GAP."
#~ msgid "Can not apply advertisement data. status: 0x%02x"
#~ msgstr "Impossible inserire dati advertisement. status: 0x%02x"
#~ msgid ""
#~ "Please file an issue here with the contents of your CIRCUITPY drive:\n"
#~ msgstr ""
#~ "Ti preghiamo di compilare una issue con il contenuto del tuo drie "
#~ "CIRCUITPY:\n"
#~ msgid "Can not query for the device address."
#~ msgstr "Non è possibile trovare l'indirizzo del dispositivo."
#~ msgid "Cannot set PPCP parameters."
#~ msgstr "Impossibile impostare i parametri PPCP."
#~ msgid "Can not apply device name in the stack."
#~ msgstr "Non è possibile inserire il nome del dipositivo nella lista."
#~ msgid "Can encode UUID into the advertisement packet."
#~ msgstr "È possibile codificare l'UUID nel pacchetto di advertisement."
#~ msgid "Can not add Service."
#~ msgstr "Non è possibile aggiungere Service."
#~ msgid "Invalid UUID string length"
#~ msgstr "Lunghezza della stringa UUID non valida"
#~ msgid ""
#~ "enough power for the whole circuit and press reset (after ejecting "
@ -2964,19 +2907,76 @@ msgstr ""
#~ "abbastanza potenza per l'intero circuito e premere reset (dopo aver "
#~ "espulso CIRCUITPY).\n"
#~ msgid "Invalid UUID string length"
#~ msgstr "Lunghezza della stringa UUID non valida"
#~ msgid "Can not add Service."
#~ msgstr "Non è possibile aggiungere Service."
#~ msgid "Can encode UUID into the advertisement packet."
#~ msgstr "È possibile codificare l'UUID nel pacchetto di advertisement."
#~ msgid "Can not apply device name in the stack."
#~ msgstr "Non è possibile inserire il nome del dipositivo nella lista."
#~ msgid "Cannot set PPCP parameters."
#~ msgstr "Impossibile impostare i parametri PPCP."
#~ msgid "Can not query for the device address."
#~ msgstr "Non è possibile trovare l'indirizzo del dispositivo."
#~ msgid ""
#~ "Please file an issue here with the contents of your CIRCUITPY drive:\n"
#~ msgstr ""
#~ "Ti preghiamo di compilare una issue con il contenuto del tuo drie "
#~ "CIRCUITPY:\n"
#~ msgid "Can not apply advertisement data. status: 0x%02x"
#~ msgstr "Impossible inserire dati advertisement. status: 0x%02x"
#~ msgid "Cannot apply GAP parameters."
#~ msgstr "Impossibile applicare i parametri GAP."
#~ msgid "Can not add Characteristic."
#~ msgstr "Non è possibile aggiungere Characteristic."
#~ msgid "Looks like our core CircuitPython code crashed hard. Whoops!\n"
#~ msgstr ""
#~ "Sembra che il codice del core di CircuitPython sia crashato malamente. "
#~ "Whoops!\n"
#, fuzzy
#~ msgid "unpack requires a buffer of %d bytes"
#~ msgstr "Fallita allocazione del buffer RX di %d byte"
#~ msgid "Wrong number of bytes provided"
#~ msgstr "numero di argomenti errato"
#~ msgid "Can not encode UUID, to check length."
#~ msgstr "Non è possibile codificare l'UUID, lunghezza da controllare."
#~ msgid "Invalid Service type"
#~ msgstr "Tipo di servizio non valido"
#~ msgid "index must be int"
#~ msgstr "l'indice deve essere int"
#, fuzzy
#~ msgid "busio.UART not available"
#~ msgstr "busio.UART non ancora implementato"
#~ msgid "unicode_characters must be a string"
#~ msgstr "argomenti nominati devono essere stringhe"
#~ msgid "Not enough pins available"
#~ msgstr "Non sono presenti abbastanza pin"
#~ msgid "row buffer must be a bytearray or array of type 'b' or 'B'"
#~ msgstr ""
#~ "buffer di riga deve essere un bytearray o un array di tipo 'b' o 'B'"
#, fuzzy
#~ msgid "All PWM peripherals are in use"
#~ msgstr "Tutte le periferiche SPI sono in uso"
#~ msgid "Group empty"
#~ msgstr "Gruppo vuoto"
#~ msgid "Invalid UUID parameter"
#~ msgstr "Parametro UUID non valido"
#, fuzzy
#~ msgid "Group must have %q at least 1"
#~ msgstr "Il gruppo deve avere dimensione almeno 1"
#~ msgid "row data must be a buffer"
#~ msgstr "valori della riga devono essere un buffer"
#, fuzzy
#~ msgid "buffer_size must be >= 1"
#~ msgstr "slice del buffer devono essere della stessa lunghezza"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-02-15 19:19-0500\n"
"POT-Creation-Date: 2019-02-17 23:36-0500\n"
"PO-Revision-Date: 2018-10-02 21:14-0000\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -1320,7 +1320,7 @@ msgstr ""
msgid "3-arg pow() not supported"
msgstr ""
#: py/modbuiltins.c:517
#: py/modbuiltins.c:521
msgid "must use keyword argument for key function"
msgstr ""
@ -2703,7 +2703,7 @@ msgstr "Taxa de transmissão não suportada"
msgid "Group full"
msgstr "Grupo cheio"
#: shared-module/displayio/Group.c:73
#: shared-module/displayio/Group.c:73 shared-module/displayio/Group.c:112
msgid "Layer must be a Group or TileGrid subclass."
msgstr ""
@ -2831,64 +2831,64 @@ msgid ""
"exit safe mode.\n"
msgstr ""
#, fuzzy
#~ msgid "buffer_size must be >= 1"
#~ msgstr "buffers devem ser o mesmo tamanho"
#~ msgid "Not enough pins available"
#~ msgstr "Não há pinos suficientes disponíveis"
#~ msgid "index must be int"
#~ msgstr "index deve ser int"
#, fuzzy
#~ msgid "Group must have %q at least 1"
#~ msgstr "Grupo deve ter tamanho pelo menos 1"
#~ msgid "Group empty"
#~ msgstr "Grupo vazio"
#, fuzzy
#~ msgid "unicode_characters must be a string"
#~ msgstr "heap deve ser uma lista"
#~ msgid "Invalid UUID parameter"
#~ msgstr "Parâmetro UUID inválido"
#~ msgid "Baud rate too high for this SPI peripheral"
#~ msgstr "Taxa de transmissão muito alta para esse periférico SPI"
#~ msgid "Can encode UUID into the advertisement packet."
#~ msgstr "Pode codificar o UUID no pacote de anúncios."
#, fuzzy
#~ msgid "unpack requires a buffer of %d bytes"
#~ msgstr "Falha ao alocar buffer RX de %d bytes"
#~ msgid "Can not query for the device address."
#~ msgstr "Não é possível consultar o endereço do dispositivo."
#~ msgid "Invalid Service type"
#~ msgstr "Tipo de serviço inválido"
#~ msgid "Cannot set PPCP parameters."
#~ msgstr "Não é possível definir parâmetros PPCP."
#~ msgid "Can not apply device name in the stack."
#~ msgstr "Não é possível aplicar o nome do dispositivo na pilha."
#~ msgid "Cannot apply GAP parameters."
#~ msgstr "Não é possível aplicar parâmetros GAP."
#~ msgid "Can not apply advertisement data. status: 0x%02x"
#~ msgstr "Não é possível aplicar dados de anúncio. status: 0x%02x"
#~ msgid "Can not add Characteristic."
#~ msgstr "Não é possível adicionar Característica."
#~ msgid "busio.UART not available"
#~ msgstr "busio.UART não disponível"
#, fuzzy
#~ msgid "All PWM peripherals are in use"
#~ msgstr "Todos os temporizadores em uso"
#~ msgid "busio.UART not available"
#~ msgstr "busio.UART não disponível"
#~ msgid "Can not add Characteristic."
#~ msgstr "Não é possível adicionar Característica."
#~ msgid "Not enough pins available"
#~ msgstr "Não há pinos suficientes disponíveis"
#~ msgid "Can not apply advertisement data. status: 0x%02x"
#~ msgstr "Não é possível aplicar dados de anúncio. status: 0x%02x"
#~ msgid "Cannot apply GAP parameters."
#~ msgstr "Não é possível aplicar parâmetros GAP."
#~ msgid "Can not apply device name in the stack."
#~ msgstr "Não é possível aplicar o nome do dispositivo na pilha."
#~ msgid "Cannot set PPCP parameters."
#~ msgstr "Não é possível definir parâmetros PPCP."
#~ msgid "Invalid Service type"
#~ msgstr "Tipo de serviço inválido"
#~ msgid "Can not query for the device address."
#~ msgstr "Não é possível consultar o endereço do dispositivo."
#, fuzzy
#~ msgid "unpack requires a buffer of %d bytes"
#~ msgstr "Falha ao alocar buffer RX de %d bytes"
#~ msgid "Can encode UUID into the advertisement packet."
#~ msgstr "Pode codificar o UUID no pacote de anúncios."
#~ msgid "Baud rate too high for this SPI peripheral"
#~ msgstr "Taxa de transmissão muito alta para esse periférico SPI"
#~ msgid "Invalid UUID parameter"
#~ msgstr "Parâmetro UUID inválido"
#, fuzzy
#~ msgid "unicode_characters must be a string"
#~ msgstr "heap deve ser uma lista"
#~ msgid "Group empty"
#~ msgstr "Grupo vazio"
#, fuzzy
#~ msgid "Group must have %q at least 1"
#~ msgstr "Grupo deve ter tamanho pelo menos 1"
#~ msgid "index must be int"
#~ msgstr "index deve ser int"
#, fuzzy
#~ msgid "buffer_size must be >= 1"
#~ msgstr "buffers devem ser o mesmo tamanho"

21
main.c
View File

@ -127,6 +127,20 @@ void stop_mp(void) {
#if CIRCUITPY_NETWORK
network_module_deinit();
#endif
#if MICROPY_VFS
mp_vfs_mount_t *vfs = MP_STATE_VM(vfs_mount_table);
// Unmount all heap allocated vfs mounts.
while (gc_nbytes(vfs) > 0) {
vfs = vfs->next;
}
MP_STATE_VM(vfs_mount_table) = vfs;
MP_STATE_VM(vfs_cur) = vfs;
#endif
// Run any finalizers before we stop using the heap.
gc_sweep_all();
}
#define STRING_LIST(...) {__VA_ARGS__, ""}
@ -309,12 +323,12 @@ void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
mp_hal_delay_ms(1500);
// USB isn't up, so we can write the file.
filesystem_writable_by_python(true);
filesystem_set_internal_writable_by_usb(false);
f_open(fs, boot_output_file, CIRCUITPY_BOOT_OUTPUT_FILE, FA_WRITE | FA_CREATE_ALWAYS);
// Switch the filesystem back to non-writable by Python now instead of later,
// since boot.py might change it back to writable.
filesystem_writable_by_python(false);
filesystem_set_internal_writable_by_usb(true);
// Write version info to boot_out.txt.
mp_hal_stdout_tx_str(MICROPY_FULL_VERSION_INFO);
@ -402,7 +416,8 @@ int __attribute__((used)) main(void) {
// By default our internal flash is readonly to local python code and
// writable over USB. Set it here so that boot.py can change it.
filesystem_writable_by_python(false);
filesystem_set_internal_concurrent_write_protection(true);
filesystem_set_internal_writable_by_usb(true);
run_boot_py(safe_mode);

View File

@ -102,9 +102,9 @@ ifeq ($(DEBUG), 1)
# Turn on Python modules useful for debugging (e.g. uheap, ustack).
CFLAGS += -ggdb
# You may want to disable -flto if it interferes with debugging.
# CFLAGS += -flto
CFLAGS += -flto
# You may want to enable these flags to make setting breakpoints easier.
CFLAGS += -fno-inline -fno-ipa-sra
# CFLAGS += -fno-inline -fno-ipa-sra
ifeq ($(CHIP_FAMILY), samd21)
CFLAGS += -DENABLE_MICRO_TRACE_BUFFER
endif
@ -112,7 +112,7 @@ else
# -finline-limit can shrink the image size.
# -finline-limit=80 or so is similar to not having it on.
# There is no simple default value, though.
ifdef INTERNAL_FLASH_FILESYSTEM
ifeq ($(INTERNAL_FLASH_FILESYSTEM),1)
CFLAGS += -finline-limit=50
endif
ifdef CFLAGS_INLINE_LIMIT
@ -245,6 +245,7 @@ SRC_C = \
reset.c \
supervisor/shared/memory.c \
tick.c \
timer_handler.c \
ifeq ($(CIRCUITPY_NETWORK),1)

View File

@ -13,7 +13,7 @@ LONGINT_IMPL = NONE
CIRCUITPY_ANALOGIO = 0
CIRCUITPY_MATH = 0
CIRCUITPY_NEOPIXEL_WRITE = 0
#CIRCUITPY_RTC = 0
CIRCUITPY_RTC = 0
CIRCUITPY_SAMD = 0
CIRCUITPY_USB_MIDI = 0
CIRCUITPY_SMALL_BUILD = 1

View File

@ -48,7 +48,7 @@ uint8_t display_init_sequence[] = {
0xc1, 1, 0x10, // Power control SAP[2:0];BT[3:0]
0xc5, 2, 0x3e, 0x28, // VCM control
0xc7, 1, 0x86, // VCM control2
0x36, 1, 0x08, // Memory Access Control
0x36, 1, 0xa8, // Memory Access Control
0x37, 1, 0x00, // Vertical scroll zero
0x3a, 1, 0x55, // COLMOD: Pixel Format Set
0xb1, 2, 0x00, 0x18, // Frame Rate Control (In Normal Mode/Full Colors)
@ -82,7 +82,7 @@ void board_init(void) {
240, // Height
0, // column start
0, // row start
270, // rotation
0, // rotation
16, // Color depth
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command

View File

@ -31,6 +31,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_PB06) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_TFT_TE), MP_ROM_PTR(&pin_PB07) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_TFT_WR), MP_ROM_PTR(&pin_PB09) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_PB09) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_TFT_BACKLIGHT), MP_ROM_PTR(&pin_PB31) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_LCD_DATA0), MP_ROM_PTR(&pin_PA16) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_LCD_DATA1), MP_ROM_PTR(&pin_PA17) },

View File

@ -4,7 +4,6 @@ USB_PID = 0xEDBE
USB_PRODUCT = "SAM32"
USB_MANUFACTURER = "maholli"
QSPI_FLASH_FILESYSTEM = 0
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = MPZ

View File

@ -31,6 +31,7 @@
#include "py/runtime.h"
#include "shared-bindings/analogio/AnalogOut.h"
#include "shared-bindings/audioio/AudioOut.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "supervisor/shared/translate.h"
@ -138,5 +139,17 @@ void common_hal_analogio_analogout_set_value(analogio_analogout_obj_t *self,
}
void analogout_reset(void) {
// AudioOut resets the DAC in case its been used for audio which requires special handling.
// audioout_reset also resets the DAC, and does a smooth ramp down to avoid clicks
// if it was enabled, so do that instead if AudioOut is enabled.
#if CIRCUITPY_AUDIOIO
audioout_reset();
#else
#ifdef SAMD21
while (DAC->STATUS.reg & DAC_STATUS_SYNCBUSY) {}
#endif
#ifdef SAMD51
while (DAC->SYNCBUSY.reg & DAC_SYNCBUSY_SWRST) {}
#endif
DAC->CTRLA.reg |= DAC_CTRLA_SWRST;
#endif
}

View File

@ -47,6 +47,7 @@
#endif
#include "audio_dma.h"
#include "timer_handler.h"
#include "samd/dma.h"
#include "samd/events.h"
@ -251,6 +252,7 @@ void common_hal_audioio_audioout_construct(audioio_audioout_obj_t* self,
tc_gclk = 1;
#endif
set_timer_handler(true, tc_index, TC_HANDLER_NO_INTERRUPT);
turn_on_clocks(true, tc_index, tc_gclk);
// Don't bother setting the period. We set it before you playback anything.

View File

@ -31,6 +31,7 @@
#include "common-hal/pulseio/PWMOut.h"
#include "shared-bindings/pulseio/PWMOut.h"
#include "shared-bindings/microcontroller/Processor.h"
#include "timer_handler.h"
#include "atmel_start_pins.h"
#include "hal/utils/include/utils_repeat_macro.h"
@ -234,6 +235,7 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
}
}
set_timer_handler(timer->is_tc, timer->index, TC_HANDLER_NO_INTERRUPT);
// We use the zeroeth clock on either port to go full speed.
turn_on_clocks(timer->is_tc, timer->index, 0);

View File

@ -37,6 +37,7 @@
#include "py/runtime.h"
#include "shared-bindings/pulseio/PulseOut.h"
#include "supervisor/shared/translate.h"
#include "timer_handler.h"
// This timer is shared amongst all PulseOut objects under the assumption that
// the code is single threaded.
@ -112,6 +113,7 @@ void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
pulseout_tc_index = index;
set_timer_handler(true, index, TC_HANDLER_PULSEOUT);
// We use GCLK0 for SAMD21 and GCLK1 for SAMD51 because they both run at 48mhz making our
// math the same across the boards.
#ifdef SAMD21

View File

@ -36,8 +36,6 @@
#define SPI_FLASH_MAX_BAUDRATE 8000000
#define CIRCUITPY_DEFAULT_STACK_SIZE 4096
#define CIRCUITPY_I2C_SLAVE (0)
#define MICROPY_CPYTHON_COMPAT (0)
#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0)
#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (0)
@ -81,11 +79,10 @@
#include "peripherals/samd/dma.h"
#define MICROPY_PORT_ROOT_POINTERS \
CIRCUITPY_COMMON_ROOT_POINTERS \
mp_obj_t playing_audio[AUDIO_DMA_CHANNEL_COUNT] \
;
#include "py/circuitpy_mpconfig.h"
#define MICROPY_PORT_ROOT_POINTERS \
CIRCUITPY_COMMON_ROOT_POINTERS \
mp_obj_t playing_audio[AUDIO_DMA_CHANNEL_COUNT];
#endif // __INCLUDED_MPCONFIGPORT_H

View File

@ -14,6 +14,11 @@ ifeq ($(LONGINT_IMPL),LONGLONG)
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=longlong
endif
# Put samd51-only choices here.
ifeq ($(CHIP_FAMILY),samd51)
CIRCUITPY_SAMD = 1
endif
INTERNAL_LIBM = 1
USB_SERIAL_NUMBER_LENGTH = 32

@ -1 +1 @@
Subproject commit 235cb97d72648ec2889aba25ff4a34c4f32e2ac3
Subproject commit 6416828bb6821779d4c62fa3c7d41c95634173c0

View File

@ -194,20 +194,23 @@ safe_mode_t port_init(void) {
void reset_port(void) {
reset_sercoms();
#if defined(EXPRESS_BOARD) && !defined(__SAMR21G18A__)
#if CIRCUITPY_AUDIOIO
audio_dma_reset();
audioout_reset();
#if !defined(__SAMD51G19A__) && !defined(__SAMD51G18A__)
#endif
#if CIRCUITPY_AUDIOBUSIO
i2sout_reset();
#endif
//pdmin_reset();
#endif
#ifdef SAMD21
#if CIRCUITPY_TOUCHIO
touchin_reset();
#endif
eic_reset();
#if CIRCUITPY_PULSEIO
pulseout_reset();
pwmout_reset();
#endif
#if CIRCUITPY_ANALOGIO
analogin_reset();

View File

@ -0,0 +1,51 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
*
* 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.
*/
#include <stdbool.h>
#include <stdint.h>
#include "timer_handler.h"
#include "common-hal/pulseio/PulseOut.h"
static uint8_t tc_handler[TC_INST_NUM];
void set_timer_handler(bool is_tc, uint8_t index, uint8_t timer_handler) {
if (is_tc) {
tc_handler[index] = timer_handler;
}
}
void shared_timer_handler(bool is_tc, uint8_t index) {
// Add calls to interrupt handlers for specific functionality here.
// Make sure to add the handler #define to timer_handler.h
if (is_tc) {
uint8_t handler = tc_handler[index];
if (handler == TC_HANDLER_PULSEOUT) {
pulseout_interrupt_handler(index);
}
}
}

View File

@ -0,0 +1,35 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2018 Scott Shawcroft for Adafruit Industries
*
* 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 MICROPY_INCLUDED_ATMEL_SAMD_TIMER_HANDLER_H
#define MICROPY_INCLUDED_ATMEL_SAMD_TIMER_HANDLER_H
#define TC_HANDLER_NO_INTERRUPT 0x0
#define TC_HANDLER_PULSEOUT 0x1
void set_timer_handler(bool is_tc, uint8_t index, uint8_t timer_handler);
void shared_timer_handler(bool is_tc, uint8_t index);
#endif // MICROPY_INCLUDED_ATMEL_SAMD_TIMER_HANDLER_H

View File

@ -35,27 +35,20 @@
#include "nrf_soc.h"
#include "nrfx_power.h"
#include "py/misc.h"
#include "py/mpstate.h"
nrf_nvic_state_t nrf_nvic_state = { 0 };
__attribute__((aligned(4)))
static uint8_t m_ble_evt_buf[sizeof(ble_evt_t) + (BLE_GATT_ATT_MTU_DEFAULT)];
typedef struct event_handler {
struct event_handler *next;
void *param;
ble_drv_evt_handler_t func;
} event_handler_t;
static event_handler_t *m_event_handlers = NULL;
void ble_drv_reset() {
// Linked list items will be gc'd.
m_event_handlers = NULL;
MP_STATE_VM(ble_drv_evt_handler_entries) = NULL;
}
void ble_drv_add_event_handler(ble_drv_evt_handler_t func, void *param) {
event_handler_t *it = m_event_handlers;
ble_drv_evt_handler_entry_t *it = MP_STATE_VM(ble_drv_evt_handler_entries);
while (it != NULL) {
// If event handler and its corresponding param are already on the list, don't add again.
if ((it->func == func) && (it->param == param)) {
@ -65,17 +58,17 @@ void ble_drv_add_event_handler(ble_drv_evt_handler_t func, void *param) {
}
// Add a new handler to the front of the list
event_handler_t *handler = m_new_ll(event_handler_t, 1);
handler->next = m_event_handlers;
ble_drv_evt_handler_entry_t *handler = m_new_ll(ble_drv_evt_handler_entry_t, 1);
handler->next = MP_STATE_VM(ble_drv_evt_handler_entries);
handler->param = param;
handler->func = func;
m_event_handlers = handler;
MP_STATE_VM(ble_drv_evt_handler_entries) = handler;
}
void ble_drv_remove_event_handler(ble_drv_evt_handler_t func, void *param) {
event_handler_t *it = m_event_handlers;
event_handler_t **prev = &m_event_handlers;
ble_drv_evt_handler_entry_t *it = MP_STATE_VM(ble_drv_evt_handler_entries);
ble_drv_evt_handler_entry_t **prev = &MP_STATE_VM(ble_drv_evt_handler_entries);
while (it != NULL) {
if ((it->func == func) && (it->param == param)) {
// Splice out the matching handler.
@ -122,7 +115,7 @@ void SD_EVT_IRQHandler(void) {
break;
}
event_handler_t *it = m_event_handlers;
ble_drv_evt_handler_entry_t *it = MP_STATE_VM(ble_drv_evt_handler_entries);
while (it != NULL) {
it->func((ble_evt_t *)m_ble_evt_buf, it->param);
it = it->next;

View File

@ -50,6 +50,12 @@
typedef void (*ble_drv_evt_handler_t)(ble_evt_t*, void*);
typedef struct ble_drv_evt_handler_entry {
struct ble_drv_evt_handler_entry *next;
void *param;
ble_drv_evt_handler_t func;
} ble_drv_evt_handler_entry_t;
void ble_drv_reset(void);
void ble_drv_add_event_handler(ble_drv_evt_handler_t func, void *param);
void ble_drv_remove_event_handler(ble_drv_evt_handler_t func, void *param);

View File

@ -37,7 +37,7 @@
#define MICROPY_HW_LED_STATUS (&pin_P1_15)
#ifdef QSPI_FLASH_FILESYSTEM
#if QSPI_FLASH_FILESYSTEM
#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 17)
#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 22)
#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 23)
@ -46,7 +46,7 @@
#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 20)
#endif
#ifdef SPI_FLASH_FILESYSTEM
#if SPI_FLASH_FILESYSTEM
#define SPI_FLASH_MOSI_PIN &pin_P0_17
#define SPI_FLASH_MISO_PIN &pin_P0_22
#define SPI_FLASH_SCK_PIN &pin_P0_19

View File

@ -39,7 +39,7 @@
#define MICROPY_HW_RGB_LED_GREEN (&pin_P0_14)
#define MICROPY_HW_RGB_LED_BLUE (&pin_P0_15)
#ifdef QSPI_FLASH_FILESYSTEM
#if QSPI_FLASH_FILESYSTEM
#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 20)
#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 21)
#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 22)
@ -48,7 +48,7 @@
#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 17)
#endif
#ifdef SPI_FLASH_FILESYSTEM
#if SPI_FLASH_FILESYSTEM
#define SPI_FLASH_MOSI_PIN &pin_P0_20
#define SPI_FLASH_MISO_PIN &pin_P0_21
#define SPI_FLASH_SCK_PIN &pin_P0_19

View File

@ -39,7 +39,7 @@
#define MICROPY_HW_RGB_LED_GREEN (&pin_P0_14)
#define MICROPY_HW_RGB_LED_BLUE (&pin_P0_15)
#ifdef QSPI_FLASH_FILESYSTEM
#if QSPI_FLASH_FILESYSTEM
#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 20)
#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 21)
#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 22)
@ -48,7 +48,7 @@
#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 17)
#endif
#ifdef SPI_FLASH_FILESYSTEM
#if SPI_FLASH_FILESYSTEM
#define SPI_FLASH_MOSI_PIN &pin_P0_20
#define SPI_FLASH_MISO_PIN &pin_P0_21
#define SPI_FLASH_SCK_PIN &pin_P0_19

View File

@ -39,7 +39,7 @@
#define MICROPY_HW_RGB_LED_GREEN (&pin_P0_14)
#define MICROPY_HW_RGB_LED_BLUE (&pin_P0_15)
#ifdef QSPI_FLASH_FILESYSTEM
#if QSPI_FLASH_FILESYSTEM
#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 20)
#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 21)
#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 22)
@ -48,7 +48,7 @@
#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 17)
#endif
#ifdef SPI_FLASH_FILESYSTEM
#if SPI_FLASH_FILESYSTEM
#define SPI_FLASH_MOSI_PIN &pin_P0_20
#define SPI_FLASH_MISO_PIN &pin_P0_21
#define SPI_FLASH_SCK_PIN &pin_P0_19

View File

@ -49,7 +49,7 @@
// Quad mode: If all DATA0 --> DATA3 are valid
// Dual mode: If DATA0 and DATA1 are valid while either DATA2 and/or DATA3 are invalid
// Single mode: If only DATA0 is valid
#ifdef QSPI_FLASH_FILESYSTEM
#if QSPI_FLASH_FILESYSTEM
#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 20)
#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 21)
#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 22)
@ -58,7 +58,7 @@
#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 17)
#endif
#ifdef SPI_FLASH_FILESYSTEM
#if SPI_FLASH_FILESYSTEM
#define SPI_FLASH_MOSI_PIN &pin_P0_20
#define SPI_FLASH_MISO_PIN &pin_P0_21
#define SPI_FLASH_SCK_PIN &pin_P0_19

View File

@ -49,7 +49,7 @@
// Quad mode: If all DATA0 --> DATA3 are valid
// Dual mode: If DATA0 and DATA1 are valid while either DATA2 and/or DATA3 are invalid
// Single mode: If only DATA0 is valid
/*#ifdef QSPI_FLASH_FILESYSTEM
/*#if QSPI_FLASH_FILESYSTEM
#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 20)
#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 21)
#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 22)
@ -58,7 +58,7 @@
#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 17)
#endif
#ifdef SPI_FLASH_FILESYSTEM
#if SPI_FLASH_FILESYSTEM
#define SPI_FLASH_MOSI_PIN &pin_P0_20
#define SPI_FLASH_MISO_PIN &pin_P0_21
#define SPI_FLASH_SCK_PIN &pin_P0_19

View File

@ -21,6 +21,4 @@ endif
NRF_DEFINES += -DNRF52840_XXAA -DNRF52840
QSPI_FLASH_FILESYSTEM = 0
EXTERNAL_FLASH_DEVICE_COUNT = 0
EXTERNAL_FLASH_DEVICES =
INTERNAL_FLASH_FILESYSTEM = 1

View File

@ -29,7 +29,7 @@
#include "ble_drv.h"
#include "ble_gatts.h"
#include "sd_mutex.h"
#include "nrf_nvic.h"
#include "lib/utils/interrupt_char.h"
#include "py/runtime.h"
@ -47,14 +47,14 @@ STATIC void characteristic_buffer_on_ble_evt(ble_evt_t *ble_evt, void *param) {
ble_gatts_evt_write_t *evt_write = &ble_evt->evt.gatts_evt.params.write;
// Event handle must match the handle for my characteristic.
if (evt_write->handle == self->characteristic->handle) {
// Push all the data onto the ring buffer, but wait for any reads to finish.
sd_mutex_acquire_wait_no_vm(&self->ringbuf_mutex);
// Push all the data onto the ring buffer.
uint8_t is_nested_critical_region;
sd_nvic_critical_region_enter(&is_nested_critical_region);
for (size_t i = 0; i < evt_write->len; i++) {
ringbuf_put(&self->ringbuf, evt_write->data[i]);
}
// Don't check for errors: we're in an event handler.
sd_mutex_release(&self->ringbuf_mutex);
break;
sd_nvic_critical_region_exit(is_nested_critical_region);
break;
}
}
}
@ -72,7 +72,6 @@ void common_hal_bleio_characteristic_buffer_construct(bleio_characteristic_buffe
// This is a macro.
// true means long-lived, so it won't be moved.
ringbuf_alloc(&self->ringbuf, buffer_size, true);
sd_mutex_new(&self->ringbuf_mutex);
ble_drv_add_event_handler(characteristic_buffer_on_ble_evt, self);
@ -92,8 +91,9 @@ int common_hal_bleio_characteristic_buffer_read(bleio_characteristic_buffer_obj_
#endif
}
// Copy received data. Lock out writes while copying.
sd_mutex_acquire_wait(&self->ringbuf_mutex);
// Copy received data. Lock out write interrupt handler while copying.
uint8_t is_nested_critical_region;
sd_nvic_critical_region_enter(&is_nested_critical_region);
size_t rx_bytes = MIN(ringbuf_count(&self->ringbuf), len);
for ( size_t i = 0; i < rx_bytes; i++ ) {
@ -101,20 +101,25 @@ int common_hal_bleio_characteristic_buffer_read(bleio_characteristic_buffer_obj_
}
// Writes now OK.
sd_mutex_release_check(&self->ringbuf_mutex);
sd_nvic_critical_region_exit(is_nested_critical_region);
return rx_bytes;
}
uint32_t common_hal_bleio_characteristic_buffer_rx_characters_available(bleio_characteristic_buffer_obj_t *self) {
return ringbuf_count(&self->ringbuf);
uint8_t is_nested_critical_region;
sd_nvic_critical_region_enter(&is_nested_critical_region);
uint16_t count = ringbuf_count(&self->ringbuf);
sd_nvic_critical_region_exit(is_nested_critical_region);
return count;
}
void common_hal_bleio_characteristic_buffer_clear_rx_buffer(bleio_characteristic_buffer_obj_t *self) {
// prevent conflict with uart irq
sd_mutex_acquire_wait(&self->ringbuf_mutex);
uint8_t is_nested_critical_region;
sd_nvic_critical_region_enter(&is_nested_critical_region);
ringbuf_clear(&self->ringbuf);
sd_mutex_release_check(&self->ringbuf_mutex);
sd_nvic_critical_region_exit(is_nested_critical_region);
}
bool common_hal_bleio_characteristic_buffer_deinited(bleio_characteristic_buffer_obj_t *self) {

View File

@ -38,7 +38,6 @@ typedef struct {
uint32_t timeout_ms;
// Ring buffer storing consecutive incoming values.
ringbuf_t ringbuf;
nrf_mutex_t ringbuf_mutex;
} bleio_characteristic_buffer_obj_t;
#endif // MICROPY_INCLUDED_COMMON_HAL_BLEIO_CHARACTERISTICBUFFER_H

View File

@ -28,6 +28,8 @@
#ifndef NRF5_MPCONFIGPORT_H__
#define NRF5_MPCONFIGPORT_H__
#include "ble_drv.h"
#define MICROPY_CPYTHON_COMPAT (1)
//#define MICROPY_MODULE_BUILTIN_INIT (1) // TODO check this
//#define MICROPY_MODULE_WEAK_LINKS (1) // TODO check this
@ -52,10 +54,11 @@
// 24kiB stack
#define CIRCUITPY_DEFAULT_STACK_SIZE 0x6000
#define MICROPY_PORT_ROOT_POINTERS \
CIRCUITPY_COMMON_ROOT_POINTERS \
;
#include "py/circuitpy_mpconfig.h"
#define MICROPY_PORT_ROOT_POINTERS \
CIRCUITPY_COMMON_ROOT_POINTERS \
ble_drv_evt_handler_entry_t* ble_drv_evt_handler_entries; \
#endif // NRF5_MPCONFIGPORT_H__

View File

@ -7,6 +7,9 @@ INTERNAL_LIBM = 1
USB_SERIAL_NUMBER_LENGTH = 16
# All nRF ports have longints.
LONGINT_IMPL = MPZ
# No DAC, so no regular audio.
CIRCUITPY_AUDIOIO = 0

View File

@ -149,6 +149,7 @@ SRC_C = \
alloc.c \
coverage.c \
fatfs_port.c \
supervisor/stub/filesystem.c \
supervisor/stub/serial.c \
supervisor/stub/stack.c \
supervisor/shared/translate.c \

View File

@ -33,6 +33,9 @@
#ifndef __INCLUDED_MPCONFIG_CIRCUITPY_H
#define __INCLUDED_MPCONFIG_CIRCUITPY_H
// This is CircuitPython.
#define CIRCUITPY 1
// REPR_C encodes qstrs, 31-bit ints, and 30-bit floats in a single 32-bit word.
#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_C)
@ -123,7 +126,6 @@
#define MICROPY_FATFS_USE_LABEL (1)
#define MICROPY_FATFS_RPATH (2)
#define MICROPY_FATFS_MULTI_PARTITION (1)
#define MICROPY_FATFS_NUM_PERSISTENT (1)
// Only enable this if you really need it. It allocates a byte cache of this size.
// #define MICROPY_FATFS_MAX_SS (4096)
@ -168,7 +170,6 @@ typedef long mp_off_t;
{ MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&mp_builtin_input_obj }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
// board specific definitions
#include "mpconfigboard.h"
@ -176,20 +177,21 @@ typedef long mp_off_t;
// Remove some lesser-used functionality to make small builds fit.
#define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_ALL_SPECIAL_METHODS (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_BUILTINS_COMPLEX (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_BUILTINS_FROZENSET (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_BUILTINS_REVERSED (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_BUILTINS_STR_CENTER (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_BUILTINS_STR_PARTITION (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_BUILTINS_STR_SPLITLINES (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_UERRNO (CIRCUITPY_FULL_BUILD)
#define MICROPY_MODULE_WEAK_LINKS (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_ALL_SPECIAL_METHODS (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_BUILTINS_COMPLEX (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_BUILTINS_FROZENSET (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_BUILTINS_REVERSED (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_BUILTINS_STR_CENTER (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_BUILTINS_STR_PARTITION (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_BUILTINS_STR_SPLITLINES (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_UERRNO (CIRCUITPY_FULL_BUILD)
// Opposite setting is deliberate.
#define MICROPY_PY_UERRNO_ERRORCODE (!CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_URE (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_URE_MATCH_GROUPS (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_URE_MATCH_SPAN_START_END (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_URE_SUB (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_UERRNO_ERRORCODE (!CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_URE (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_URE_MATCH_GROUPS (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_URE_MATCH_SPAN_START_END (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_URE_SUB (CIRCUITPY_FULL_BUILD)
// LONGINT_IMPL_xxx are defined in the Makefile.
//
@ -204,6 +206,7 @@ typedef long mp_off_t;
#ifdef LONGINT_IMPL_LONGLONG
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_LONGLONG)
#define MP_SSIZE_MAX (0x7fffffff)
#endif
@ -340,8 +343,10 @@ extern const struct _mp_obj_module_t nvm_module;
#if CIRCUITPY_OS
extern const struct _mp_obj_module_t os_module;
#define OS_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_os), (mp_obj_t)&os_module },
#define OS_MODULE_ALT_NAME { MP_OBJ_NEW_QSTR(MP_QSTR__os), (mp_obj_t)&os_module },
#else
#define OS_MODULE
#define OS_MODULE_ALT_NAME
#endif
#if CIRCUITPY_PIXELBUF
@ -417,8 +422,10 @@ extern const struct _mp_obj_module_t supervisor_module;
#if CIRCUITPY_TIME
extern const struct _mp_obj_module_t time_module;
#define TIME_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&time_module },
#define TIME_MODULE_ALT_NAME { MP_OBJ_NEW_QSTR(MP_QSTR__time), (mp_obj_t)&time_module },
#else
#define TIME_MODULE
#define TIME_MODULE_ALT_NAME
#endif
#if CIRCUITPY_TOUCHIO
@ -456,17 +463,44 @@ extern const struct _mp_obj_module_t ustack_module;
#define USTACK_MODULE
#endif
// These modules are not yet in shared-bindings, but we prefer the non-uxxx names.
#if MICROPY_PY_UERRNO
#define ERRNO_MODULE { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_module_uerrno) },
#else
#define ERRNO_MODULE
#endif
#if MICROPY_PY_UJSON
#define JSON_MODULE { MP_ROM_QSTR(MP_QSTR_json), MP_ROM_PTR(&mp_module_ujson) },
#define JSON_MODULE { MP_ROM_QSTR(MP_QSTR_json), MP_ROM_PTR(&mp_module_ujson) },
#else
#define JSON_MODULE
#endif
#if MICROPY_PY_URE
#define RE_MODULE { MP_ROM_QSTR(MP_QSTR_re), MP_ROM_PTR(&mp_module_ure) },
#else
#define RE_MODULE
#endif
// Define certain native modules with weak links so they can be replaced with Python
// implementations. This list may grow over time.
#define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS \
OS_MODULE \
TIME_MODULE \
// Native modules that are weak links can be accessed directly
// by prepending their name with an underscore. This list should correspond to
// MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS, assuming you want the native modules
// to be accessible when overriden.
#define MICROPY_PORT_BUILTIN_MODULE_ALT_NAMES \
OS_MODULE_ALT_NAME \
TIME_MODULE_ALT_NAME \
// This is an inclusive list that should correspond to the CIRCUITPY_XXX list above,
// including dependendencies such as TERMINALIO depending on DISPLAYIO (shown by indentation).
// including dependencies such as TERMINALIO depending on DISPLAYIO (shown by indentation).
// Some of these definitions will be blank depending on what is turned on and off.
//
#define MICROPY_PORT_BUILTIN_MODULES \
// Some are omitted because they're in MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS above.
#define MICROPY_PORT_BUILTIN_MODULES_STRONG_LINKS \
ANALOGIO_MODULE \
AUDIOBUSIO_MODULE \
AUDIOIO_MODULE \
@ -477,6 +511,7 @@ extern const struct _mp_obj_module_t ustack_module;
DIGITALIO_MODULE \
TERMINALIO_MODULE \
DISPLAYIO_MODULE \
ERRNO_MODULE \
GAMEPAD_MODULE \
I2CSLAVE_MODULE \
JSON_MODULE \
@ -486,23 +521,35 @@ extern const struct _mp_obj_module_t ustack_module;
NETWORK_MODULE \
SOCKET_MODULE \
WIZNET_MODULE \
OS_MODULE \
PIXELBUF_MODULE \
PULSEIO_MODULE \
RANDOM_MODULE \
RE_MODULE \
RTC_MODULE \
SAMD_MODULE \
STAGE_MODULE \
STORAGE_MODULE \
STRUCT_MODULE \
SUPERVISOR_MODULE \
TIME_MODULE \
TOUCHIO_MODULE \
UHEAP_MODULE \
USB_HID_MODULE \
USB_MIDI_MODULE \
USTACK_MODULE \
// If weak links are enabled, just include strong links in the main list of modules,
// and also include the underscore alternate names.
#if MICROPY_MODULE_WEAK_LINKS
#define MICROPY_PORT_BUILTIN_MODULES \
MICROPY_PORT_BUILTIN_MODULES_STRONG_LINKS \
MICROPY_PORT_BUILTIN_MODULE_ALT_NAMES
#else
// If weak links are disabled, included both strong and potentially weak lines
#define MICROPY_PORT_BUILTIN_MODULES \
MICROPY_PORT_BUILTIN_MODULES_STRONG_LINKS \
MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS
#endif
// We need to provide a declaration/definition of alloca()
#include <alloca.h>

View File

@ -158,15 +158,12 @@ CIRCUITPY_RTC = 1
endif
CFLAGS += -DCIRCUITPY_RTC=$(CIRCUITPY_RTC)
# CIRCUITPY_SAMD is handled in the atmel-samd tree.
# Only for SAMD chips.
# Assume not a SAMD build.
ifndef CIRCUITPY_SAMD
ifneq ($(findstring sam,$(CHIP_FAMILY)),)
CIRCUITPY_SAMD = $(CIRCUITPY_FULL_BUILD)
else
# Not a SAMD build.
CIRCUITPY_SAMD = 0
endif
endif
CFLAGS += -DCIRCUITPY_SAMD=$(CIRCUITPY_SAMD)
# Currently always off.

View File

@ -84,7 +84,11 @@ STATIC const mp_obj_dict_t errorcode_dict = {
#endif
STATIC const mp_rom_map_elem_t mp_module_uerrno_globals_table[] = {
#if CIRCUITPY
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_errno) },
#else
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uerrno) },
#endif
#if MICROPY_PY_UERRNO_ERRORCODE
{ MP_ROM_QSTR(MP_QSTR_errorcode), MP_ROM_PTR(&errorcode_dict) },
#endif

View File

@ -45,6 +45,11 @@
#include <mpconfigport.h>
#endif
// Is this a CircuitPython build?
#ifndef CIRCUITPY
#define CIRCUITPY 0
#endif
// Any options not explicitly set in mpconfigport.h will get default
// values below.

View File

@ -148,11 +148,16 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = {
{ MP_ROM_QSTR(MP_QSTR_array), MP_ROM_PTR(&mp_module_array) },
#endif
#if MICROPY_PY_IO
#if CIRCUITPY
{ MP_ROM_QSTR(MP_QSTR_io), MP_ROM_PTR(&mp_module_io) },
#else
{ MP_ROM_QSTR(MP_QSTR_uio), MP_ROM_PTR(&mp_module_io) },
#endif
#endif
#if MICROPY_PY_COLLECTIONS
{ MP_ROM_QSTR(MP_QSTR_collections), MP_ROM_PTR(&mp_module_collections) },
#endif
// CircuitPython: Now in shared-bindings/, so not defined here.
#if MICROPY_PY_STRUCT
{ MP_ROM_QSTR(MP_QSTR_ustruct), MP_ROM_PTR(&mp_module_ustruct) },
#endif
@ -178,8 +183,13 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = {
// extmod modules
#if MICROPY_PY_UERRNO
#if CIRCUITPY
// CircuitPython: Defined in MICROPY_PORT_BUILTIN_MODULES, so not defined here.
// TODO: move to shared-bindings/
#else
{ MP_ROM_QSTR(MP_QSTR_uerrno), MP_ROM_PTR(&mp_module_uerrno) },
#endif
#endif
#if MICROPY_PY_UCTYPES
{ MP_ROM_QSTR(MP_QSTR_uctypes), MP_ROM_PTR(&mp_module_uctypes) },
#endif
@ -187,11 +197,21 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = {
{ MP_ROM_QSTR(MP_QSTR_uzlib), MP_ROM_PTR(&mp_module_uzlib) },
#endif
#if MICROPY_PY_UJSON
#if CIRCUITPY
// CircuitPython: Defined in MICROPY_PORT_BUILTIN_MODULES, so not defined here.
// TODO: move to shared-bindings/
#else
{ MP_ROM_QSTR(MP_QSTR_ujson), MP_ROM_PTR(&mp_module_ujson) },
#endif
#endif
#if MICROPY_PY_URE
#if CIRCUITPY
// CircuitPython: Defined in MICROPY_PORT_BUILTIN_MODULES, so not defined here.
// TODO: move to shared-bindings/
#else
{ MP_ROM_QSTR(MP_QSTR_ure), MP_ROM_PTR(&mp_module_ure) },
#endif
#endif
#if MICROPY_PY_UHEAPQ
{ MP_ROM_QSTR(MP_QSTR_uheapq), MP_ROM_PTR(&mp_module_uheapq) },
#endif

View File

@ -131,31 +131,6 @@ void mp_init(void) {
sizeof(MP_STATE_VM(fs_user_mount)) - MICROPY_FATFS_NUM_PERSISTENT);
#endif
#if MICROPY_VFS
#if MICROPY_FATFS_NUM_PERSISTENT > 0
// We preserve the last MICROPY_FATFS_NUM_PERSISTENT mounts because newer
// mounts are put at the front of the list.
mp_vfs_mount_t *vfs = MP_STATE_VM(vfs_mount_table);
// Count how many mounts we have.
uint8_t count = 0;
while (vfs != NULL) {
vfs = vfs->next;
count++;
}
// Find the vfs MICROPY_FATFS_NUM_PERSISTENT mounts from the end.
vfs = MP_STATE_VM(vfs_mount_table);
for (uint8_t j = 0; j < count - MICROPY_FATFS_NUM_PERSISTENT; j++) {
vfs = vfs->next;
}
MP_STATE_VM(vfs_mount_table) = vfs;
MP_STATE_VM(vfs_cur) = vfs;
#else
// initialise the VFS sub-system
MP_STATE_VM(vfs_cur) = NULL;
MP_STATE_VM(vfs_mount_table) = NULL;
#endif
#endif
#if MICROPY_PY_THREAD_GIL
mp_thread_mutex_init(&MP_STATE_VM(gil_mutex));
#endif

View File

@ -129,8 +129,8 @@ STATIC mp_obj_t audiobusio_pdmin_make_new(const mp_obj_type_t *type, size_t n_ar
}
bool mono = args[ARG_mono].u_bool;
float startup_delay = (args[ARG_startup_delay].u_obj == MP_OBJ_NULL)
? STARTUP_DELAY_DEFAULT
mp_float_t startup_delay = (args[ARG_startup_delay].u_obj == MP_OBJ_NULL)
? (mp_float_t)STARTUP_DELAY_DEFAULT
: mp_obj_get_float(args[ARG_startup_delay].u_obj);
if (startup_delay < 0.0 || startup_delay > 1.0) {
mp_raise_ValueError(translate("Microphone startup delay must be in range 0.0 to 1.0"));

View File

@ -116,7 +116,7 @@ STATIC mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, co
}
mp_float_t timeout = mp_obj_get_float(args[ARG_timeout].u_obj);
if (timeout > 100.0f) {
if (timeout > (mp_float_t)100.0) {
mp_raise_ValueError(translate("timeout >100 (units are now seconds, not msecs)"));
}

View File

@ -54,10 +54,12 @@
//|
//| This is the CircuitPython analog to the UNIX ``mount`` command.
//|
//| :param bool readonly: True when the filesystem should be readonly to CircuitPython.
//|
mp_obj_t storage_mount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_readonly };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_readonly, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_false} },
{ MP_QSTR_readonly, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
};
// parse args
@ -77,7 +79,7 @@ mp_obj_t storage_mount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_arg
mp_raise_ValueError(translate("filesystem must provide mount method"));
}
common_hal_storage_mount(vfs_obj, mnt_str, mp_obj_is_true(args[ARG_readonly].u_obj));
common_hal_storage_mount(vfs_obj, mnt_str, args[ARG_readonly].u_bool);
return mp_const_none;
}
@ -101,14 +103,21 @@ mp_obj_t storage_umount(mp_obj_t mnt_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(storage_umount_obj, storage_umount);
//| .. function:: remount(mount_path, readonly=False)
//| .. function:: remount(mount_path, readonly=False, *, disable_concurrent_write_protection=False)
//|
//| Remounts the given path with new parameters.
//|
//| :param bool readonly: True when the filesystem should be readonly to CircuitPython.
//| :param bool disable_concurrent_write_protection: When True, the check that makes sure the
//| underlying filesystem data is written by one computer is disabled. Disabling the protection
//| allows CircuitPython and a host to write to the same filesystem with the risk that the
//| filesystem will be corrupted.
//|
mp_obj_t storage_remount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_readonly };
enum { ARG_readonly, ARG_disable_concurrent_write_protection };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_readonly, MP_ARG_BOOL | MP_ARG_REQUIRED, {.u_bool = false} },
{ MP_QSTR_readonly, MP_ARG_BOOL, {.u_bool = false} },
{ MP_QSTR_disable_concurrent_write_protection, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
};
// get the mount point
@ -118,7 +127,7 @@ mp_obj_t storage_remount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_a
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
common_hal_storage_remount(mnt_str, args[ARG_readonly].u_bool);
common_hal_storage_remount(mnt_str, args[ARG_readonly].u_bool, args[ARG_disable_concurrent_write_protection].u_bool);
return mp_const_none;
}

View File

@ -33,7 +33,7 @@
void common_hal_storage_mount(mp_obj_t vfs_obj, const char* path, bool readonly);
void common_hal_storage_umount_path(const char* path);
void common_hal_storage_umount_object(mp_obj_t vfs_obj);
void common_hal_storage_remount(const char* path, bool readonly);
void common_hal_storage_remount(const char* path, bool readonly, bool disable_concurrent_write_protection);
mp_obj_t common_hal_storage_getmount(const char* path);
void common_hal_storage_erase_filesystem(void);

View File

@ -121,7 +121,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
// Always set the backlight type in case we're reusing memory.
self->backlight_inout.base.type = &mp_type_NoneType;
if (backlight_pin != NULL && common_hal_mcu_pin_is_free(backlight_pin)) {
pwmout_result_t result = common_hal_pulseio_pwmout_construct(&self->backlight_pwm, backlight_pin, 0, 5000, false);
pwmout_result_t result = common_hal_pulseio_pwmout_construct(&self->backlight_pwm, backlight_pin, 0, 50000, false);
if (result != PWMOUT_OK) {
self->backlight_inout.base.type = &digitalio_digitalinout_type;
common_hal_digitalio_digitalinout_construct(&self->backlight_inout, backlight_pin);

View File

@ -2,10 +2,12 @@
#include <string.h>
#include "shared-module/displayio/__init__.h"
#include "py/reload.h"
#include "shared-bindings/displayio/Bitmap.h"
#include "shared-bindings/displayio/Display.h"
#include "shared-bindings/displayio/Group.h"
#include "shared-bindings/displayio/Palette.h"
#include "supervisor/shared/autoreload.h"
#include "supervisor/shared/display.h"
#include "supervisor/memory.h"
#include "supervisor/usb.h"
@ -18,7 +20,19 @@ static inline void swap(uint16_t* a, uint16_t* b) {
*b = temp;
}
bool refreshing_displays = false;
void displayio_refresh_displays(void) {
// Somehow reloads from the sdcard are being lost. So, cheat and reraise.
if (reload_requested) {
mp_raise_reload_exception();
return;
}
if (refreshing_displays) {
return;
}
refreshing_displays = true;
for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {
if (displays[i].display.base.type == NULL || displays[i].display.base.type == &mp_type_NoneType) {
continue;
@ -27,6 +41,7 @@ void displayio_refresh_displays(void) {
displayio_display_update_backlight(display);
if (!displayio_display_frame_queued(display)) {
refreshing_displays = false;
return;
}
if (displayio_display_refresh_queued(display)) {
@ -89,8 +104,9 @@ void displayio_refresh_displays(void) {
index += 1;
// The buffer is full, send it.
if (index >= buffer_size) {
if (!displayio_display_send_pixels(display, buffer, buffer_size / 2)) {
if (!displayio_display_send_pixels(display, buffer, buffer_size / 2) || reload_requested) {
displayio_display_finish_region_update(display);
refreshing_displays = false;
return;
}
// TODO(tannewt): Make refresh displays faster so we don't starve other
@ -103,12 +119,14 @@ void displayio_refresh_displays(void) {
// Send the remaining data.
if (index && !displayio_display_send_pixels(display, buffer, index * 2)) {
displayio_display_finish_region_update(display);
refreshing_displays = false;
return;
}
displayio_display_finish_region_update(display);
}
displayio_display_finish_refresh(display);
}
refreshing_displays = false;
}
void common_hal_displayio_release_displays(void) {

View File

@ -143,7 +143,7 @@ mp_obj_t common_hal_storage_getmount(const char *mount_path) {
return storage_object_from_path(mount_path);
}
void common_hal_storage_remount(const char *mount_path, bool readonly) {
void common_hal_storage_remount(const char *mount_path, bool readonly, bool disable_concurrent_write_protection) {
if (strcmp(mount_path, "/") != 0) {
mp_raise_OSError(MP_EINVAL);
}
@ -156,7 +156,8 @@ void common_hal_storage_remount(const char *mount_path, bool readonly) {
}
#endif
supervisor_flash_set_usb_writable(readonly);
filesystem_set_internal_writable_by_usb(readonly);
filesystem_set_internal_concurrent_write_protection(!disable_concurrent_write_protection);
}
void common_hal_storage_erase_filesystem(void) {

View File

@ -29,9 +29,16 @@
#include <stdbool.h>
#include "extmod/vfs_fat.h"
void filesystem_init(bool create_allowed, bool force_create);
void filesystem_flush(void);
void filesystem_writable_by_python(bool writable);
bool filesystem_present(void);
void filesystem_set_internal_writable_by_usb(bool usb_writable);
void filesystem_set_internal_concurrent_write_protection(bool concurrent_write_protection);
void filesystem_set_writable_by_usb(fs_user_mount_t *vfs, bool usb_writable);
void filesystem_set_concurrent_write_protection(fs_user_mount_t *vfs, bool concurrent_write_protection);
bool filesystem_is_writable_by_python(fs_user_mount_t *vfs);
bool filesystem_is_writable_by_usb(fs_user_mount_t *vfs);
#endif // MICROPY_INCLUDED_SUPERVISOR_FILESYSTEM_H

View File

@ -37,7 +37,6 @@
#include "supervisor/internal_flash.h"
#endif
void supervisor_flash_set_usb_writable(bool usb_writable);
void supervisor_flash_init(void);
uint32_t supervisor_flash_get_block_size(void);
uint32_t supervisor_flash_get_block_count(void);

View File

@ -24,6 +24,8 @@
* THE SOFTWARE.
*/
#include "supervisor/filesystem.h"
#include "extmod/vfs_fat.h"
#include "lib/oofatfs/ff.h"
#include "lib/oofatfs/diskio.h"
@ -92,16 +94,42 @@ void filesystem_flush(void) {
supervisor_flash_flush();
}
void filesystem_writable_by_python(bool writable) {
void filesystem_set_internal_writable_by_usb(bool writable) {
fs_user_mount_t *vfs = &_internal_vfs;
if (writable) {
filesystem_set_writable_by_usb(vfs, writable);
}
void filesystem_set_writable_by_usb(fs_user_mount_t *vfs, bool usb_writable) {
if (usb_writable) {
vfs->flags |= FSUSER_USB_WRITABLE;
} else {
vfs->flags &= ~FSUSER_USB_WRITABLE;
}
}
bool filesystem_is_writable_by_python(fs_user_mount_t *vfs) {
return (vfs->flags & FSUSER_CONCURRENT_WRITE_PROTECTED) == 0 ||
(vfs->flags & FSUSER_USB_WRITABLE) == 0;
}
bool filesystem_is_writable_by_usb(fs_user_mount_t *vfs) {
return (vfs->flags & FSUSER_CONCURRENT_WRITE_PROTECTED) == 0 ||
(vfs->flags & FSUSER_USB_WRITABLE) != 0;
}
void filesystem_set_internal_concurrent_write_protection(bool concurrent_write_protection) {
filesystem_set_concurrent_write_protection(&_internal_vfs, concurrent_write_protection);
}
void filesystem_set_concurrent_write_protection(fs_user_mount_t *vfs, bool concurrent_write_protection) {
if (concurrent_write_protection) {
vfs->flags |= FSUSER_CONCURRENT_WRITE_PROTECTED;
} else {
vfs->flags &= ~FSUSER_CONCURRENT_WRITE_PROTECTED;
}
}
bool filesystem_present(void) {
return true;
}

View File

@ -33,26 +33,6 @@
#define PART1_START_BLOCK (0x1)
void supervisor_flash_set_usb_writable(bool usb_writable) {
mp_vfs_mount_t* current_mount = MP_STATE_VM(vfs_mount_table);
for (uint8_t i = 0; current_mount != NULL; i++) {
if (i == VFS_INDEX) {
break;
}
current_mount = current_mount->next;
}
if (current_mount == NULL) {
return;
}
fs_user_mount_t *vfs = (fs_user_mount_t *) current_mount->obj;
if (usb_writable) {
vfs->flags |= FSUSER_USB_WRITABLE;
} else {
vfs->flags &= ~FSUSER_USB_WRITABLE;
}
}
// there is a singleton Flash object
const mp_obj_type_t supervisor_flash_type;
STATIC const mp_obj_base_t supervisor_flash_obj = {&supervisor_flash_type};

View File

@ -34,6 +34,7 @@
#include "lib/oofatfs/ff.h"
#include "py/mpstate.h"
#include "supervisor/filesystem.h"
#include "supervisor/shared/autoreload.h"
#define MSC_FLASH_BLOCK_SIZE 512
@ -148,8 +149,7 @@ bool tud_msc_is_writable_cb(uint8_t lun) {
if (vfs == NULL) {
return false;
}
if (vfs->writeblocks[0] == MP_OBJ_NULL ||
(vfs->flags & FSUSER_USB_WRITABLE) == 0) {
if (vfs->writeblocks[0] == MP_OBJ_NULL || !filesystem_is_writable_by_usb(vfs)) {
return false;
}
return true;

View File

@ -26,13 +26,17 @@
#include "supervisor/filesystem.h"
void filesystem_init(void) {
void filesystem_init(bool create_allowed, bool force_create) {
(void) create_allowed;
(void) force_create;
}
void filesystem_flush(void) {
}
void filesystem_writable_by_python(bool writable) {
bool filesystem_is_writable_by_python(fs_user_mount_t *vfs) {
(void) vfs;
return true;
}
bool filesystem_present(void) {

View File

@ -17,6 +17,17 @@ ifndef $(NO_USB)
NO_USB = $(wildcard supervisor/usb.c)
endif
ifneq ($(INTERNAL_FLASH_FILESYSTEM),)
CFLAGS += -DINTERNAL_FLASH_FILESYSTEM=$(INTERNAL_FLASH_FILESYSTEM)
endif
ifneq ($(QSPI_FLASH_FILESYSTEM),)
# EXPRESS_BOARD is obsolete and should be removed when samd-peripherals is updated.
CFLAGS += -DQSPI_FLASH_FILESYSTEM=$(QSPI_FLASH_FILESYSTEM) -DEXPRESS_BOARD
endif
ifneq ($(SPI_FLASH_FILESYSTEM),)
# EXPRESS_BOARD is obsolete and should be removed when samd-peripherals is updated.
CFLAGS += -DSPI_FLASH_FILESYSTEM=$(SPI_FLASH_FILESYSTEM) -DEXPRESS_BOARD
endif
# Choose which flash filesystem impl to use.
# (Right now INTERNAL_FLASH_FILESYSTEM and SPI_FLASH_FILESYSTEM are mutually exclusive.
@ -27,11 +38,10 @@ ifdef EXTERNAL_FLASH_DEVICES
SRC_SUPERVISOR += supervisor/shared/external_flash/external_flash.c
ifeq ($(SPI_FLASH_FILESYSTEM),1)
CFLAGS += -DSPI_FLASH_FILESYSTEM
SRC_SUPERVISOR += supervisor/shared/external_flash/spi_flash.c
else
endif
ifeq ($(QSPI_FLASH_FILESYSTEM),1)
CFLAGS += -DQSPI_FLASH_FILESYSTEM
SRC_SUPERVISOR += supervisor/qspi_flash.c supervisor/shared/external_flash/qspi_flash.c
endif
else