Skip to content

Commit fc30c80

Browse files
authored
Merge pull request #9100 from dhalbert/9.0.x-to-main-2024-03-27
Merge 9.0.x changes to main
2 parents 06d8d2c + e10b179 commit fc30c80

File tree

5 files changed

+39
-13
lines changed

5 files changed

+39
-13
lines changed

ports/espressif/boards/adafruit_itsybitsy_esp32/pins.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
3131
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) },
3232
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) },
3333

34-
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO17) },
35-
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO16) },
34+
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO0) },
35+
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO2) },
3636
{ MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO35) },
3737

3838
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },

ports/raspberrypi/common-hal/socketpool/Socket.c

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,15 +1184,35 @@ void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t *self, uint
11841184
}
11851185

11861186
int common_hal_socketpool_socket_setsockopt(socketpool_socket_obj_t *self, int level, int optname, const void *value, size_t optlen) {
1187-
if (level == SOCKETPOOL_IPPROTO_TCP && optname == SOCKETPOOL_TCP_NODELAY) {
1188-
int one = 1;
1189-
bool enable = optlen == sizeof(&one) && memcmp(value, &one, optlen);
1190-
if (enable) {
1191-
tcp_set_flags(self->pcb.tcp, TF_NODELAY);
1192-
} else {
1193-
tcp_clear_flags(self->pcb.tcp, TF_NODELAY);
1194-
}
1195-
return 0;
1187+
int zero = 0;
1188+
bool enable = optlen == sizeof(&zero) && memcmp(value, &zero, optlen);
1189+
1190+
switch (level) {
1191+
case SOCKETPOOL_IPPROTO_TCP:
1192+
switch (optname) {
1193+
case SOCKETPOOL_TCP_NODELAY:
1194+
if (enable) {
1195+
tcp_set_flags(self->pcb.tcp, TF_NODELAY);
1196+
} else {
1197+
tcp_clear_flags(self->pcb.tcp, TF_NODELAY);
1198+
}
1199+
return 0;
1200+
break;
1201+
}
1202+
break;
1203+
1204+
case SOCKETPOOL_SOL_SOCKET:
1205+
switch (optname) {
1206+
case SOCKETPOOL_SO_REUSEADDR:
1207+
if (enable) {
1208+
ip_set_option(self->pcb.ip, SOF_REUSEADDR);
1209+
} else {
1210+
ip_reset_option(self->pcb.ip, SOF_REUSEADDR);
1211+
}
1212+
return 0;
1213+
break;
1214+
}
1215+
break;
11961216
}
11971217
return -MP_EOPNOTSUPP;
11981218
}

py/circuitpy_mpconfig.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@
3838
// Always 1: defined in circuitpy_mpconfig.mk
3939
// #define CIRCUITPY (1)
4040

41+
// Can be removed once CircuitPython 10 is released.
42+
// Print warnings or not about deprecated names. See objmodule.c.
43+
#ifndef CIRCUITPY_8_9_WARNINGS
44+
#define CIRCUITPY_8_9_WARNINGS (0)
45+
#endif
46+
4147
// REPR_C encodes qstrs, 31-bit ints, and 30-bit floats in a single 32-bit word.
4248
#ifndef MICROPY_OBJ_REPR
4349
#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_C)

py/objmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ STATIC void module_attr_try_delegation(mp_obj_t self_in, qstr attr, mp_obj_t *de
6666
STATIC void module_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
6767
mp_obj_module_t *self = MP_OBJ_TO_PTR(self_in);
6868
if (dest[0] == MP_OBJ_NULL) {
69-
#if CIRCUITPY_DISPLAYIO && CIRCUITPY_WARNINGS
69+
#if CIRCUITPY_8_9_WARNINGS && CIRCUITPY_DISPLAYIO && CIRCUITPY_WARNINGS
7070
if (self == &displayio_module) {
7171
#if CIRCUITPY_BUSDISPLAY
7272
if (attr == MP_QSTR_Display) {

shared-bindings/busdisplay/BusDisplay.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
//| b"\x11\x80\x78"# Exit Sleep then delay 0x78 (120ms)
105105
//| b"\x29\x81\xaa\x78"# Display on then delay 0x78 (120ms)
106106
//| )
107-
//| display = displayio.Display(display_bus, init_sequence, width=320, height=240)
107+
//| display = busdisplay.BusDisplay(display_bus, init_sequence, width=320, height=240)
108108
//|
109109
//| The first command is 0xe1 with 15 (0xf) parameters following. The second is 0x11 with 0
110110
//| parameters and a 120ms (0x78) delay. The third command is 0x29 with one parameter 0xaa and a

0 commit comments

Comments
 (0)