Skip to content

Commit 0c418e9

Browse files
committed
Merge remote-tracking branch 'adafruit/main' into auto_wifi
2 parents dc794f9 + ab346a2 commit 0c418e9

File tree

15 files changed

+258
-88
lines changed

15 files changed

+258
-88
lines changed

locale/cs.po

Lines changed: 62 additions & 57 deletions
Large diffs are not rendered by default.

ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ CIRCUITPY_PS2IO = 0
2727
CIRCUITPY_RGBMATRIX = 0
2828
CIRCUITPY_ROTARYIO = 0
2929
CIRCUITPY_TOUCHIO = 0
30+
CIRCUITPY_USB_HID = 0
31+
CIRCUITPY_USB_MIDI = 0
3032

3133
CIRCUITPY_ULAB = 0
3234

ports/atmel-samd/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0)
4747
#define MICROPY_PY_FUNCTION_ATTRS (0)
4848
#define MICROPY_PY_REVERSE_SPECIAL_METHODS (0)
49+
#define MICROPY_PY_COLLECTIONS_DEQUE (0)
4950
#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (0)
5051
#define MICROPY_PY_UERRNO_LIST \
5152
X(EPERM) \

ports/espressif/common-hal/busio/UART.c

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
108108
bool have_rx = rx != NULL;
109109
bool have_rts = rts != NULL;
110110
bool have_cts = cts != NULL;
111+
112+
uart_config_t uart_config = {0};
111113
bool have_rs485_dir = rs485_dir != NULL;
112114
if (!have_tx && !have_rx) {
113115
mp_raise_ValueError(translate("tx and rx cannot both be None"));
@@ -135,25 +137,26 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
135137
}
136138

137139
uart_mode_t mode = UART_MODE_UART;
138-
uart_hw_flowcontrol_t flow_control = UART_HW_FLOWCTRL_DISABLE;
140+
uart_config.flow_ctrl = UART_HW_FLOWCTRL_DISABLE;
139141
if (have_rs485_dir) {
140142
mode = UART_MODE_RS485_HALF_DUPLEX;
141143
if (!rs485_invert) {
144+
// This one is not in the set
142145
uart_set_line_inverse(self->uart_num, UART_SIGNAL_DTR_INV);
143146
}
144147
} else if (have_rts && have_cts) {
145-
flow_control = UART_HW_FLOWCTRL_CTS_RTS;
148+
uart_config.flow_ctrl = UART_HW_FLOWCTRL_CTS_RTS;
146149
} else if (have_rts) {
147-
flow_control = UART_HW_FLOWCTRL_RTS;
150+
uart_config.flow_ctrl = UART_HW_FLOWCTRL_RTS;
148151
} else if (have_rts) {
149-
flow_control = UART_HW_FLOWCTRL_CTS;
152+
uart_config.flow_ctrl = UART_HW_FLOWCTRL_CTS;
150153
}
151154

152155
if (receiver_buffer_size <= UART_FIFO_LEN) {
153156
receiver_buffer_size = UART_FIFO_LEN + 8;
154157
}
155158

156-
uint8_t rx_threshold = UART_FIFO_LEN - 8;
159+
uart_config.rx_flow_ctrl_thresh = UART_FIFO_LEN - 8;
157160
// Install the driver before we change the settings.
158161
if (uart_driver_install(self->uart_num, receiver_buffer_size, 0, 20, &self->event_queue, 0) != ESP_OK ||
159162
uart_set_mode(self->uart_num, mode) != ESP_OK) {
@@ -175,55 +178,62 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
175178
CONFIG_PTHREAD_TASK_PRIO_DEFAULT,
176179
&self->event_task,
177180
xPortGetCoreID());
178-
uart_set_hw_flow_ctrl(self->uart_num, flow_control, rx_threshold);
181+
// uart_set_hw_flow_ctrl(self->uart_num, uart_config.flow_control, uart_config.rx_flow_ctrl_thresh);
179182

