Skip to content

Commit f63b26c

Browse files
committed
address jepler's comments and further squeezes
1 parent 3c20b5f commit f63b26c

File tree

30 files changed

+116
-130
lines changed

30 files changed

+116
-130
lines changed

locale/circuitpython.pot

Lines changed: 48 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ msgstr ""
8080
msgid "%q and %q contain duplicate pins"
8181
msgstr ""
8282

83+
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
84+
msgid "%q and %q must be different"
85+
msgstr ""
86+
8387
#: shared-bindings/microcontroller/Pin.c
8488
msgid "%q contains duplicate pins"
8589
msgstr ""
@@ -179,9 +183,9 @@ msgstr ""
179183
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
180184
#: ports/cxd56/common-hal/pulseio/PulseIn.c
181185
#: ports/nrf/common-hal/pulseio/PulseIn.c
182-
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
183186
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
184-
#: ports/stm/common-hal/pulseio/PulseIn.c shared-bindings/canio/Match.c
187+
#: ports/stm/common-hal/pulseio/PulseIn.c py/argcheck.c
188+
#: shared-bindings/canio/Match.c
185189
msgid "%q out of range"
186190
msgstr ""
187191

@@ -646,6 +650,10 @@ msgstr ""
646650
msgid "Call super().__init__() before accessing native object."
647651
msgstr ""
648652

653+
#: ports/cxd56/common-hal/camera/Camera.c
654+
msgid "Camera init"
655+
msgstr ""
656+
649657
#: ports/espressif/common-hal/alarm/pin/PinAlarm.c
650658
msgid "Can only alarm on RTC IO from deep sleep."
651659
msgstr ""
@@ -693,18 +701,10 @@ msgstr ""
693701
msgid "Cannot have scan responses for extended, connectable advertisements."
694702
msgstr ""
695703

696-
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
697-
msgid "Cannot output both channels on the same pin"
698-
msgstr ""
699-
700704
#: ports/espressif/common-hal/alarm/pin/PinAlarm.c
701705
msgid "Cannot pull on input-only pin."
702706
msgstr ""
703707

704-
#: shared-module/bitbangio/SPI.c
705-
msgid "Cannot read without MISO pin"
706-
msgstr ""
707-
708708
#: shared-bindings/audiobusio/PDMIn.c
709709
msgid "Cannot record to a file"
710710
msgstr ""
@@ -752,10 +752,6 @@ msgstr ""
752752
msgid "Cannot wake on pin edge. Only level."
753753
msgstr ""
754754

755-
#: shared-module/bitbangio/SPI.c
756-
msgid "Cannot write without MOSI pin"
757-
msgstr ""
758-
759755
#: shared-bindings/_bleio/CharacteristicBuffer.c
760756
msgid "CharacteristicBuffer writing not provided"
761757
msgstr ""
@@ -786,28 +782,6 @@ msgstr ""
786782
msgid "Corrupt .mpy file"
787783
msgstr ""
788784

789-
#: ports/cxd56/common-hal/camera/Camera.c ports/cxd56/common-hal/gnss/GNSS.c
790-
#: ports/cxd56/common-hal/sdioio/SDCard.c
791-
msgid "Could not initialize %q"
792-
msgstr ""
793-
794-
#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
795-
#: ports/espressif/common-hal/busio/UART.c
796-
msgid "Could not initialize UART"
797-
msgstr ""
798-
799-
#: ports/stm/common-hal/pwmio/PWMOut.c
800-
msgid "Could not re-init channel"
801-
msgstr ""
802-
803-
#: ports/stm/common-hal/pwmio/PWMOut.c
804-
msgid "Could not re-init timer"
805-
msgstr ""
806-
807-
#: ports/stm/common-hal/pwmio/PWMOut.c
808-
msgid "Could not restart PWM"
809-
msgstr ""
810-
811785
#: ports/espressif/common-hal/neopixel_write/__init__.c
812786
msgid "Could not retrieve clock"
813787
msgstr ""
@@ -1038,6 +1012,10 @@ msgstr ""
10381012
msgid "Function requires lock"
10391013
msgstr ""
10401014

1015+
#: ports/cxd56/common-hal/gnss/GNSS.c
1016+
msgid "GNSS init"
1017+
msgstr ""
1018+
10411019
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
10421020
msgid "Generic Failure"
10431021
msgstr ""
@@ -1182,12 +1160,7 @@ msgstr ""
11821160
msgid "Invalid %q"
11831161
msgstr ""
11841162

1185-
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
1186-
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
1187-
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
1188-
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c
1189-
#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c
1190-
#: ports/stm/common-hal/canio/CAN.c ports/stm/common-hal/sdioio/SDCard.c
1163+
#: shared-bindings/microcontroller/Pin.c
11911164
msgid "Invalid %q pin"
11921165
msgstr ""
11931166

@@ -1208,8 +1181,7 @@ msgstr ""
12081181
msgid "Invalid MAC address"
12091182
msgstr ""
12101183

1211-
#: ports/espressif/bindings/espidf/__init__.c
1212-
#: ports/espressif/common-hal/busio/I2C.c ports/espressif/esp_error.c
1184+
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
12131185
#: py/moduerrno.c
12141186
msgid "Invalid argument"
12151187
msgstr ""
@@ -1235,15 +1207,7 @@ msgstr ""
12351207
msgid "Invalid multicast MAC address"
12361208
msgstr ""
12371209

1238-
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
1239-
msgid "Invalid pin for left channel"
1240-
msgstr ""
1241-
1242-
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
1243-
msgid "Invalid pin for right channel"
1244-
msgstr ""
1245-
1246-
#: ports/espressif/common-hal/busio/UART.c shared-bindings/busio/UART.c
1210+
#: shared-bindings/busio/UART.c
12471211
msgid "Invalid pins"
12481212
msgstr ""
12491213

@@ -1412,7 +1376,7 @@ msgstr ""
14121376
msgid "No MISO Pin"
14131377
msgstr ""
14141378

1415-
#: ports/stm/common-hal/busio/SPI.c
1379+
#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c
14161380
msgid "No MISO pin"
14171381
msgstr ""
14181382

@@ -1421,7 +1385,7 @@ msgstr ""
14211385
msgid "No MOSI Pin"
14221386
msgstr ""
14231387

1424-
#: ports/stm/common-hal/busio/SPI.c
1388+
#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c
14251389
msgid "No MOSI pin"
14261390
msgstr ""
14271391

@@ -1658,6 +1622,10 @@ msgid ""
16581622
"PWM frequency not writable when variable_frequency is False on construction."
16591623
msgstr ""
16601624

1625+
#: ports/stm/common-hal/pwmio/PWMOut.c
1626+
msgid "PWM restart"
1627+
msgstr ""
1628+
16611629
#: ports/raspberrypi/common-hal/countio/Counter.c
16621630
msgid "PWM slice already in use"
16631631
msgstr ""
@@ -1678,10 +1646,6 @@ msgstr ""
16781646
msgid "Pin cannot wake from Deep Sleep"
16791647
msgstr ""
16801648

1681-
#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c
1682-
msgid "Pin cannot wake from deep sleep"
1683-
msgstr ""
1684-
16851649
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
16861650
msgid "Pin count too large"
16871651
msgstr ""
@@ -1777,7 +1741,8 @@ msgstr ""
17771741
msgid "RNG Init Error"
17781742
msgstr ""
17791743

1780-
#: ports/nrf/common-hal/busio/UART.c
1744+
#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
1745+
#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
17811746
msgid "RS485"
17821747
msgstr ""
17831748

@@ -1790,11 +1755,6 @@ msgstr ""
17901755
msgid "RTC is not supported on this board"
17911756
msgstr ""
17921757

1793-
#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
1794-
#: ports/stm/common-hal/busio/UART.c
1795-
msgid "RTS/CTS/RS485 Not yet supported on this device"
1796-
msgstr ""
1797-
17981758
#: ports/stm/common-hal/os/__init__.c
17991759
msgid "Random number generation error"
18001760
msgstr ""
@@ -1844,6 +1804,10 @@ msgstr ""
18441804
msgid "SD card CSD format not supported"
18451805
msgstr ""
18461806

