2017-05-15 13:48:47 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
|
|
|
*
|
|
|
|
* Licensed under TREZOR License
|
|
|
|
* see LICENSE file for details
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "py/runtime.h"
|
2017-08-14 09:05:19 +00:00
|
|
|
#include "py/mphal.h"
|
|
|
|
#include "py/objstr.h"
|
2017-05-15 13:48:47 +00:00
|
|
|
|
|
|
|
#if MICROPY_PY_TREZORIO
|
|
|
|
|
2017-09-27 10:00:35 +00:00
|
|
|
#include "modtrezorio-flash.h"
|
2017-09-07 21:50:57 +00:00
|
|
|
#include "modtrezorio-sbu.h"
|
2017-05-15 13:48:47 +00:00
|
|
|
#include "modtrezorio-sdcard.h"
|
2017-08-14 09:05:19 +00:00
|
|
|
#include "modtrezorio-msg.h"
|
2017-05-15 13:48:47 +00:00
|
|
|
|
2017-06-14 16:47:38 +00:00
|
|
|
STATIC const mp_rom_map_elem_t mp_module_trezorio_globals_table[] = {
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_trezorio) },
|
2017-08-14 09:05:19 +00:00
|
|
|
|
2017-09-27 10:00:35 +00:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_FlashOTP), MP_ROM_PTR(&mod_trezorio_FlashOTP_type) },
|
|
|
|
|
2017-09-07 21:50:57 +00:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_SBU), MP_ROM_PTR(&mod_trezorio_SBU_type) },
|
|
|
|
|
2017-06-14 16:47:38 +00:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_SDCard), MP_ROM_PTR(&mod_trezorio_SDCard_type) },
|
2017-08-14 09:05:19 +00:00
|
|
|
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_USB), MP_ROM_PTR(&mod_trezorio_USB_type) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_HID), MP_ROM_PTR(&mod_trezorio_HID_type) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_VCP), MP_ROM_PTR(&mod_trezorio_VCP_type) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_poll), MP_ROM_PTR(&mod_trezorio_poll_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_TOUCH), MP_OBJ_NEW_SMALL_INT(TOUCH_IFACE) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_TOUCH_START), MP_OBJ_NEW_SMALL_INT((TOUCH_START & 0xFF0000) >> 16) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_TOUCH_MOVE), MP_OBJ_NEW_SMALL_INT((TOUCH_MOVE & 0xFF0000) >> 16) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_TOUCH_END), MP_OBJ_NEW_SMALL_INT((TOUCH_END & 0xFF0000) >> 16) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_POLL_READ), MP_OBJ_NEW_SMALL_INT(POLL_READ) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_POLL_WRITE), MP_OBJ_NEW_SMALL_INT(POLL_WRITE) },
|
2017-05-15 13:48:47 +00:00
|
|
|
};
|
|
|
|
|
2017-06-14 16:47:38 +00:00
|
|
|
STATIC MP_DEFINE_CONST_DICT(mp_module_trezorio_globals, mp_module_trezorio_globals_table);
|
2017-05-15 13:48:47 +00:00
|
|
|
|
2017-06-14 16:47:38 +00:00
|
|
|
const mp_obj_module_t mp_module_trezorio = {
|
2017-05-15 13:48:47 +00:00
|
|
|
.base = { &mp_type_module },
|
2017-06-14 16:47:38 +00:00
|
|
|
.globals = (mp_obj_dict_t*)&mp_module_trezorio_globals,
|
2017-05-15 13:48:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MICROPY_PY_TREZORIO
|