Merge branch 'main' of github.com:felixerdy/circuitpython

This commit is contained in:
felixerdy 2021-03-12 17:59:44 +01:00
commit 2009aecac3
4 changed files with 27 additions and 30 deletions

View File

@ -8,15 +8,15 @@ msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n" "POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: 2021-03-07 15:50+0000\n" "PO-Revision-Date: 2021-03-12 02:03+0000\n"
"Last-Translator: Jose David M <jquintana202020@gmail.com>\n" "Last-Translator: Alvaro Figueroa <alvaro@greencore.co.cr>\n"
"Language-Team: \n" "Language-Team: \n"
"Language: es\n" "Language: es\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n" "Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.5.1\n" "X-Generator: Weblate 4.5.2-dev\n"
#: main.c #: main.c
msgid "" msgid ""
@ -1836,7 +1836,7 @@ msgstr ""
#: ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c #: ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c
msgid "Pins must be sequential" msgid "Pins must be sequential"
msgstr "" msgstr "Los pines deben estar en orden secuencial"
#: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c
msgid "Pins must share PWM slice" msgid "Pins must share PWM slice"
@ -2142,11 +2142,10 @@ msgid ""
"enough power for the whole circuit and press reset (after ejecting " "enough power for the whole circuit and press reset (after ejecting "
"CIRCUITPY).\n" "CIRCUITPY).\n"
msgstr "" msgstr ""
"La alimentación del microntrolador cayó. Asegúrate que tu fuente de " "La alimentación del microntrolador bajó. Asegúrate que tu fuente de "
"alimentación\n" "alimentación\n"
"pueda aportar suficiente energía para todo el circuito y presiona reset " "pueda aportar suficiente energía para todo el circuito y presiona reset ("
"(luego de\n" "luego de expulsar CIRCUITPY)\n"
"expulsar CIRCUITPY)\n"
#: shared-module/audiomixer/MixerVoice.c #: shared-module/audiomixer/MixerVoice.c
msgid "The sample's bits_per_sample does not match the mixer's" msgid "The sample's bits_per_sample does not match the mixer's"
@ -2818,7 +2817,7 @@ msgstr "circulo solo puede ser registrado con un pariente"
#: shared-bindings/bitmaptools/__init__.c #: shared-bindings/bitmaptools/__init__.c
msgid "clip point must be (x,y) tuple" msgid "clip point must be (x,y) tuple"
msgstr "El punto clip debe ser una tupla (x, y)" msgstr "El punto de recorte debe ser una tupla (x, y)"
#: shared-bindings/msgpack/ExtType.c #: shared-bindings/msgpack/ExtType.c
msgid "code outside range 0~127" msgid "code outside range 0~127"
@ -3842,7 +3841,7 @@ msgstr "presionando ambos botones al inicio.\n"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "pull masks conflict with direction masks" msgid "pull masks conflict with direction masks"
msgstr "" msgstr "máscara de pull en conflicto con máscara de dirección"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c #: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "pull_threshold must be between 1 and 32" msgid "pull_threshold must be between 1 and 32"

View File

@ -53,7 +53,6 @@ void i2c_reset(void) {
} }
} }
} }
static bool i2c_inited[I2C_NUM_MAX];
void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
const mcu_pin_obj_t* scl, const mcu_pin_obj_t* sda, uint32_t frequency, uint32_t timeout) { const mcu_pin_obj_t* scl, const mcu_pin_obj_t* sda, uint32_t frequency, uint32_t timeout) {
@ -90,10 +89,9 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
#endif #endif
if (xSemaphoreCreateBinaryStatic(&self->semaphore) != &self->semaphore) { if (xSemaphoreCreateMutexStatic(&self->semaphore) != &self->semaphore) {
mp_raise_RuntimeError(translate("Unable to create lock")); mp_raise_RuntimeError(translate("Unable to create lock"));
} }
xSemaphoreGive(&self->semaphore);
self->sda_pin = sda; self->sda_pin = sda;
self->scl_pin = scl; self->scl_pin = scl;
self->i2c_num = I2C_NUM_MAX; self->i2c_num = I2C_NUM_MAX;
@ -106,6 +104,10 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
mp_raise_ValueError(translate("All I2C peripherals are in use")); mp_raise_ValueError(translate("All I2C peripherals are in use"));
} }
i2c_status[self->i2c_num] = STATUS_IN_USE; i2c_status[self->i2c_num] = STATUS_IN_USE;
// Delete any previous driver.
i2c_driver_delete(self->i2c_num);
i2c_config_t i2c_conf = { i2c_config_t i2c_conf = {
.mode = I2C_MODE_MASTER, .mode = I2C_MODE_MASTER,
.sda_io_num = self->sda_pin->number, .sda_io_num = self->sda_pin->number,
@ -117,23 +119,16 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
.clk_speed = frequency, .clk_speed = frequency,
} }
}; };
esp_err_t result = i2c_param_config(self->i2c_num, &i2c_conf); if (i2c_param_config(self->i2c_num, &i2c_conf) != ESP_OK) {
if (result != ESP_OK) { mp_raise_ValueError(translate("Invalid frequency"));
mp_raise_ValueError(translate("Invalid pins"));
} }
if (i2c_driver_install(self->i2c_num,
if (!i2c_inited[self->i2c_num]) { I2C_MODE_MASTER,
result = i2c_driver_install(self->i2c_num, 0,
I2C_MODE_MASTER, 0,
0, 0) != ESP_OK) {
0, mp_raise_OSError(MP_EIO);
0);
if (result != ESP_OK) {
mp_raise_OSError(MP_EIO);
}
i2c_inited[self->i2c_num] = true;
} }
claim_pin(sda); claim_pin(sda);
@ -149,12 +144,14 @@ void common_hal_busio_i2c_deinit(busio_i2c_obj_t *self) {
return; return;
} }
i2c_status[self->i2c_num] = STATUS_FREE; i2c_driver_delete(self->i2c_num);
common_hal_reset_pin(self->sda_pin); common_hal_reset_pin(self->sda_pin);
common_hal_reset_pin(self->scl_pin); common_hal_reset_pin(self->scl_pin);
self->sda_pin = NULL; self->sda_pin = NULL;
self->scl_pin = NULL; self->scl_pin = NULL;
i2c_status[self->i2c_num] = STATUS_FREE;
} }
bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) { bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) {

View File

@ -109,6 +109,7 @@ void common_hal_wifi_init(void) {
wifi_radio_obj_t* self = &common_hal_wifi_radio_obj; wifi_radio_obj_t* self = &common_hal_wifi_radio_obj;
self->netif = esp_netif_create_default_wifi_sta(); self->netif = esp_netif_create_default_wifi_sta();
self->started = false;
// Even though we just called esp_netif_create_default_wifi_sta, // Even though we just called esp_netif_create_default_wifi_sta,
// station mode isn't actually ready for use until esp_wifi_set_mode() // station mode isn't actually ready for use until esp_wifi_set_mode()

@ -1 +1 @@
Subproject commit ebe7784258d8c10e9cc334ccc00c3fd270746c8b Subproject commit f30a865fd1a44d880b909b84112f74741412c2ce