1807+
#: ports/cxd56/common-hal/sdioio/SDCard.c
1808+
msgid "SDCard init"
1809+
msgstr ""
1810+
18471811
#: ports/stm/common-hal/sdioio/SDCard.c
18481812
#, c-format
18491813
msgid "SDIO GetCardInfo Error %d"
@@ -1867,7 +1831,7 @@ msgid "SPI peripheral in use"
18671831
msgstr ""
18681832

18691833
#: ports/stm/common-hal/busio/SPI.c
1870-
msgid "SPI re-initialization error"
1834+
msgid "SPI re-init"
18711835
msgstr ""
18721836

18731837
#: shared-bindings/is31fl3741/FrameBuffer.c
@@ -2062,19 +2026,20 @@ msgid "Tuple or struct_time argument required"
20622026
msgstr ""
20632027

20642028
#: ports/stm/common-hal/busio/UART.c
2065-
msgid "UART de-init error"
2029+
msgid "UART de-init"
20662030
msgstr ""
20672031

2068-
#: ports/stm/common-hal/busio/UART.c
2069-
msgid "UART init error"
2032+
#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
2033+
#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
2034+
msgid "UART init"
20702035
msgstr ""
20712036

20722037
#: ports/stm/common-hal/busio/UART.c
2073-
msgid "UART re-init error"
2038+
msgid "UART re-init"
20742039
msgstr ""
20752040

20762041
#: ports/stm/common-hal/busio/UART.c
2077-
msgid "UART write error"
2042+
msgid "UART write"
20782043
msgstr ""
20792044

20802045
#: shared-module/usb_hid/Device.c
@@ -2211,10 +2176,6 @@ msgid ""
22112176
"declined or ignored."
22122177
msgstr ""
22132178

2214-
#: ports/cxd56/common-hal/busio/I2C.c ports/espressif/common-hal/busio/UART.c
2215-
msgid "Unsupported baudrate"
2216-
msgstr ""
2217-
22182179
#: shared-bindings/bitmaptools/__init__.c
22192180
msgid "Unsupported colorspace"
22202181
msgstr ""
@@ -2227,10 +2188,6 @@ msgstr ""
22272188
msgid "Unsupported format"
22282189
msgstr ""
22292190

2230-
#: ports/atmel-samd/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c
2231-
msgid "Unsupported frequency"
2232-
msgstr ""
2233-
22342191
#: ports/espressif/common-hal/dualbank/__init__.c
22352192
msgid "Update Failed"
22362193
msgstr ""
@@ -2671,6 +2628,10 @@ msgstr ""
26712628
msgid "casting"
26722629
msgstr ""
26732630

2631+
#: ports/stm/common-hal/pwmio/PWMOut.c
2632+
msgid "channel re-init"
2633+
msgstr ""
2634+
26742635
#: shared-bindings/_stage/Text.c
26752636
msgid "chars buffer too small"
26762637
msgstr ""
@@ -3107,6 +3068,10 @@ msgstr ""
31073068
msgid "indices must be integers, slices, or Boolean lists"
31083069
msgstr ""
31093070

3071+
#: ports/espressif/common-hal/busio/I2C.c
3072+
msgid "init I2C"
3073+
msgstr ""
3074+
31103075
#: extmod/ulab/code/scipy/optimize/optimize.c
31113076
msgid "initial values must be iterable"
31123077
msgstr ""
@@ -4025,6 +3990,10 @@ msgstr ""
40253990
msgid "timeout waiting for v2 card"
40263991
msgstr ""
40273992

3993+
#: ports/stm/common-hal/pwmio/PWMOut.c
3994+
msgid "timer re-init"
3995+
msgstr ""
3996+
40283997
#: shared-bindings/time/__init__.c
40293998
msgid "timestamp out of range for platform time_t"
40303999
msgstr ""

ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ static void pinalarm_set_alarms_deep(size_t n_alarms, const mp_obj_t *alarms) {
261261
}
262262
}
263263
if (t->n < 0) {
264-
mp_raise_ValueError(translate("Pin cannot wake from deep sleep"));
264+
raise_ValueError_invalid_pin();
265265
}
266266

267267
// It is strange, but to my experiment, interrupt during sleep