180183
// Set baud rate
181-
common_hal_busio_uart_set_baudrate(self, baudrate);
184+
// common_hal_busio_uart_set_baudrate(self, baudrate);
185+
uart_config.baud_rate = baudrate;
182186

183-
uart_word_length_t word_length = UART_DATA_8_BITS;
187+
uart_config.data_bits = UART_DATA_8_BITS;
184188
switch (bits) {
185189
// Shared bindings prevents data < 7 bits.
186190
// case 5:
187-
// word_length = UART_DATA_5_BITS;
191+
// uart_config.data_bits = UART_DATA_5_BITS;
188192
// break;
189193
// case 6:
190-
// word_length = UART_DATA_6_BITS;
194+
// uart_config.data_bits = UART_DATA_6_BITS;
191195
// break;
192196
case 7:
193-
word_length = UART_DATA_7_BITS;
197+
uart_config.data_bits = UART_DATA_7_BITS;
194198
break;
195199
case 8:
196-
word_length = UART_DATA_8_BITS;
200+
uart_config.data_bits = UART_DATA_8_BITS;
197201
break;
198202
default:
199203
// Won't hit this because shared-bindings limits to 7-9 bits. We error on 9 above.
200204
break;
201205
}
202-
uart_set_word_length(self->uart_num, word_length);
206+
// uart_set_word_length(self->uart_num, uart_config.data_bits);
203207

204-
uart_parity_t parity_mode = UART_PARITY_DISABLE;
208+
uart_config.parity = UART_PARITY_DISABLE;
205209
switch (parity) {
206210
case BUSIO_UART_PARITY_NONE:
207-
parity_mode = UART_PARITY_DISABLE;
211+
uart_config.parity = UART_PARITY_DISABLE;
208212
break;
209213
case BUSIO_UART_PARITY_EVEN:
210-
parity_mode = UART_PARITY_EVEN;
214+
uart_config.parity = UART_PARITY_EVEN;
211215
break;
212216
case BUSIO_UART_PARITY_ODD:
213-
parity_mode = UART_PARITY_ODD;
217+
uart_config.parity = UART_PARITY_ODD;
214218
break;
215219
default:
216220
// Won't reach here because the input is an enum that is completely handled.
217221
break;
218222
}
219-
uart_set_parity(self->uart_num, parity_mode);
223+
// uart_set_parity(self->uart_num, uart_config.parity);
220224

221225
// Stop is 1 or 2 always.
222-
uart_stop_bits_t stop_bits = UART_STOP_BITS_1;
226+
uart_config.stop_bits = UART_STOP_BITS_1;
223227
if (stop == 2) {
224-
stop_bits = UART_STOP_BITS_2;
228+
uart_config.stop_bits = UART_STOP_BITS_2;
229+
}
230+
// uart_set_stop_bits(self->uart_num, stop_bits);
231+
uart_config.source_clk = UART_SCLK_APB; // guessing here...
232+
233+
// config all in one?
234+
if (uart_param_config(self->uart_num, &uart_config) != ESP_OK) {
235+
mp_raise_RuntimeError(translate("UART init"));
225236
}
226-
uart_set_stop_bits(self->uart_num, stop_bits);
227237

228238
self->tx_pin = NULL;
229239
self->rx_pin = NULL;

ports/stm/boards/swan_r5/mpconfigboard.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,4 @@ CIRCUITPY_BLEIO = 0
7070
CIRCUITPY_BUSDEVICE = 0
7171
CIRCUITPY_KEYPAD = 1
7272
CIRCUITPY_RGBMATRIX = 0
73+
CIRCUITPY_RTC = 1

