1 #include <stdio.h>
2 #include <string.h>
3 #include <stdlib.h>
4 
5 #include "py/mperrno.h"
6 #include "py/obj.h"
7 #include "py/runtime.h"
8 #include "py/builtin.h"
9 
10 #include "ulog/ulog.h"
11 
12 extern const mp_obj_type_t driver_adc_type;
13 extern const mp_obj_type_t driver_pwm_type;
14 extern const mp_obj_type_t driver_gpio_type;
15 extern const mp_obj_type_t driver_i2c_type;
16 extern const mp_obj_type_t driver_spi_type;
17 extern const mp_obj_type_t driver_uart_type;
18 extern const mp_obj_type_t driver_rtc_type;
19 extern const mp_obj_type_t driver_timer_type;
20 extern const mp_obj_type_t driver_can_type;
21 //extern const mp_obj_type_t driver_dac_type;
22 extern const mp_obj_type_t driver_ir_type;
23 extern const mp_obj_type_t driver_wdt_type;
24 //advanced
25 extern const mp_obj_type_t driver_keypad_type;
26 extern const mp_obj_type_t driver_location_type;
27 extern const mp_obj_type_t driver_und_type;
28 //utils
29 extern const mp_obj_type_t driver_crypto_type;
30 // this is the actual C-structure for our new object
31 
32 STATIC const mp_rom_map_elem_t driver_locals_dict_table[] = {
33     {MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_driver)},
34     {MP_OBJ_NEW_QSTR(MP_QSTR_ADC), MP_ROM_PTR(&driver_adc_type)},
35     {MP_OBJ_NEW_QSTR(MP_QSTR_PWM), MP_ROM_PTR(&driver_pwm_type)},
36     {MP_OBJ_NEW_QSTR(MP_QSTR_GPIO), MP_ROM_PTR(&driver_gpio_type)},
37     {MP_OBJ_NEW_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&driver_i2c_type)},
38     {MP_OBJ_NEW_QSTR(MP_QSTR_UART), MP_ROM_PTR(&driver_uart_type)},
39     {MP_OBJ_NEW_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&driver_spi_type)},
40     {MP_OBJ_NEW_QSTR(MP_QSTR_RTC), MP_ROM_PTR(&driver_rtc_type)},
41     {MP_OBJ_NEW_QSTR(MP_QSTR_TIMER), MP_ROM_PTR(&driver_timer_type)},
42     {MP_OBJ_NEW_QSTR(MP_QSTR_CAN), MP_ROM_PTR(&driver_can_type)},
43     //{MP_OBJ_NEW_QSTR(MP_QSTR_DAC), MP_ROM_PTR(&driver_dac_type)},
44     {MP_OBJ_NEW_QSTR(MP_QSTR_IR), MP_ROM_PTR(&driver_ir_type)},
45     {MP_OBJ_NEW_QSTR(MP_QSTR_WDT), MP_ROM_PTR(&driver_wdt_type)},
46     {MP_OBJ_NEW_QSTR(MP_QSTR_KeyPad), MP_ROM_PTR(&driver_keypad_type)},
47     {MP_OBJ_NEW_QSTR(MP_QSTR_Location), MP_ROM_PTR(&driver_location_type)},
48     {MP_OBJ_NEW_QSTR(MP_QSTR_UND), MP_ROM_PTR(&driver_und_type)},
49     {MP_OBJ_NEW_QSTR(MP_QSTR_Crypto), MP_ROM_PTR(&driver_crypto_type)},
50 };
51 
52 STATIC MP_DEFINE_CONST_DICT(driver_locals_dict, driver_locals_dict_table);
53 
54 const mp_obj_module_t driver_module = {
55     .base = {&mp_type_module},
56     .globals = (mp_obj_dict_t *)&driver_locals_dict,
57 };
58 
59