ports/atmel-samd/common-hal/audiobusio/I2SOut.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,16 @@ void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t *self,
151151
}
152152
#endif
153153
if (bc_clock_unit == 0xff) {
154-
mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_bit_clock);
154+
raise_ValueError_invalid_pin_name(MP_QSTR_clock);
155155
}
156156
if (ws_clock_unit == 0xff) {
157-
mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_word_select);
157+
raise_ValueError_invalid_pin_name(MP_QSTR_word_select);
158158
}
159159
if (bc_clock_unit != ws_clock_unit) {
160160
mp_raise_ValueError(translate("Bit clock and word select must share a clock unit"));
161161
}
162162
if (serializer == 0xff) {
163-
mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_data);
163+
raise_ValueError_invalid_pin_name(MP_QSTR_data);
164164
}
165165
self->clock_unit = ws_clock_unit;
166166
self->serializer = serializer;

ports/atmel-samd/common-hal/audiobusio/PDMIn.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self,
121121
self->clock_unit = 1;
122122
#endif
123123
} else {
124-
mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_clock);
124+
raise_ValueError_invalid_pin_name(MP_QSTR_clock);
125125
}
126126

127127
self->data_pin = data_pin; // PA07, PA19 -> SD0, PA08, PB16 -> SD1
@@ -152,7 +152,7 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self,
152152
self->serializer = 1;
153153
#endif
154154
} else {
155-
mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_data);
155+
raise_ValueError_invalid_pin_name(MP_QSTR_data);
156156
}
157157

158158
if (!(bit_depth == 16 || bit_depth == 8) || !mono || oversample != OVERSAMPLING) {

ports/atmel-samd/common-hal/audioio/AudioOut.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,14 @@ void common_hal_audioio_audioout_construct(audioio_audioout_obj_t *self,
143143
#ifdef SAM_D5X_E5X
144144
self->right_channel = NULL;
145145
if (left_channel != &pin_PA02 && left_channel != &pin_PA05) {
146-
mp_raise_ValueError(translate("Invalid pin for left channel"));
146+
raise_ValueError_invalid_pin_name(MP_QSTR_left_channel);
147147
}
148148
if (right_channel != NULL && right_channel != &pin_PA02 && right_channel != &pin_PA05) {
149-
mp_raise_ValueError(translate("Invalid pin for right channel"));
149+
raise_ValueError_invalid_pin_name(MP_QSTR_right_channel);
150150
}
151151
if (right_channel == left_channel) {
152-
mp_raise_ValueError(translate("Cannot output both channels on the same pin"));
152+
mp_raise_ValueError_varg(translate("%q and %q must be different"),
153+
MP_QSTR_left_channel, MP_QSTR_right_channel);
153154
}
154155
claim_pin(left_channel);
155156
if (right_channel != NULL) {

ports/atmel-samd/common-hal/busio/I2C.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
128128
reset_pin_number(sda->number);
129129
reset_pin_number(scl->number);
130130
common_hal_busio_i2c_deinit(self);
131-
mp_raise_ValueError(translate("Unsupported frequency"));
131+
mp_arg_error_invalid(MP_QSTR_frequency);
132132
}
133133

134134
self->sda_pin = sda->number;

ports/atmel-samd/common-hal/busio/UART.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
7777
self->tx_pin = NO_PIN;
7878

7979
if ((rts != NULL) || (cts != NULL) || (rs485_dir != NULL) || (rs485_invert)) {
80-
mp_raise_ValueError(translate("RTS/CTS/RS485 Not yet supported on this device"));
80+
mp_raise_NotImplementedError(translate("RS485"));
8181
}
8282

8383
mp_arg_validate_int_max(bits, 8, MP_QSTR_bits);
@@ -183,7 +183,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
183183
}
184184

185185
if (usart_async_init(usart_desc_p, sercom, self->buffer, self->buffer_length, NULL) != ERR_NONE) {
186-
mp_raise_ValueError(translate("Could not initialize UART"));
186+
mp_raise_RuntimeError(translate("UART init"));
187187
}
188188

189189
// usart_async_init() sets a number of defaults based on a prototypical SERCOM

0 commit comments

Comments
 (0)