Test of sub module

This commit is contained in:
ZodiusInfuser 2021-08-19 14:51:37 +01:00
parent 3d34d70722
commit aac8c8d2fc
1 changed files with 23 additions and 12 deletions

View File

@ -59,19 +59,33 @@ typedef struct _mp_obj_float_t {
mp_obj_float_t shunt_resistor = {{&mp_type_float}, 0.015f};
/***** Globals Table *****/
STATIC const mp_map_elem_t plasma2040_globals_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_plasma2040) },
{ MP_ROM_QSTR(MP_QSTR_LED_R), MP_ROM_INT(16) },
{ MP_ROM_QSTR(MP_QSTR_LED_G), MP_ROM_INT(17) },
{ MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_INT(18) },
{ MP_ROM_QSTR(MP_QSTR_BUTTON_A), MP_ROM_INT(12) },
{ MP_ROM_QSTR(MP_QSTR_BUTTON_B), MP_ROM_INT(13) },
{ MP_ROM_QSTR(MP_QSTR_USER_SW), MP_ROM_INT(23) },
{ MP_ROM_QSTR(MP_QSTR_CLK), MP_ROM_INT(14) },
{ MP_ROM_QSTR(MP_QSTR_DAT), MP_ROM_INT(15) },
{ MP_ROM_QSTR(MP_QSTR_SENSE), MP_ROM_INT(29) },
{ MP_ROM_QSTR(MP_QSTR_SHUNT_RESISTOR), MP_ROM_PTR(&shunt_resistor) },
{ MP_ROM_QSTR(MP_QSTR_ADC_GAIN), MP_ROM_INT(50) },
};
STATIC MP_DEFINE_CONST_DICT(mp_module_plasma2040_globals, plasma2040_globals_table);
const mp_obj_module_t plasma2040_user_cmodule = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&mp_module_plasma2040_globals,
};
STATIC const mp_map_elem_t plasma_globals_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_plasma) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_APA102), (mp_obj_t)&PlasmaAPA102_type },
{ MP_OBJ_NEW_QSTR(MP_QSTR_WS2812), (mp_obj_t)&PlasmaWS2812_type },
{ MP_ROM_QSTR(MP_QSTR_PIN_LED_R), MP_ROM_INT(16) },
{ MP_ROM_QSTR(MP_QSTR_PIN_LED_G), MP_ROM_INT(17) },
{ MP_ROM_QSTR(MP_QSTR_PIN_LED_B), MP_ROM_INT(18) },
{ MP_ROM_QSTR(MP_QSTR_PIN_BUTTON_A), MP_ROM_INT(12) },
{ MP_ROM_QSTR(MP_QSTR_PIN_BUTTON_B), MP_ROM_INT(13) },
{ MP_ROM_QSTR(MP_QSTR_PIN_USER_SW), MP_ROM_INT(23) },
{ MP_ROM_QSTR(MP_QSTR_PIN_CLK), MP_ROM_INT(14) },
{ MP_ROM_QSTR(MP_QSTR_PIN_DAT), MP_ROM_INT(15) },
{ MP_ROM_QSTR(MP_QSTR_PIN_CURRENT_SENSE), MP_ROM_INT(29) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_plasma2040), (mp_obj_t)&plasma2040_user_cmodule },
{ MP_ROM_QSTR(MP_QSTR_COLOR_ORDER_RGB), MP_ROM_INT(0x00) },
{ MP_ROM_QSTR(MP_QSTR_COLOR_ORDER_RBG), MP_ROM_INT(0x01) },
@ -79,9 +93,6 @@ STATIC const mp_map_elem_t plasma_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_COLOR_ORDER_GBR), MP_ROM_INT(0x03) },
{ MP_ROM_QSTR(MP_QSTR_COLOR_ORDER_BRG), MP_ROM_INT(0x04) },
{ MP_ROM_QSTR(MP_QSTR_COLOR_ORDER_BGR), MP_ROM_INT(0x05) },
{ MP_ROM_QSTR(MP_QSTR_SHUNT_RESISTOR), MP_ROM_PTR(&shunt_resistor) },
{ MP_ROM_QSTR(MP_QSTR_ADC_GAIN), MP_ROM_INT(50) },
};
STATIC MP_DEFINE_CONST_DICT(mp_module_plasma_globals, plasma_globals_table);