You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@PracticalMetal We want add a __name__ attribute and assign it a q-string value of 'board', since that's the name of the module. So that, at the serial terminal, instead of getting a blank name for the module:
>>>importboard>>>board<module''>
we would get 'board' instead:
>>>importboard>>>board# the next line prints 'board' instead of a blank string<module'board'>
Inside the pins.c file for each board (ports/**/boards/**/pins.c), we would need to change the board_global_dict_table (sometimes named board_module_globals_table) to add the following line:
STATICconstmp_rom_map_elem_tboard_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_board) }, // this line needs to be added to each file// ...
provided that you have access to a terminal, you can use a utility likesed to do an in-place substitution, where we insert the line above in the first line of the board_global_dict_table definition:
You could also do the same for files that use board_module_globals_table instead of board_global_dict_table. Then it should be a matter of making sure that sed put the correct lines in.
@capellini noticed that (most?) boards don't have
__name__
in the board module: #5183 (comment)It would be good to see this added, just for consistency's sake.
The text was updated successfully, but these errors were encountered: