kopia lustrzana https://github.com/micropython/micropython
cc3200/mods: Access dict map directly instead of using helper func.
rodzic
a6ea6b08bc
commit
fb8fc597cf
|
@ -118,7 +118,7 @@ void pin_init0(void) {
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
// assign all pins to the GPIO module so that peripherals can be connected to any
|
// assign all pins to the GPIO module so that peripherals can be connected to any
|
||||||
// pins without conflicts after a soft reset
|
// pins without conflicts after a soft reset
|
||||||
mp_map_t *named_map = mp_obj_dict_get_map((mp_obj_t)&pin_board_pins_locals_dict);
|
const mp_map_t *named_map = &pin_board_pins_locals_dict.map;
|
||||||
for (uint i = 0; i < named_map->used - 1; i++) {
|
for (uint i = 0; i < named_map->used - 1; i++) {
|
||||||
pin_obj_t * pin = (pin_obj_t *)named_map->table[i].value;
|
pin_obj_t * pin = (pin_obj_t *)named_map->table[i].value;
|
||||||
pin_deassign (pin);
|
pin_deassign (pin);
|
||||||
|
@ -207,8 +207,8 @@ int8_t pin_find_af_index (const pin_obj_t* pin, uint8_t fn, uint8_t unit, uint8_
|
||||||
DEFINE PRIVATE FUNCTIONS
|
DEFINE PRIVATE FUNCTIONS
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
STATIC pin_obj_t *pin_find_named_pin(const mp_obj_dict_t *named_pins, mp_obj_t name) {
|
STATIC pin_obj_t *pin_find_named_pin(const mp_obj_dict_t *named_pins, mp_obj_t name) {
|
||||||
mp_map_t *named_map = mp_obj_dict_get_map((mp_obj_t)named_pins);
|
const mp_map_t *named_map = &named_pins->map;
|
||||||
mp_map_elem_t *named_elem = mp_map_lookup(named_map, name, MP_MAP_LOOKUP);
|
mp_map_elem_t *named_elem = mp_map_lookup((mp_map_t*)named_map, name, MP_MAP_LOOKUP);
|
||||||
if (named_elem != NULL && named_elem->value != NULL) {
|
if (named_elem != NULL && named_elem->value != NULL) {
|
||||||
return named_elem->value;
|
return named_elem->value;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ STATIC pin_obj_t *pin_find_named_pin(const mp_obj_dict_t *named_pins, mp_obj_t n
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC pin_obj_t *pin_find_pin_by_port_bit (const mp_obj_dict_t *named_pins, uint port, uint bit) {
|
STATIC pin_obj_t *pin_find_pin_by_port_bit (const mp_obj_dict_t *named_pins, uint port, uint bit) {
|
||||||
mp_map_t *named_map = mp_obj_dict_get_map((mp_obj_t)named_pins);
|
const mp_map_t *named_map = &named_pins->map;
|
||||||
for (uint i = 0; i < named_map->used; i++) {
|
for (uint i = 0; i < named_map->used; i++) {
|
||||||
if ((((pin_obj_t *)named_map->table[i].value)->port == port) &&
|
if ((((pin_obj_t *)named_map->table[i].value)->port == port) &&
|
||||||
(((pin_obj_t *)named_map->table[i].value)->bit == bit)) {
|
(((pin_obj_t *)named_map->table[i].value)->bit == bit)) {
|
||||||
|
@ -236,7 +236,7 @@ STATIC int8_t pin_obj_find_af (const pin_obj_t* pin, uint8_t fn, uint8_t unit, u
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC void pin_free_af_from_pins (uint8_t fn, uint8_t unit, uint8_t type) {
|
STATIC void pin_free_af_from_pins (uint8_t fn, uint8_t unit, uint8_t type) {
|
||||||
mp_map_t *named_map = mp_obj_dict_get_map((mp_obj_t)&pin_board_pins_locals_dict);
|
const mp_map_t *named_map = &pin_board_pins_locals_dict.map;
|
||||||
for (uint i = 0; i < named_map->used - 1; i++) {
|
for (uint i = 0; i < named_map->used - 1; i++) {
|
||||||
pin_obj_t * pin = (pin_obj_t *)named_map->table[i].value;
|
pin_obj_t * pin = (pin_obj_t *)named_map->table[i].value;
|
||||||
// af is different than GPIO
|
// af is different than GPIO
|
||||||
|
|
|
@ -528,7 +528,7 @@ STATIC void pyb_sleep_obj_wakeup (void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC void pyb_sleep_iopark (bool hibernate) {
|
STATIC void pyb_sleep_iopark (bool hibernate) {
|
||||||
mp_map_t *named_map = mp_obj_dict_get_map((mp_obj_t)&pin_board_pins_locals_dict);
|
const mp_map_t *named_map = &pin_board_pins_locals_dict.map;
|
||||||
for (uint i = 0; i < named_map->used; i++) {
|
for (uint i = 0; i < named_map->used; i++) {
|
||||||
pin_obj_t * pin = (pin_obj_t *)named_map->table[i].value;
|
pin_obj_t * pin = (pin_obj_t *)named_map->table[i].value;
|
||||||
switch (pin->pin_num) {
|
switch (pin->pin_num) {
|
||||||
|
|
Ładowanie…
Reference in New Issue