2021-04-22 22:03:10 +00:00
|
|
|
#include "breakout_as7262.h"
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// BreakoutAS7262 Class
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/***** Methods *****/
|
|
|
|
MP_DEFINE_CONST_FUN_OBJ_1(BreakoutAS7262_reset_obj, BreakoutAS7262_reset);
|
2021-05-10 16:22:36 +00:00
|
|
|
MP_DEFINE_CONST_FUN_OBJ_1(BreakoutAS7262_device_type_obj, BreakoutAS7262_device_type);
|
|
|
|
MP_DEFINE_CONST_FUN_OBJ_1(BreakoutAS7262_hardware_version_obj, BreakoutAS7262_hardware_version);
|
2021-04-22 22:03:10 +00:00
|
|
|
MP_DEFINE_CONST_FUN_OBJ_1(BreakoutAS7262_firmware_version_obj, BreakoutAS7262_firmware_version);
|
|
|
|
MP_DEFINE_CONST_FUN_OBJ_1(BreakoutAS7262_read_obj, BreakoutAS7262_read);
|
|
|
|
MP_DEFINE_CONST_FUN_OBJ_1(BreakoutAS7262_temperature_obj, BreakoutAS7262_temperature);
|
|
|
|
MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutAS7262_set_gain_obj, 1, BreakoutAS7262_set_gain);
|
|
|
|
MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutAS7262_set_measurement_mode_obj, 1, BreakoutAS7262_set_measurement_mode);
|
|
|
|
MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutAS7262_set_indicator_current_obj, 1, BreakoutAS7262_set_indicator_current);
|
|
|
|
MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutAS7262_set_illumination_current_obj, 1, BreakoutAS7262_set_illumination_current);
|
2021-05-12 14:00:14 +00:00
|
|
|
MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutAS7262_set_integration_time_obj, 1, BreakoutAS7262_set_integration_time);
|
2021-04-22 22:03:10 +00:00
|
|
|
MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutAS7262_set_leds_obj, 1, BreakoutAS7262_set_leds);
|
|
|
|
|
|
|
|
/***** Binding of Methods *****/
|
|
|
|
STATIC const mp_rom_map_elem_t BreakoutAS7262_locals_dict_table[] = {
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&BreakoutAS7262_reset_obj) },
|
2021-05-10 16:22:36 +00:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_device_type), MP_ROM_PTR(&BreakoutAS7262_device_type_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_hardware_version), MP_ROM_PTR(&BreakoutAS7262_hardware_version_obj) },
|
2021-04-22 22:03:10 +00:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_firmware_version), MP_ROM_PTR(&BreakoutAS7262_firmware_version_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&BreakoutAS7262_read_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_temperature), MP_ROM_PTR(&BreakoutAS7262_temperature_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_set_gain), MP_ROM_PTR(&BreakoutAS7262_set_gain_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_set_measurement_mode), MP_ROM_PTR(&BreakoutAS7262_set_measurement_mode_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_set_indicator_current), MP_ROM_PTR(&BreakoutAS7262_set_indicator_current_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_set_illumination_current), MP_ROM_PTR(&BreakoutAS7262_set_illumination_current_obj) },
|
2021-05-12 14:00:14 +00:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_set_integration_time), MP_ROM_PTR(&BreakoutAS7262_set_integration_time_obj) },
|
2021-04-22 22:03:10 +00:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_set_leds), MP_ROM_PTR(&BreakoutAS7262_set_leds_obj) },
|
2021-05-10 16:22:36 +00:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_X1), MP_ROM_INT(MP_X1) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_X3_7), MP_ROM_INT(MP_X3_7) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_X16), MP_ROM_INT(MP_X16) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_X64), MP_ROM_INT(MP_X64) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_MA12), MP_ROM_INT(MP_MA12) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_MA25), MP_ROM_INT(MP_MA25) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_MA50), MP_ROM_INT(MP_MA50) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_MA100), MP_ROM_INT(MP_MA100) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_MA1), MP_ROM_INT(MP_MA1) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_MA2), MP_ROM_INT(MP_MA2) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_MA4), MP_ROM_INT(MP_MA4) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_MA8), MP_ROM_INT(MP_MA8) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_CONT_YGNV), MP_ROM_INT(MP_CONT_YGNV) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_CONT_ROYG), MP_ROM_INT(MP_CONT_ROYG) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_CONT_ROYGBR), MP_ROM_INT(MP_CONT_ROYGBR) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_ONESHOT), MP_ROM_INT(MP_ONESHOT) },
|
2021-04-22 22:03:10 +00:00
|
|
|
};
|
|
|
|
STATIC MP_DEFINE_CONST_DICT(BreakoutAS7262_locals_dict, BreakoutAS7262_locals_dict_table);
|
|
|
|
|
|
|
|
/***** Class Definition *****/
|
|
|
|
const mp_obj_type_t breakout_as7262_BreakoutAS7262_type = {
|
|
|
|
{ &mp_type_type },
|
2021-05-12 14:00:14 +00:00
|
|
|
.name = MP_QSTR_breakout_as7262,
|
2021-04-22 22:03:10 +00:00
|
|
|
.print = BreakoutAS7262_print,
|
|
|
|
.make_new = BreakoutAS7262_make_new,
|
|
|
|
.locals_dict = (mp_obj_dict_t*)&BreakoutAS7262_locals_dict,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// breakout_as7262 Module
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/***** Globals Table *****/
|
|
|
|
STATIC const mp_map_elem_t breakout_as7262_globals_table[] = {
|
2021-05-10 16:22:36 +00:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_breakout_as7262) },
|
2021-04-22 22:03:10 +00:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_BreakoutAS7262), (mp_obj_t)&breakout_as7262_BreakoutAS7262_type },
|
|
|
|
};
|
|
|
|
STATIC MP_DEFINE_CONST_DICT(mp_module_breakout_as7262_globals, breakout_as7262_globals_table);
|
|
|
|
|
|
|
|
/***** Module Definition *****/
|
|
|
|
const mp_obj_module_t breakout_as7262_user_cmodule = {
|
|
|
|
.base = { &mp_type_module },
|
|
|
|
.globals = (mp_obj_dict_t*)&mp_module_breakout_as7262_globals,
|
|
|
|
};
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
MP_REGISTER_MODULE(MP_QSTR_breakout_as7262, breakout_as7262_user_cmodule, MODULE_BREAKOUT_AS7262_ENABLED);
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|