ports/stm/common-hal/rtc/RTC.c

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 20212 Matthew McGowan for Blues Wireless Inc
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#include <stdio.h>
28+
29+
#include "py/obj.h"
30+
#include "py/runtime.h"
31+
#include "shared/timeutils/timeutils.h"
32+
#include "shared-bindings/rtc/__init__.h"
33+
#include "common-hal/rtc/RTC.h"
34+
#include "shared-bindings/rtc/RTC.h"
35+
#include "supervisor/port.h"
36+
#include "supervisor/shared/translate/translate.h"
37+
#include "peripherals/rtc.h"
38+
39+
40+
void common_hal_rtc_set_time(timeutils_struct_time_t *tm) {
41+
stm32_peripherals_rtc_set_time(tm);
42+
}
43+
44+
void common_hal_rtc_get_time(timeutils_struct_time_t *tm) {
45+
stm32_peripherals_rtc_get_time(tm);
46+
}
47+
48+
int common_hal_rtc_get_calibration(void) {
49+
return 0;
50+
}
51+
52+
void common_hal_rtc_set_calibration(int calibration) {
53+
mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_calibration);
54+
}

ports/stm/common-hal/rtc/RTC.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2022 Matthew McGowan for Blues Wireless Inc
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#ifndef MICROPY_INCLUDED_STM_COMMON_HAL_RTC_RTC_H
28+
#define MICROPY_INCLUDED_STM_COMMON_HAL_RTC_RTC_H
29+
30+
extern void rtc_init(void);
31+
extern void rtc_reset(void);
32+
33+
#endif // MICROPY_INCLUDED_STM_COMMON_HAL_RTC_RTC_H

ports/stm/common-hal/rtc/__init__.c

Whitespace-only changes.

ports/stm/common-hal/rtc/__init__.h

Whitespace-only changes.

ports/stm/mpconfigport.mk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ifeq ($(MCU_SERIES),F4)
2424
CIRCUITPY_I2CPERIPHERAL ?= 0
2525
CIRCUITPY_NVM ?= 0
2626
CIRCUITPY_ROTARYIO ?= 0
27-
CIRCUITPY_RTC ?= 0
27+
CIRCUITPY_RTC ?= 1
2828
USB_NUM_ENDPOINT_PAIRS = 4
2929
UF2_FAMILY_ID ?= 0x57755a57
3030
endif
@@ -42,7 +42,7 @@ ifeq ($(MCU_SERIES),H7)
4242
CIRCUITPY_PULSEIO ?= 0
4343
CIRCUITPY_PWMIO ?= 0
4444
CIRCUITPY_ROTARYIO ?= 0
45-
CIRCUITPY_RTC ?= 0
45+
CIRCUITPY_RTC ?= 1
4646

4747
USB_NUM_ENDPOINT_PAIRS = 9
4848
UF2_FAMILY_ID ?= 0x6db66082
@@ -59,7 +59,7 @@ ifeq ($(MCU_SERIES),F7)
5959
CIRCUITPY_NEOPIXEL_WRITE ?= 0
6060
CIRCUITPY_NVM ?= 0
6161
CIRCUITPY_ROTARYIO ?= 0
62-
CIRCUITPY_RTC ?= 0
62+
CIRCUITPY_RTC ?= 1
6363

6464
USB_NUM_ENDPOINT_PAIRS = 6
6565
UF2_FAMILY_ID ?= 0x53b80f00
@@ -76,7 +76,7 @@ ifeq ($(MCU_SERIES),L4)
7676
CIRCUITPY_NEOPIXEL_WRITE ?= 0
7777
CIRCUITPY_NVM ?= 0
7878
CIRCUITPY_ROTARYIO ?= 0
79-
CIRCUITPY_RTC ?= 0
79+
CIRCUITPY_RTC ?= 1
8080
# todo - this varies between devices in the series
8181
# This slide deck https://www.st.com/content/ccc/resource/training/technical/product_training/98/89/c8/6c/3e/e9/49/79/STM32L4_Peripheral_USB.pdf/files/STM32L4_Peripheral_USB.pdf/jcr:content/translations/en.STM32L4_Peripheral_USB.pdf
8282
# cites 16 endpoints, 8 endpoint pairs, while section 3.39 of the L4R5 datasheet states 6 endpoint pairs.

0 commit comments

Comments
 (0)