Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
tools-mirror
Micropython
提交
09866754
M
Micropython
项目概览
tools-mirror
/
Micropython
12 个月 前同步成功
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
Micropython
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
09866754
编写于
5月 06, 2017
作者:
D
Damien George
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
stmhal: Convert all module and method tables to use MP_ROM macros.
上级
084824f8
变更
30
隐藏空白更改
内联
并排
Showing
30 changed file
with
444 addition
and
444 deletion
+444
-444
stmhal/accel.c
stmhal/accel.c
+9
-9
stmhal/adc.c
stmhal/adc.c
+11
-11
stmhal/boards/make-pins.py
stmhal/boards/make-pins.py
+2
-2
stmhal/can.c
stmhal/can.c
+18
-18
stmhal/dac.c
stmhal/dac.c
+10
-10
stmhal/extint.c
stmhal/extint.c
+13
-13
stmhal/i2c.c
stmhal/i2c.c
+12
-12
stmhal/lcd.c
stmhal/lcd.c
+11
-11
stmhal/led.c
stmhal/led.c
+6
-6
stmhal/make-stmconst.py
stmhal/make-stmconst.py
+3
-3
stmhal/modmachine.c
stmhal/modmachine.c
+42
-42
stmhal/modnetwork.c
stmhal/modnetwork.c
+5
-5
stmhal/modnwcc3k.c
stmhal/modnwcc3k.c
+11
-11
stmhal/modnwwiznet5k.c
stmhal/modnwwiznet5k.c
+4
-4
stmhal/modpyb.c
stmhal/modpyb.c
+54
-54
stmhal/modstm.c
stmhal/modstm.c
+5
-5
stmhal/moduos.c
stmhal/moduos.c
+20
-20
stmhal/modusocket.c
stmhal/modusocket.c
+31
-31
stmhal/pin.c
stmhal/pin.c
+38
-38
stmhal/pybstdio.c
stmhal/pybstdio.c
+12
-12
stmhal/rtc.c
stmhal/rtc.c
+7
-7
stmhal/sdcard.c
stmhal/sdcard.c
+10
-10
stmhal/servo.c
stmhal/servo.c
+6
-6
stmhal/spi.c
stmhal/spi.c
+21
-21
stmhal/storage.c
stmhal/storage.c
+5
-5
stmhal/timer.c
stmhal/timer.c
+38
-38
stmhal/uart.c
stmhal/uart.c
+14
-14
stmhal/usb.c
stmhal/usb.c
+20
-20
stmhal/usrsw.c
stmhal/usrsw.c
+3
-3
stmhal/wdt.c
stmhal/wdt.c
+3
-3
未找到文件。
stmhal/accel.c
浏览文件 @
09866754
...
...
@@ -211,15 +211,15 @@ STATIC mp_obj_t pyb_accel_write(mp_obj_t self_in, mp_obj_t reg, mp_obj_t val) {
}
MP_DEFINE_CONST_FUN_OBJ_3
(
pyb_accel_write_obj
,
pyb_accel_write
);
STATIC
const
mp_map_elem_t
pyb_accel_locals_dict_table
[]
=
{
STATIC
const
mp_
rom_
map_elem_t
pyb_accel_locals_dict_table
[]
=
{
// TODO add init, deinit, and perhaps reset methods
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_x
),
(
mp_obj_t
)
&
pyb_accel_x_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_y
),
(
mp_obj_t
)
&
pyb_accel_y_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_z
),
(
mp_obj_t
)
&
pyb_accel_z_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_tilt
),
(
mp_obj_t
)
&
pyb_accel_tilt_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_filtered_xyz
),
(
mp_obj_t
)
&
pyb_accel_filtered_xyz_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_read
),
(
mp_obj_t
)
&
pyb_accel_read_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_write
),
(
mp_obj_t
)
&
pyb_accel_write_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_x
),
MP_ROM_PTR
(
&
pyb_accel_x_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_y
),
MP_ROM_PTR
(
&
pyb_accel_y_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_z
),
MP_ROM_PTR
(
&
pyb_accel_z_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_tilt
),
MP_ROM_PTR
(
&
pyb_accel_tilt_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_filtered_xyz
),
MP_ROM_PTR
(
&
pyb_accel_filtered_xyz_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_read
),
MP_ROM_PTR
(
&
pyb_accel_read_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_write
),
MP_ROM_PTR
(
&
pyb_accel_write_obj
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
pyb_accel_locals_dict
,
pyb_accel_locals_dict_table
);
...
...
@@ -228,7 +228,7 @@ const mp_obj_type_t pyb_accel_type = {
{
&
mp_type_type
},
.
name
=
MP_QSTR_Accel
,
.
make_new
=
pyb_accel_make_new
,
.
locals_dict
=
(
mp_obj_
t
)
&
pyb_accel_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
pyb_accel_locals_dict
,
};
#endif // MICROPY_HW_HAS_MMA7660
stmhal/adc.c
浏览文件 @
09866754
...
...
@@ -439,9 +439,9 @@ STATIC mp_obj_t adc_read_timed(mp_obj_t self_in, mp_obj_t buf_in, mp_obj_t freq_
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_3
(
adc_read_timed_obj
,
adc_read_timed
);
STATIC
const
mp_map_elem_t
adc_locals_dict_table
[]
=
{
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_read
),
(
mp_obj_t
)
&
adc_read_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_read_timed
),
(
mp_obj_t
)
&
adc_read_timed_obj
},
STATIC
const
mp_
rom_
map_elem_t
adc_locals_dict_table
[]
=
{
{
MP_
ROM_QSTR
(
MP_QSTR_read
),
MP_ROM_PTR
(
&
adc_read_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_read_timed
),
MP_ROM_PTR
(
&
adc_read_timed_obj
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
adc_locals_dict
,
adc_locals_dict_table
);
...
...
@@ -451,7 +451,7 @@ const mp_obj_type_t pyb_adc_type = {
.
name
=
MP_QSTR_ADC
,
.
print
=
adc_print
,
.
make_new
=
adc_make_new
,
.
locals_dict
=
(
mp_obj_
t
)
&
adc_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
adc_locals_dict
,
};
/******************************************************************************/
...
...
@@ -658,13 +658,13 @@ STATIC mp_obj_t adc_all_read_vref(mp_obj_t self_in) {
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
adc_all_read_vref_obj
,
adc_all_read_vref
);
#endif
STATIC
const
mp_map_elem_t
adc_all_locals_dict_table
[]
=
{
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_read_channel
),
(
mp_obj_t
)
&
adc_all_read_channel_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_read_core_temp
),
(
mp_obj_t
)
&
adc_all_read_core_temp_obj
},
STATIC
const
mp_
rom_
map_elem_t
adc_all_locals_dict_table
[]
=
{
{
MP_
ROM_QSTR
(
MP_QSTR_read_channel
),
MP_ROM_PTR
(
&
adc_all_read_channel_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_read_core_temp
),
MP_ROM_PTR
(
&
adc_all_read_core_temp_obj
)
},
#if MICROPY_PY_BUILTINS_FLOAT
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_read_core_vbat
),
(
mp_obj_t
)
&
adc_all_read_core_vbat_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_read_core_vref
),
(
mp_obj_t
)
&
adc_all_read_core_vref_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_read_vref
),
(
mp_obj_t
)
&
adc_all_read_vref_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_read_core_vbat
),
MP_ROM_PTR
(
&
adc_all_read_core_vbat_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_read_core_vref
),
MP_ROM_PTR
(
&
adc_all_read_core_vref_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_read_vref
),
MP_ROM_PTR
(
&
adc_all_read_vref_obj
)
},
#endif
};
...
...
@@ -674,5 +674,5 @@ const mp_obj_type_t pyb_adc_all_type = {
{
&
mp_type_type
},
.
name
=
MP_QSTR_ADCAll
,
.
make_new
=
adc_all_make_new
,
.
locals_dict
=
(
mp_obj_
t
)
&
adc_all_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
adc_all_locals_dict
,
};
stmhal/boards/make-pins.py
浏览文件 @
09866754
...
...
@@ -283,11 +283,11 @@ class Pins(object):
self
.
board_pins
.
append
(
NamedPin
(
row
[
0
],
pin
))
def
print_named
(
self
,
label
,
named_pins
):
print
(
'STATIC const mp_map_elem_t pin_{:s}_pins_locals_dict_table[] = {{'
.
format
(
label
))
print
(
'STATIC const mp_
rom_
map_elem_t pin_{:s}_pins_locals_dict_table[] = {{'
.
format
(
label
))
for
named_pin
in
named_pins
:
pin
=
named_pin
.
pin
()
if
pin
.
is_board_pin
():
print
(
' {{ MP_
OBJ_NEW_QSTR(MP_QSTR_{:s}), (mp_obj_t)&pin_{:s}
}},'
.
format
(
named_pin
.
name
(),
pin
.
cpu_pin_name
()))
print
(
' {{ MP_
ROM_QSTR(MP_QSTR_{:s}), MP_ROM_PTR(&pin_{:s})
}},'
.
format
(
named_pin
.
name
(),
pin
.
cpu_pin_name
()))
print
(
'};'
)
print
(
'MP_DEFINE_CONST_DICT(pin_{:s}_pins_locals_dict, pin_{:s}_pins_locals_dict_table);'
.
format
(
label
,
label
));
...
...
stmhal/can.c
浏览文件 @
09866754
...
...
@@ -777,29 +777,29 @@ STATIC mp_obj_t pyb_can_rxcallback(mp_obj_t self_in, mp_obj_t fifo_in, mp_obj_t
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_3
(
pyb_can_rxcallback_obj
,
pyb_can_rxcallback
);
STATIC
const
mp_map_elem_t
pyb_can_locals_dict_table
[]
=
{
STATIC
const
mp_
rom_
map_elem_t
pyb_can_locals_dict_table
[]
=
{
// instance methods
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_init
),
(
mp_obj_t
)
&
pyb_can_init_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_deinit
),
(
mp_obj_t
)
&
pyb_can_deinit_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_any
),
(
mp_obj_t
)
&
pyb_can_any_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_send
),
(
mp_obj_t
)
&
pyb_can_send_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_recv
),
(
mp_obj_t
)
&
pyb_can_recv_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_initfilterbanks
),
(
mp_obj_t
)
&
pyb_can_initfilterbanks_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_setfilter
),
(
mp_obj_t
)
&
pyb_can_setfilter_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_clearfilter
),
(
mp_obj_t
)
&
pyb_can_clearfilter_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_rxcallback
),
(
mp_obj_t
)
&
pyb_can_rxcallback_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_init
),
MP_ROM_PTR
(
&
pyb_can_init_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_deinit
),
MP_ROM_PTR
(
&
pyb_can_deinit_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_any
),
MP_ROM_PTR
(
&
pyb_can_any_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_send
),
MP_ROM_PTR
(
&
pyb_can_send_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_recv
),
MP_ROM_PTR
(
&
pyb_can_recv_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_initfilterbanks
),
MP_ROM_PTR
(
&
pyb_can_initfilterbanks_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_setfilter
),
MP_ROM_PTR
(
&
pyb_can_setfilter_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_clearfilter
),
MP_ROM_PTR
(
&
pyb_can_clearfilter_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_rxcallback
),
MP_ROM_PTR
(
&
pyb_can_rxcallback_obj
)
},
// class constants
// Note: we use the ST constants >> 4 so they fit in a small-int. The
// right-shift is undone when the constants are used in the init function.
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_NORMAL
),
MP_OBJ_NEW_SMALL
_INT
(
CAN_MODE_NORMAL
>>
4
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_LOOPBACK
),
MP_OBJ_NEW_SMALL
_INT
(
CAN_MODE_LOOPBACK
>>
4
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_SILENT
),
MP_OBJ_NEW_SMALL
_INT
(
CAN_MODE_SILENT
>>
4
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_SILENT_LOOPBACK
),
MP_OBJ_NEW_SMALL
_INT
(
CAN_MODE_SILENT_LOOPBACK
>>
4
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_MASK16
),
MP_OBJ_NEW_SMALL
_INT
(
MASK16
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_LIST16
),
MP_OBJ_NEW_SMALL
_INT
(
LIST16
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_MASK32
),
MP_OBJ_NEW_SMALL
_INT
(
MASK32
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_LIST32
),
MP_OBJ_NEW_SMALL
_INT
(
LIST32
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_NORMAL
),
MP_ROM
_INT
(
CAN_MODE_NORMAL
>>
4
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_LOOPBACK
),
MP_ROM
_INT
(
CAN_MODE_LOOPBACK
>>
4
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_SILENT
),
MP_ROM
_INT
(
CAN_MODE_SILENT
>>
4
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_SILENT_LOOPBACK
),
MP_ROM
_INT
(
CAN_MODE_SILENT_LOOPBACK
>>
4
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_MASK16
),
MP_ROM
_INT
(
MASK16
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_LIST16
),
MP_ROM
_INT
(
LIST16
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_MASK32
),
MP_ROM
_INT
(
MASK32
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_LIST32
),
MP_ROM
_INT
(
LIST32
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
pyb_can_locals_dict
,
pyb_can_locals_dict_table
);
...
...
stmhal/dac.c
浏览文件 @
09866754
...
...
@@ -481,20 +481,20 @@ mp_obj_t pyb_dac_write_timed(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_
STATIC
MP_DEFINE_CONST_FUN_OBJ_KW
(
pyb_dac_write_timed_obj
,
1
,
pyb_dac_write_timed
);
#endif
STATIC
const
mp_map_elem_t
pyb_dac_locals_dict_table
[]
=
{
STATIC
const
mp_
rom_
map_elem_t
pyb_dac_locals_dict_table
[]
=
{
// instance methods
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_init
),
(
mp_obj_t
)
&
pyb_dac_init_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_deinit
),
(
mp_obj_t
)
&
pyb_dac_deinit_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_write
),
(
mp_obj_t
)
&
pyb_dac_write_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_init
),
MP_ROM_PTR
(
&
pyb_dac_init_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_deinit
),
MP_ROM_PTR
(
&
pyb_dac_deinit_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_write
),
MP_ROM_PTR
(
&
pyb_dac_write_obj
)
},
#if defined(TIM6)
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_noise
),
(
mp_obj_t
)
&
pyb_dac_noise_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_triangle
),
(
mp_obj_t
)
&
pyb_dac_triangle_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_write_timed
),
(
mp_obj_t
)
&
pyb_dac_write_timed_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_noise
),
MP_ROM_PTR
(
&
pyb_dac_noise_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_triangle
),
MP_ROM_PTR
(
&
pyb_dac_triangle_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_write_timed
),
MP_ROM_PTR
(
&
pyb_dac_write_timed_obj
)
},
#endif
// class constants
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_NORMAL
),
MP_OBJ_NEW_SMALL
_INT
(
DMA_NORMAL
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_CIRCULAR
),
MP_OBJ_NEW_SMALL
_INT
(
DMA_CIRCULAR
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_NORMAL
),
MP_ROM
_INT
(
DMA_NORMAL
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_CIRCULAR
),
MP_ROM
_INT
(
DMA_CIRCULAR
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
pyb_dac_locals_dict
,
pyb_dac_locals_dict_table
);
...
...
@@ -503,7 +503,7 @@ const mp_obj_type_t pyb_dac_type = {
{
&
mp_type_type
},
.
name
=
MP_QSTR_DAC
,
.
make_new
=
pyb_dac_make_new
,
.
locals_dict
=
(
mp_obj_
t
)
&
pyb_dac_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
pyb_dac_locals_dict
,
};
#endif // MICROPY_HW_ENABLE_DAC
stmhal/extint.c
浏览文件 @
09866754
...
...
@@ -368,23 +368,23 @@ STATIC void extint_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print
mp_printf
(
print
,
"<ExtInt line=%u>"
,
self
->
line
);
}
STATIC
const
mp_map_elem_t
extint_locals_dict_table
[]
=
{
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_line
),
(
mp_obj_t
)
&
extint_obj_line_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_enable
),
(
mp_obj_t
)
&
extint_obj_enable_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_disable
),
(
mp_obj_t
)
&
extint_obj_disable_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_swint
),
(
mp_obj_t
)
&
extint_obj_swint_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_regs
),
(
mp_obj_t
)
&
extint_regs_obj
},
STATIC
const
mp_
rom_
map_elem_t
extint_locals_dict_table
[]
=
{
{
MP_
ROM_QSTR
(
MP_QSTR_line
),
MP_ROM_PTR
(
&
extint_obj_line_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_enable
),
MP_ROM_PTR
(
&
extint_obj_enable_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_disable
),
MP_ROM_PTR
(
&
extint_obj_disable_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_swint
),
MP_ROM_PTR
(
&
extint_obj_swint_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_regs
),
MP_ROM_PTR
(
&
extint_regs_obj
)
},
// class constants
/// \constant IRQ_RISING - interrupt on a rising edge
/// \constant IRQ_FALLING - interrupt on a falling edge
/// \constant IRQ_RISING_FALLING - interrupt on a rising or falling edge
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_IRQ_RISING
),
MP_OBJ_NEW_SMALL
_INT
(
GPIO_MODE_IT_RISING
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_IRQ_FALLING
),
MP_OBJ_NEW_SMALL
_INT
(
GPIO_MODE_IT_FALLING
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_IRQ_RISING_FALLING
),
MP_OBJ_NEW_SMALL
_INT
(
GPIO_MODE_IT_RISING_FALLING
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_EVT_RISING
),
MP_OBJ_NEW_SMALL
_INT
(
GPIO_MODE_EVT_RISING
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_EVT_FALLING
),
MP_OBJ_NEW_SMALL
_INT
(
GPIO_MODE_EVT_FALLING
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_EVT_RISING_FALLING
),
MP_OBJ_NEW_SMALL
_INT
(
GPIO_MODE_EVT_RISING_FALLING
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_IRQ_RISING
),
MP_ROM
_INT
(
GPIO_MODE_IT_RISING
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_IRQ_FALLING
),
MP_ROM
_INT
(
GPIO_MODE_IT_FALLING
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_IRQ_RISING_FALLING
),
MP_ROM
_INT
(
GPIO_MODE_IT_RISING_FALLING
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_EVT_RISING
),
MP_ROM
_INT
(
GPIO_MODE_EVT_RISING
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_EVT_FALLING
),
MP_ROM
_INT
(
GPIO_MODE_EVT_FALLING
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_EVT_RISING_FALLING
),
MP_ROM
_INT
(
GPIO_MODE_EVT_RISING_FALLING
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
extint_locals_dict
,
extint_locals_dict_table
);
...
...
@@ -394,7 +394,7 @@ const mp_obj_type_t extint_type = {
.
name
=
MP_QSTR_ExtInt
,
.
print
=
extint_obj_print
,
.
make_new
=
extint_make_new
,
.
locals_dict
=
(
mp_obj_
t
)
&
extint_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
extint_locals_dict
,
};
void
extint_init0
(
void
)
{
...
...
stmhal/i2c.c
浏览文件 @
09866754
...
...
@@ -1010,22 +1010,22 @@ STATIC mp_obj_t pyb_i2c_mem_write(mp_uint_t n_args, const mp_obj_t *pos_args, mp
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_KW
(
pyb_i2c_mem_write_obj
,
1
,
pyb_i2c_mem_write
);
STATIC
const
mp_map_elem_t
pyb_i2c_locals_dict_table
[]
=
{
STATIC
const
mp_
rom_
map_elem_t
pyb_i2c_locals_dict_table
[]
=
{
// instance methods
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_init
),
(
mp_obj_t
)
&
pyb_i2c_init_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_deinit
),
(
mp_obj_t
)
&
pyb_i2c_deinit_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_is_ready
),
(
mp_obj_t
)
&
pyb_i2c_is_ready_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_scan
),
(
mp_obj_t
)
&
pyb_i2c_scan_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_send
),
(
mp_obj_t
)
&
pyb_i2c_send_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_recv
),
(
mp_obj_t
)
&
pyb_i2c_recv_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_mem_read
),
(
mp_obj_t
)
&
pyb_i2c_mem_read_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_mem_write
),
(
mp_obj_t
)
&
pyb_i2c_mem_write_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_init
),
MP_ROM_PTR
(
&
pyb_i2c_init_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_deinit
),
MP_ROM_PTR
(
&
pyb_i2c_deinit_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_is_ready
),
MP_ROM_PTR
(
&
pyb_i2c_is_ready_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_scan
),
MP_ROM_PTR
(
&
pyb_i2c_scan_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_send
),
MP_ROM_PTR
(
&
pyb_i2c_send_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_recv
),
MP_ROM_PTR
(
&
pyb_i2c_recv_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_mem_read
),
MP_ROM_PTR
(
&
pyb_i2c_mem_read_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_mem_write
),
MP_ROM_PTR
(
&
pyb_i2c_mem_write_obj
)
},
// class constants
/// \constant MASTER - for initialising the bus to master mode
/// \constant SLAVE - for initialising the bus to slave mode
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_MASTER
),
MP_OBJ_NEW_SMALL
_INT
(
PYB_I2C_MASTER
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_SLAVE
),
MP_OBJ_NEW_SMALL
_INT
(
PYB_I2C_SLAVE
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_MASTER
),
MP_ROM
_INT
(
PYB_I2C_MASTER
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_SLAVE
),
MP_ROM
_INT
(
PYB_I2C_SLAVE
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
pyb_i2c_locals_dict
,
pyb_i2c_locals_dict_table
);
...
...
@@ -1035,5 +1035,5 @@ const mp_obj_type_t pyb_i2c_type = {
.
name
=
MP_QSTR_I2C
,
.
print
=
pyb_i2c_print
,
.
make_new
=
pyb_i2c_make_new
,
.
locals_dict
=
(
mp_obj_
t
)
&
pyb_i2c_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
pyb_i2c_locals_dict
,
};
stmhal/lcd.c
浏览文件 @
09866754
...
...
@@ -504,17 +504,17 @@ STATIC mp_obj_t pyb_lcd_show(mp_obj_t self_in) {
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
pyb_lcd_show_obj
,
pyb_lcd_show
);
STATIC
const
mp_map_elem_t
pyb_lcd_locals_dict_table
[]
=
{
STATIC
const
mp_
rom_
map_elem_t
pyb_lcd_locals_dict_table
[]
=
{
// instance methods
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_command
),
(
mp_obj_t
)
&
pyb_lcd_command_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_contrast
),
(
mp_obj_t
)
&
pyb_lcd_contrast_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_light
),
(
mp_obj_t
)
&
pyb_lcd_light_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_write
),
(
mp_obj_t
)
&
pyb_lcd_write_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_fill
),
(
mp_obj_t
)
&
pyb_lcd_fill_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_get
),
(
mp_obj_t
)
&
pyb_lcd_get_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_pixel
),
(
mp_obj_t
)
&
pyb_lcd_pixel_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_text
),
(
mp_obj_t
)
&
pyb_lcd_text_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_show
),
(
mp_obj_t
)
&
pyb_lcd_show_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_command
),
MP_ROM_PTR
(
&
pyb_lcd_command_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_contrast
),
MP_ROM_PTR
(
&
pyb_lcd_contrast_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_light
),
MP_ROM_PTR
(
&
pyb_lcd_light_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_write
),
MP_ROM_PTR
(
&
pyb_lcd_write_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_fill
),
MP_ROM_PTR
(
&
pyb_lcd_fill_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_get
),
MP_ROM_PTR
(
&
pyb_lcd_get_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_pixel
),
MP_ROM_PTR
(
&
pyb_lcd_pixel_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_text
),
MP_ROM_PTR
(
&
pyb_lcd_text_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_show
),
MP_ROM_PTR
(
&
pyb_lcd_show_obj
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
pyb_lcd_locals_dict
,
pyb_lcd_locals_dict_table
);
...
...
@@ -523,7 +523,7 @@ const mp_obj_type_t pyb_lcd_type = {
{
&
mp_type_type
},
.
name
=
MP_QSTR_LCD
,
.
make_new
=
pyb_lcd_make_new
,
.
locals_dict
=
(
mp_obj_
t
)
&
pyb_lcd_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
pyb_lcd_locals_dict
,
};
#endif // MICROPY_HW_HAS_LCD
stmhal/led.c
浏览文件 @
09866754
...
...
@@ -349,11 +349,11 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(led_obj_off_obj, led_obj_off);
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
led_obj_toggle_obj
,
led_obj_toggle
);
STATIC
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
led_obj_intensity_obj
,
1
,
2
,
led_obj_intensity
);
STATIC
const
mp_map_elem_t
led_locals_dict_table
[]
=
{
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_on
),
(
mp_obj_t
)
&
led_obj_on_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_off
),
(
mp_obj_t
)
&
led_obj_off_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_toggle
),
(
mp_obj_t
)
&
led_obj_toggle_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_intensity
),
(
mp_obj_t
)
&
led_obj_intensity_obj
},
STATIC
const
mp_
rom_
map_elem_t
led_locals_dict_table
[]
=
{
{
MP_
ROM_QSTR
(
MP_QSTR_on
),
MP_ROM_PTR
(
&
led_obj_on_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_off
),
MP_ROM_PTR
(
&
led_obj_off_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_toggle
),
MP_ROM_PTR
(
&
led_obj_toggle_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_intensity
),
MP_ROM_PTR
(
&
led_obj_intensity_obj
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
led_locals_dict
,
led_locals_dict_table
);
...
...
@@ -363,7 +363,7 @@ const mp_obj_type_t pyb_led_type = {
.
name
=
MP_QSTR_LED
,
.
print
=
led_obj_print
,
.
make_new
=
led_obj_make_new
,
.
locals_dict
=
(
mp_obj_
t
)
&
led_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
led_locals_dict
,
};
#else
...
...
stmhal/make-stmconst.py
浏览文件 @
09866754
...
...
@@ -162,13 +162,13 @@ def print_regs_as_submodules(reg_name, reg_defs, modules, needed_qstrs):
modules
.
append
((
mod_name_lower
,
mod_name_upper
))
print
(
"""
STATIC const mp_map_elem_t stm_%s_globals_table[] = {
{ MP_
OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW
_QSTR(MP_QSTR_%s) },
STATIC const mp_
rom_
map_elem_t stm_%s_globals_table[] = {
{ MP_
ROM_QSTR(MP_QSTR___name__), MP_ROM
_QSTR(MP_QSTR_%s) },
"""
%
(
mod_name_lower
,
mod_name_upper
))
needed_qstrs
.
add
(
mod_name_upper
)
for
r
in
reg_defs
:
print
(
' { MP_
OBJ_NEW_QSTR(MP_QSTR_%s), MP_OBJ_NEW_SMALL
_INT(%#x) }, // %s-bits, %s'
%
(
r
[
0
],
r
[
1
],
r
[
2
],
r
[
3
]))
print
(
' { MP_
ROM_QSTR(MP_QSTR_%s), MP_ROM
_INT(%#x) }, // %s-bits, %s'
%
(
r
[
0
],
r
[
1
],
r
[
2
],
r
[
3
]))
needed_qstrs
.
add
(
r
[
0
])
print
(
"""};
...
...
stmhal/modmachine.c
浏览文件 @
09866754
...
...
@@ -518,66 +518,66 @@ STATIC mp_obj_t machine_reset_cause(void) {
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_0
(
machine_reset_cause_obj
,
machine_reset_cause
);
STATIC
const
mp_map_elem_t
machine_module_globals_table
[]
=
{
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR___name__
),
MP_OBJ_NEW
_QSTR
(
MP_QSTR_umachine
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_info
),
(
mp_obj_t
)
&
machine_info_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_unique_id
),
(
mp_obj_t
)
&
machine_unique_id_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_reset
),
(
mp_obj_t
)
&
machine_reset_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_soft_reset
),
(
mp_obj_t
)
&
machine_soft_reset_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_bootloader
),
(
mp_obj_t
)
&
machine_bootloader_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_freq
),
(
mp_obj_t
)
&
machine_freq_obj
},
STATIC
const
mp_
rom_
map_elem_t
machine_module_globals_table
[]
=
{
{
MP_
ROM_QSTR
(
MP_QSTR___name__
),
MP_ROM
_QSTR
(
MP_QSTR_umachine
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_info
),
MP_ROM_PTR
(
&
machine_info_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_unique_id
),
MP_ROM_PTR
(
&
machine_unique_id_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_reset
),
MP_ROM_PTR
(
&
machine_reset_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_soft_reset
),
MP_ROM_PTR
(
&
machine_soft_reset_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_bootloader
),
MP_ROM_PTR
(
&
machine_bootloader_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_freq
),
MP_ROM_PTR
(
&
machine_freq_obj
)
},
#if MICROPY_HW_ENABLE_RNG
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_rng
),
(
mp_obj_t
)
&
pyb_rng_get_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_rng
),
MP_ROM_PTR
(
&
pyb_rng_get_obj
)
},
#endif
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_idle
),
(
mp_obj_t
)
&
pyb_wfi_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_sleep
),
(
mp_obj_t
)
&
machine_sleep_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_deepsleep
),
(
mp_obj_t
)
&
machine_deepsleep_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_reset_cause
),
(
mp_obj_t
)
&
machine_reset_cause_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_idle
),
MP_ROM_PTR
(
&
pyb_wfi_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_sleep
),
MP_ROM_PTR
(
&
machine_sleep_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_deepsleep
),
MP_ROM_PTR
(
&
machine_deepsleep_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_reset_cause
),
MP_ROM_PTR
(
&
machine_reset_cause_obj
)
},
#if 0
{ MP_
OBJ_NEW_QSTR(MP_QSTR_wake_reason), (mp_obj_t)&machine_wake_reason_obj
},
{ MP_
ROM_QSTR(MP_QSTR_wake_reason), MP_ROM_PTR(&machine_wake_reason_obj)
},
#endif
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_disable_irq
),
(
mp_obj_t
)
&
pyb_disable_irq_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_enable_irq
),
(
mp_obj_t
)
&
pyb_enable_irq_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_disable_irq
),
MP_ROM_PTR
(
&
pyb_disable_irq_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_enable_irq
),
MP_ROM_PTR
(
&
pyb_enable_irq_obj
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_time_pulse_us
),
(
mp_obj_t
)
&
machine_time_pulse_us_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_time_pulse_us
),
MP_ROM_PTR
(
&
machine_time_pulse_us_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_mem8
),
(
mp_obj_t
)
&
machine_mem8_obj
},
{
MP_ROM_QSTR
(
MP_QSTR_mem16
),
(
mp_obj_t
)
&
machine_mem16_obj
},
{
MP_ROM_QSTR
(
MP_QSTR_mem32
),
(
mp_obj_t
)
&
machine_mem32_obj
},
{
MP_ROM_QSTR
(
MP_QSTR_mem8
),
MP_ROM_PTR
(
&
machine_mem8_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_mem16
),
MP_ROM_PTR
(
&
machine_mem16_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_mem32
),
MP_ROM_PTR
(
&
machine_mem32_obj
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_Pin
),
(
mp_obj_t
)
&
pin_type
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_Signal
),
(
mp_obj_t
)
&
machine_signal_type
},
{
MP_
ROM_QSTR
(
MP_QSTR_Pin
),
MP_ROM_PTR
(
&
pin_type
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_Signal
),
MP_ROM_PTR
(
&
machine_signal_type
)
},
#if 0
{ MP_
OBJ_NEW_QSTR(MP_QSTR_RTC), (mp_obj_t)&pyb_rtc_type
},
{ MP_
OBJ_NEW_QSTR(MP_QSTR_ADC), (mp_obj_t)&pyb_adc_type
},
{ MP_
ROM_QSTR(MP_QSTR_RTC), MP_ROM_PTR(&pyb_rtc_type)
},
{ MP_
ROM_QSTR(MP_QSTR_ADC), MP_ROM_PTR(&pyb_adc_type)
},
#endif
// TODO: Per new API, I2C types below, if called with 1 arg (ID), should still
// initialize master mode on the peripheral.
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_I2C
),
(
mp_obj_t
)
&
machine_i2c_type
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_SPI
),
(
mp_obj_t
)
&
machine_hard_spi_type
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_WDT
),
(
mp_obj_t
)
&
pyb_wdt_type
},
{
MP_
ROM_QSTR
(
MP_QSTR_I2C
),
MP_ROM_PTR
(
&
machine_i2c_type
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_SPI
),
MP_ROM_PTR
(
&
machine_hard_spi_type
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_WDT
),
MP_ROM_PTR
(
&
pyb_wdt_type
)
},
#if 0
{ MP_
OBJ_NEW_QSTR(MP_QSTR_UART), (mp_obj_t)&pyb_uart_type
},
{ MP_
OBJ_NEW_QSTR(MP_QSTR_Timer), (mp_obj_t)&pyb_timer_type
},
{ MP_
OBJ_NEW_QSTR(MP_QSTR_HeartBeat), (mp_obj_t)&pyb_heartbeat_type
},
{ MP_
OBJ_NEW_QSTR(MP_QSTR_SD), (mp_obj_t)&pyb_sd_type
},
{ MP_
ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&pyb_uart_type)
},
{ MP_
ROM_QSTR(MP_QSTR_Timer), MP_ROM_PTR(&pyb_timer_type)
},
{ MP_
ROM_QSTR(MP_QSTR_HeartBeat), MP_ROM_PTR(&pyb_heartbeat_type)
},
{ MP_
ROM_QSTR(MP_QSTR_SD), MP_ROM_PTR(&pyb_sd_type)
},
// class constants
{ MP_
OBJ_NEW_QSTR(MP_QSTR_IDLE), MP_OBJ_NEW_SMALL
_INT(PYB_PWR_MODE_ACTIVE) },
{ MP_
OBJ_NEW_QSTR(MP_QSTR_SLEEP), MP_OBJ_NEW_SMALL
_INT(PYB_PWR_MODE_LPDS) },
{ MP_
OBJ_NEW_QSTR(MP_QSTR_DEEPSLEEP), MP_OBJ_NEW_SMALL
_INT(PYB_PWR_MODE_HIBERNATE) },
{ MP_
ROM_QSTR(MP_QSTR_IDLE), MP_ROM
_INT(PYB_PWR_MODE_ACTIVE) },
{ MP_
ROM_QSTR(MP_QSTR_SLEEP), MP_ROM
_INT(PYB_PWR_MODE_LPDS) },
{ MP_
ROM_QSTR(MP_QSTR_DEEPSLEEP), MP_ROM
_INT(PYB_PWR_MODE_HIBERNATE) },
#endif
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_PWRON_RESET
),
MP_OBJ_NEW_SMALL
_INT
(
PYB_RESET_POWER_ON
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_HARD_RESET
),
MP_OBJ_NEW_SMALL
_INT
(
PYB_RESET_HARD
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_WDT_RESET
),
MP_OBJ_NEW_SMALL
_INT
(
PYB_RESET_WDT
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_DEEPSLEEP_RESET
),
MP_OBJ_NEW_SMALL
_INT
(
PYB_RESET_DEEPSLEEP
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_SOFT_RESET
),
MP_OBJ_NEW_SMALL
_INT
(
PYB_RESET_SOFT
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_PWRON_RESET
),
MP_ROM
_INT
(
PYB_RESET_POWER_ON
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_HARD_RESET
),
MP_ROM
_INT
(
PYB_RESET_HARD
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_WDT_RESET
),
MP_ROM
_INT
(
PYB_RESET_WDT
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_DEEPSLEEP_RESET
),
MP_ROM
_INT
(
PYB_RESET_DEEPSLEEP
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_SOFT_RESET
),
MP_ROM
_INT
(
PYB_RESET_SOFT
)
},
#if 0
{ MP_
OBJ_NEW_QSTR(MP_QSTR_WLAN_WAKE), MP_OBJ_NEW_SMALL
_INT(PYB_SLP_WAKED_BY_WLAN) },
{ MP_
OBJ_NEW_QSTR(MP_QSTR_PIN_WAKE), MP_OBJ_NEW_SMALL
_INT(PYB_SLP_WAKED_BY_GPIO) },
{ MP_
OBJ_NEW_QSTR(MP_QSTR_RTC_WAKE), MP_OBJ_NEW_SMALL
_INT(PYB_SLP_WAKED_BY_RTC) },
{ MP_
ROM_QSTR(MP_QSTR_WLAN_WAKE), MP_ROM
_INT(PYB_SLP_WAKED_BY_WLAN) },
{ MP_
ROM_QSTR(MP_QSTR_PIN_WAKE), MP_ROM
_INT(PYB_SLP_WAKED_BY_GPIO) },
{ MP_
ROM_QSTR(MP_QSTR_RTC_WAKE), MP_ROM
_INT(PYB_SLP_WAKED_BY_RTC) },
#endif
};
...
...
stmhal/modnetwork.c
浏览文件 @
09866754
...
...
@@ -71,17 +71,17 @@ STATIC mp_obj_t network_route(void) {
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_0
(
network_route_obj
,
network_route
);
STATIC
const
mp_map_elem_t
mp_module_network_globals_table
[]
=
{
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR___name__
),
MP_OBJ_NEW
_QSTR
(
MP_QSTR_network
)
},
STATIC
const
mp_
rom_
map_elem_t
mp_module_network_globals_table
[]
=
{
{
MP_
ROM_QSTR
(
MP_QSTR___name__
),
MP_ROM
_QSTR
(
MP_QSTR_network
)
},
#if MICROPY_PY_WIZNET5K
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_WIZNET5K
),
(
mp_obj_t
)
&
mod_network_nic_type_wiznet5k
},
{
MP_
ROM_QSTR
(
MP_QSTR_WIZNET5K
),
MP_ROM_PTR
(
&
mod_network_nic_type_wiznet5k
)
},
#endif
#if MICROPY_PY_CC3K
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_CC3K
),
(
mp_obj_t
)
&
mod_network_nic_type_cc3k
},
{
MP_
ROM_QSTR
(
MP_QSTR_CC3K
),
MP_ROM_PTR
(
&
mod_network_nic_type_cc3k
)
},
#endif
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_route
),
(
mp_obj_t
)
&
network_route_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_route
),
MP_ROM_PTR
(
&
network_route_obj
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
mp_module_network_globals
,
mp_module_network_globals_table
);
...
...
stmhal/modnwcc3k.c
浏览文件 @
09866754
...
...
@@ -562,18 +562,18 @@ STATIC mp_obj_t cc3k_patch_program(mp_obj_t self_in, mp_obj_t key_in) {
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_2
(
cc3k_patch_program_obj
,
cc3k_patch_program
);
STATIC
const
mp_map_elem_t
cc3k_locals_dict_table
[]
=
{
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_connect
),
(
mp_obj_t
)
&
cc3k_connect_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_disconnect
),
(
mp_obj_t
)
&
cc3k_disconnect_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_isconnected
),
(
mp_obj_t
)
&
cc3k_isconnected_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_ifconfig
),
(
mp_obj_t
)
&
cc3k_ifconfig_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_patch_version
),
(
mp_obj_t
)
&
cc3k_patch_version_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_patch_program
),
(
mp_obj_t
)
&
cc3k_patch_program_obj
},
STATIC
const
mp_
rom_
map_elem_t
cc3k_locals_dict_table
[]
=
{
{
MP_
ROM_QSTR
(
MP_QSTR_connect
),
MP_ROM_PTR
(
&
cc3k_connect_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_disconnect
),
MP_ROM_PTR
(
&
cc3k_disconnect_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_isconnected
),
MP_ROM_PTR
(
&
cc3k_isconnected_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_ifconfig
),
MP_ROM_PTR
(
&
cc3k_ifconfig_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_patch_version
),
MP_ROM_PTR
(
&
cc3k_patch_version_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_patch_program
),
MP_ROM_PTR
(
&
cc3k_patch_program_obj
)
},
// class constants
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_WEP
),
MP_OBJ_NEW_SMALL
_INT
(
WLAN_SEC_WEP
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_WPA
),
MP_OBJ_NEW_SMALL
_INT
(
WLAN_SEC_WPA
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_WPA2
),
MP_OBJ_NEW_SMALL
_INT
(
WLAN_SEC_WPA2
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_WEP
),
MP_ROM
_INT
(
WLAN_SEC_WEP
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_WPA
),
MP_ROM
_INT
(
WLAN_SEC_WPA
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_WPA2
),
MP_ROM
_INT
(
WLAN_SEC_WPA2
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
cc3k_locals_dict
,
cc3k_locals_dict_table
);
...
...
@@ -583,7 +583,7 @@ const mod_network_nic_type_t mod_network_nic_type_cc3k = {
{
&
mp_type_type
},
.
name
=
MP_QSTR_CC3K
,
.
make_new
=
cc3k_make_new
,
.
locals_dict
=
(
mp_obj_
t
)
&
cc3k_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
cc3k_locals_dict
,
},
.
gethostbyname
=
cc3k_gethostbyname
,
.
socket
=
cc3k_socket_socket
,
...
...
stmhal/modnwwiznet5k.c
浏览文件 @
09866754
...
...
@@ -433,9 +433,9 @@ STATIC mp_obj_t wiznet5k_ifconfig(mp_uint_t n_args, const mp_obj_t *args) {
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
wiznet5k_ifconfig_obj
,
1
,
2
,
wiznet5k_ifconfig
);
STATIC
const
mp_map_elem_t
wiznet5k_locals_dict_table
[]
=
{
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_regs
),
(
mp_obj_t
)
&
wiznet5k_regs_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_ifconfig
),
(
mp_obj_t
)
&
wiznet5k_ifconfig_obj
},
STATIC
const
mp_
rom_
map_elem_t
wiznet5k_locals_dict_table
[]
=
{
{
MP_
ROM_QSTR
(
MP_QSTR_regs
),
MP_ROM_PTR
(
&
wiznet5k_regs_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_ifconfig
),
MP_ROM_PTR
(
&
wiznet5k_ifconfig_obj
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
wiznet5k_locals_dict
,
wiznet5k_locals_dict_table
);
...
...
@@ -445,7 +445,7 @@ const mod_network_nic_type_t mod_network_nic_type_wiznet5k = {
{
&
mp_type_type
},
.
name
=
MP_QSTR_WIZNET5K
,
.
make_new
=
wiznet5k_make_new
,
.
locals_dict
=
(
mp_obj_
t
)
&
wiznet5k_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
wiznet5k_locals_dict
,
},
.
gethostbyname
=
wiznet5k_gethostbyname
,
.
socket
=
wiznet5k_socket_socket
,
...
...
stmhal/modpyb.c
浏览文件 @
09866754
...
...
@@ -108,103 +108,103 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_elapsed_micros_obj, pyb_elapsed_micros);
MP_DECLARE_CONST_FUN_OBJ_KW
(
pyb_main_obj
);
// defined in main.c
STATIC
const
mp_map_elem_t
pyb_module_globals_table
[]
=
{
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR___name__
),
MP_OBJ_NEW
_QSTR
(
MP_QSTR_pyb
)
},
STATIC
const
mp_
rom_
map_elem_t
pyb_module_globals_table
[]
=
{
{
MP_
ROM_QSTR
(
MP_QSTR___name__
),
MP_ROM
_QSTR
(
MP_QSTR_pyb
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_fault_debug
),
(
mp_obj_t
)
&
pyb_fault_debug_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_fault_debug
),
MP_ROM_PTR
(
&
pyb_fault_debug_obj
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_bootloader
),
(
mp_obj_t
)
&
machine_bootloader_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_hard_reset
),
(
mp_obj_t
)
&
machine_reset_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_info
),
(
mp_obj_t
)
&
machine_info_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_unique_id
),
(
mp_obj_t
)
&
machine_unique_id_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_freq
),
(
mp_obj_t
)
&
machine_freq_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_repl_info
),
(
mp_obj_t
)
&
pyb_set_repl_info_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_bootloader
),
MP_ROM_PTR
(
&
machine_bootloader_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_hard_reset
),
MP_ROM_PTR
(
&
machine_reset_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_info
),
MP_ROM_PTR
(
&
machine_info_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_unique_id
),
MP_ROM_PTR
(
&
machine_unique_id_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_freq
),
MP_ROM_PTR
(
&
machine_freq_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_repl_info
),
MP_ROM_PTR
(
&
pyb_set_repl_info_obj
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_wfi
),
(
mp_obj_t
)
&
pyb_wfi_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_disable_irq
),
(
mp_obj_t
)
&
pyb_disable_irq_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_enable_irq
),
(
mp_obj_t
)
&
pyb_enable_irq_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_wfi
),
MP_ROM_PTR
(
&
pyb_wfi_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_disable_irq
),
MP_ROM_PTR
(
&
pyb_disable_irq_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_enable_irq
),
MP_ROM_PTR
(
&
pyb_enable_irq_obj
)
},
#if IRQ_ENABLE_STATS
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_irq_stats
),
(
mp_obj_t
)
&
pyb_irq_stats_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_irq_stats
),
MP_ROM_PTR
(
&
pyb_irq_stats_obj
)
},
#endif
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_stop
),
(
mp_obj_t
)
&
machine_sleep_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_standby
),
(
mp_obj_t
)
&
machine_deepsleep_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_main
),
(
mp_obj_t
)
&
pyb_main_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_repl_uart
),
(
mp_obj_t
)
&
mod_os_dupterm_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_stop
),
MP_ROM_PTR
(
&
machine_sleep_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_standby
),
MP_ROM_PTR
(
&
machine_deepsleep_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_main
),
MP_ROM_PTR
(
&
pyb_main_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_repl_uart
),
MP_ROM_PTR
(
&
mod_os_dupterm_obj
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_usb_mode
),
(
mp_obj_t
)
&
pyb_usb_mode_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_hid_mouse
),
(
mp_obj_t
)
&
pyb_usb_hid_mouse_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_hid_keyboard
),
(
mp_obj_t
)
&
pyb_usb_hid_keyboard_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_USB_VCP
),
(
mp_obj_t
)
&
pyb_usb_vcp_type
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_USB_HID
),
(
mp_obj_t
)
&
pyb_usb_hid_type
},
{
MP_
ROM_QSTR
(
MP_QSTR_usb_mode
),
MP_ROM_PTR
(
&
pyb_usb_mode_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_hid_mouse
),
MP_ROM_PTR
(
&
pyb_usb_hid_mouse_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_hid_keyboard
),
MP_ROM_PTR
(
&
pyb_usb_hid_keyboard_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_USB_VCP
),
MP_ROM_PTR
(
&
pyb_usb_vcp_type
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_USB_HID
),
MP_ROM_PTR
(
&
pyb_usb_hid_type
)
},
// these 2 are deprecated; use USB_VCP.isconnected and USB_HID.send instead
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_have_cdc
),
(
mp_obj_t
)
&
pyb_have_cdc_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_hid
),
(
mp_obj_t
)
&
pyb_hid_send_report_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_have_cdc
),
MP_ROM_PTR
(
&
pyb_have_cdc_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_hid
),
MP_ROM_PTR
(
&
pyb_hid_send_report_obj
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_millis
),
(
mp_obj_t
)
&
mp_utime_ticks_ms_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_elapsed_millis
),
(
mp_obj_t
)
&
pyb_elapsed_millis_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_micros
),
(
mp_obj_t
)
&
mp_utime_ticks_us_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_elapsed_micros
),
(
mp_obj_t
)
&
pyb_elapsed_micros_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_delay
),
(
mp_obj_t
)
&
mp_utime_sleep_ms_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_udelay
),
(
mp_obj_t
)
&
mp_utime_sleep_us_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_sync
),
(
mp_obj_t
)
&
mod_os_sync_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_mount
),
(
mp_obj_t
)
&
mp_vfs_mount_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_millis
),
MP_ROM_PTR
(
&
mp_utime_ticks_ms_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_elapsed_millis
),
MP_ROM_PTR
(
&
pyb_elapsed_millis_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_micros
),
MP_ROM_PTR
(
&
mp_utime_ticks_us_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_elapsed_micros
),
MP_ROM_PTR
(
&
pyb_elapsed_micros_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_delay
),
MP_ROM_PTR
(
&
mp_utime_sleep_ms_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_udelay
),
MP_ROM_PTR
(
&
mp_utime_sleep_us_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_sync
),
MP_ROM_PTR
(
&
mod_os_sync_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_mount
),
MP_ROM_PTR
(
&
mp_vfs_mount_obj
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_Timer
),
(
mp_obj_t
)
&
pyb_timer_type
},
{
MP_
ROM_QSTR
(
MP_QSTR_Timer
),
MP_ROM_PTR
(
&
pyb_timer_type
)
},
#if MICROPY_HW_ENABLE_RNG
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_rng
),
(
mp_obj_t
)
&
pyb_rng_get_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_rng
),
MP_ROM_PTR
(
&
pyb_rng_get_obj
)
},
#endif
#if MICROPY_HW_ENABLE_RTC
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_RTC
),
(
mp_obj_t
)
&
pyb_rtc_type
},
{
MP_
ROM_QSTR
(
MP_QSTR_RTC
),
MP_ROM_PTR
(
&
pyb_rtc_type
)
},
#endif
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_Pin
),
(
mp_obj_t
)
&
pin_type
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_ExtInt
),
(
mp_obj_t
)
&
extint_type
},
{
MP_
ROM_QSTR
(
MP_QSTR_Pin
),
MP_ROM_PTR
(
&
pin_type
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_ExtInt
),
MP_ROM_PTR
(
&
extint_type
)
},
#if MICROPY_HW_ENABLE_SERVO
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_pwm
),
(
mp_obj_t
)
&
pyb_pwm_set_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_servo
),
(
mp_obj_t
)
&
pyb_servo_set_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_Servo
),
(
mp_obj_t
)
&
pyb_servo_type
},
{
MP_
ROM_QSTR
(
MP_QSTR_pwm
),
MP_ROM_PTR
(
&
pyb_pwm_set_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_servo
),
MP_ROM_PTR
(
&
pyb_servo_set_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_Servo
),
MP_ROM_PTR
(
&
pyb_servo_type
)
},
#endif
#if MICROPY_HW_HAS_SWITCH
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_Switch
),
(
mp_obj_t
)
&
pyb_switch_type
},
{
MP_
ROM_QSTR
(
MP_QSTR_Switch
),
MP_ROM_PTR
(
&
pyb_switch_type
)
},
#endif
#if MICROPY_HW_HAS_FLASH
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_Flash
),
(
mp_obj_t
)
&
pyb_flash_type
},
{
MP_
ROM_QSTR
(
MP_QSTR_Flash
),
MP_ROM_PTR
(
&
pyb_flash_type
)
},
#endif
#if MICROPY_HW_HAS_SDCARD
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_SD
),
(
mp_obj_t
)
&
pyb_sdcard_obj
},
// now obsolete
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_SDCard
),
(
mp_obj_t
)
&
pyb_sdcard_type
},
{
MP_
ROM_QSTR
(
MP_QSTR_SD
),
MP_ROM_PTR
(
&
pyb_sdcard_obj
)
},
// now obsolete
{
MP_
ROM_QSTR
(
MP_QSTR_SDCard
),
MP_ROM_PTR
(
&
pyb_sdcard_type
)
},
#endif
#if defined(MICROPY_HW_LED1)
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_LED
),
(
mp_obj_t
)
&
pyb_led_type
},
{
MP_
ROM_QSTR
(
MP_QSTR_LED
),
MP_ROM_PTR
(
&
pyb_led_type
)
},
#endif
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_I2C
),
(
mp_obj_t
)
&
pyb_i2c_type
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_SPI
),
(
mp_obj_t
)
&
pyb_spi_type
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_UART
),
(
mp_obj_t
)
&
pyb_uart_type
},
{
MP_
ROM_QSTR
(
MP_QSTR_I2C
),
MP_ROM_PTR
(
&
pyb_i2c_type
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_SPI
),
MP_ROM_PTR
(
&
pyb_spi_type
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_UART
),
MP_ROM_PTR
(
&
pyb_uart_type
)
},
#if MICROPY_HW_ENABLE_CAN
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_CAN
),
(
mp_obj_t
)
&
pyb_can_type
},
{
MP_
ROM_QSTR
(
MP_QSTR_CAN
),
MP_ROM_PTR
(
&
pyb_can_type
)
},
#endif
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_ADC
),
(
mp_obj_t
)
&
pyb_adc_type
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_ADCAll
),
(
mp_obj_t
)
&
pyb_adc_all_type
},
{
MP_
ROM_QSTR
(
MP_QSTR_ADC
),
MP_ROM_PTR
(
&
pyb_adc_type
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_ADCAll
),
MP_ROM_PTR
(
&
pyb_adc_all_type
)
},
#if MICROPY_HW_ENABLE_DAC
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_DAC
),
(
mp_obj_t
)
&
pyb_dac_type
},
{
MP_
ROM_QSTR
(
MP_QSTR_DAC
),
MP_ROM_PTR
(
&
pyb_dac_type
)
},
#endif
#if MICROPY_HW_HAS_MMA7660
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_Accel
),
(
mp_obj_t
)
&
pyb_accel_type
},
{
MP_
ROM_QSTR
(
MP_QSTR_Accel
),
MP_ROM_PTR
(
&
pyb_accel_type
)
},
#endif
#if MICROPY_HW_HAS_LCD
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_LCD
),
(
mp_obj_t
)
&
pyb_lcd_type
},
{
MP_
ROM_QSTR
(
MP_QSTR_LCD
),
MP_ROM_PTR
(
&
pyb_lcd_type
)
},
#endif
};
...
...
stmhal/modstm.c
浏览文件 @
09866754
...
...
@@ -37,12 +37,12 @@
#include "py/objint.h"
#include "genhdr/modstm_mpz.h"
STATIC
const
mp_map_elem_t
stm_module_globals_table
[]
=
{
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR___name__
),
MP_OBJ_NEW
_QSTR
(
MP_QSTR_stm
)
},
STATIC
const
mp_
rom_
map_elem_t
stm_module_globals_table
[]
=
{
{
MP_
ROM_QSTR
(
MP_QSTR___name__
),
MP_ROM
_QSTR
(
MP_QSTR_stm
)
},
{
MP_ROM_QSTR
(
MP_QSTR_mem8
),
(
mp_obj_t
)
&
machine_mem8_obj
},
{
MP_ROM_QSTR
(
MP_QSTR_mem16
),
(
mp_obj_t
)
&
machine_mem16_obj
},
{
MP_ROM_QSTR
(
MP_QSTR_mem32
),
(
mp_obj_t
)
&
machine_mem32_obj
},
{
MP_ROM_QSTR
(
MP_QSTR_mem8
),
MP_ROM_PTR
(
&
machine_mem8_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_mem16
),
MP_ROM_PTR
(
&
machine_mem16_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_mem32
),
MP_ROM_PTR
(
&
machine_mem32_obj
)
},
#include "genhdr/modstm_const.h"
};
...
...
stmhal/moduos.c
浏览文件 @
09866754
...
...
@@ -128,36 +128,36 @@ STATIC mp_obj_t os_dupterm(mp_uint_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
mod_os_dupterm_obj
,
0
,
1
,
os_dupterm
);
STATIC
const
mp_map_elem_t
os_module_globals_table
[]
=
{
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR___name__
),
MP_OBJ_NEW
_QSTR
(
MP_QSTR_uos
)
},
STATIC
const
mp_
rom_
map_elem_t
os_module_globals_table
[]
=
{
{
MP_
ROM_QSTR
(
MP_QSTR___name__
),
MP_ROM
_QSTR
(
MP_QSTR_uos
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_uname
),
(
mp_obj_t
)
&
os_uname_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_uname
),
MP_ROM_PTR
(
&
os_uname_obj
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_chdir
),
(
mp_obj_t
)
&
mp_vfs_chdir_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_getcwd
),
(
mp_obj_t
)
&
mp_vfs_getcwd_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_listdir
),
(
mp_obj_t
)
&
mp_vfs_listdir_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_mkdir
),
(
mp_obj_t
)
&
mp_vfs_mkdir_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_remove
),
(
mp_obj_t
)
&
mp_vfs_remove_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_rename
),(
mp_obj_t
)
&
mp_vfs_rename_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_rmdir
),
(
mp_obj_t
)
&
mp_vfs_rmdir_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_stat
),
(
mp_obj_t
)
&
mp_vfs_stat_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_statvfs
),
(
mp_obj_t
)
&
mp_vfs_statvfs_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_unlink
),
(
mp_obj_t
)
&
mp_vfs_remove_obj
},
// unlink aliases to remove
{
MP_
ROM_QSTR
(
MP_QSTR_chdir
),
MP_ROM_PTR
(
&
mp_vfs_chdir_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_getcwd
),
MP_ROM_PTR
(
&
mp_vfs_getcwd_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_listdir
),
MP_ROM_PTR
(
&
mp_vfs_listdir_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_mkdir
),
MP_ROM_PTR
(
&
mp_vfs_mkdir_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_remove
),
MP_ROM_PTR
(
&
mp_vfs_remove_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_rename
),
MP_ROM_PTR
(
&
mp_vfs_rename_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_rmdir
),
MP_ROM_PTR
(
&
mp_vfs_rmdir_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_stat
),
MP_ROM_PTR
(
&
mp_vfs_stat_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_statvfs
),
MP_ROM_PTR
(
&
mp_vfs_statvfs_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_unlink
),
MP_ROM_PTR
(
&
mp_vfs_remove_obj
)
},
// unlink aliases to remove
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_sync
),
(
mp_obj_t
)
&
mod_os_sync_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_sync
),
MP_ROM_PTR
(
&
mod_os_sync_obj
)
},
/// \constant sep - separation character used in paths
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_sep
),
MP_OBJ_NEW
_QSTR
(
MP_QSTR__slash_
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_sep
),
MP_ROM
_QSTR
(
MP_QSTR__slash_
)
},
#if MICROPY_HW_ENABLE_RNG
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_urandom
),
(
mp_obj_t
)
&
os_urandom_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_urandom
),
MP_ROM_PTR
(
&
os_urandom_obj
)
},
#endif
// these are MicroPython extensions
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_dupterm
),
(
mp_obj_t
)
&
mod_os_dupterm_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_mount
),
(
mp_obj_t
)
&
mp_vfs_mount_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_umount
),
(
mp_obj_t
)
&
mp_vfs_umount_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_VfsFat
),
(
mp_obj_t
)
&
mp_fat_vfs_type
},
{
MP_
ROM_QSTR
(
MP_QSTR_dupterm
),
MP_ROM_PTR
(
&
mod_os_dupterm_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_mount
),
MP_ROM_PTR
(
&
mp_vfs_mount_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_umount
),
MP_ROM_PTR
(
&
mp_vfs_umount_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_VfsFat
),
MP_ROM_PTR
(
&
mp_fat_vfs_type
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
os_module_globals
,
os_module_globals_table
);
...
...
stmhal/modusocket.c
浏览文件 @
09866754
...
...
@@ -347,20 +347,20 @@ STATIC mp_obj_t socket_setblocking(mp_obj_t self_in, mp_obj_t blocking) {
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_2
(
socket_setblocking_obj
,
socket_setblocking
);
STATIC
const
mp_map_elem_t
socket_locals_dict_table
[]
=
{
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR___del__
),
(
mp_obj_t
)
&
socket_close_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_close
),
(
mp_obj_t
)
&
socket_close_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_bind
),
(
mp_obj_t
)
&
socket_bind_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_listen
),
(
mp_obj_t
)
&
socket_listen_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_accept
),
(
mp_obj_t
)
&
socket_accept_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_connect
),
(
mp_obj_t
)
&
socket_connect_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_send
),
(
mp_obj_t
)
&
socket_send_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_recv
),
(
mp_obj_t
)
&
socket_recv_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_sendto
),
(
mp_obj_t
)
&
socket_sendto_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_recvfrom
),
(
mp_obj_t
)
&
socket_recvfrom_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_setsockopt
),
(
mp_obj_t
)
&
socket_setsockopt_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_settimeout
),
(
mp_obj_t
)
&
socket_settimeout_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_setblocking
),
(
mp_obj_t
)
&
socket_setblocking_obj
},
STATIC
const
mp_
rom_
map_elem_t
socket_locals_dict_table
[]
=
{
{
MP_
ROM_QSTR
(
MP_QSTR___del__
),
MP_ROM_PTR
(
&
socket_close_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_close
),
MP_ROM_PTR
(
&
socket_close_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_bind
),
MP_ROM_PTR
(
&
socket_bind_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_listen
),
MP_ROM_PTR
(
&
socket_listen_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_accept
),
MP_ROM_PTR
(
&
socket_accept_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_connect
),
MP_ROM_PTR
(
&
socket_connect_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_send
),
MP_ROM_PTR
(
&
socket_send_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_recv
),
MP_ROM_PTR
(
&
socket_recv_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_sendto
),
MP_ROM_PTR
(
&
socket_sendto_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_recvfrom
),
MP_ROM_PTR
(
&
socket_recvfrom_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_setsockopt
),
MP_ROM_PTR
(
&
socket_setsockopt_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_settimeout
),
MP_ROM_PTR
(
&
socket_settimeout_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_setblocking
),
MP_ROM_PTR
(
&
socket_setblocking_obj
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
socket_locals_dict
,
socket_locals_dict_table
);
...
...
@@ -380,7 +380,7 @@ STATIC const mp_obj_type_t socket_type = {
.
name
=
MP_QSTR_socket
,
.
make_new
=
socket_make_new
,
.
protocol
=
&
socket_stream_p
,
.
locals_dict
=
(
mp_obj_
t
)
&
socket_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
socket_locals_dict
,
};
/******************************************************************************/
...
...
@@ -417,28 +417,28 @@ STATIC mp_obj_t mod_usocket_getaddrinfo(mp_obj_t host_in, mp_obj_t port_in) {
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_2
(
mod_usocket_getaddrinfo_obj
,
mod_usocket_getaddrinfo
);
STATIC
const
mp_map_elem_t
mp_module_usocket_globals_table
[]
=
{
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR___name__
),
MP_OBJ_NEW
_QSTR
(
MP_QSTR_usocket
)
},
STATIC
const
mp_
rom_
map_elem_t
mp_module_usocket_globals_table
[]
=
{
{
MP_
ROM_QSTR
(
MP_QSTR___name__
),
MP_ROM
_QSTR
(
MP_QSTR_usocket
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_socket
),
(
mp_obj_t
)
&
socket_type
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_getaddrinfo
),
(
mp_obj_t
)
&
mod_usocket_getaddrinfo_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_socket
),
MP_ROM_PTR
(
&
socket_type
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_getaddrinfo
),
MP_ROM_PTR
(
&
mod_usocket_getaddrinfo_obj
)
},
// class constants
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_AF_INET
),
MP_OBJ_NEW_SMALL
_INT
(
MOD_NETWORK_AF_INET
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_AF_INET6
),
MP_OBJ_NEW_SMALL
_INT
(
MOD_NETWORK_AF_INET6
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_AF_INET
),
MP_ROM
_INT
(
MOD_NETWORK_AF_INET
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_AF_INET6
),
MP_ROM
_INT
(
MOD_NETWORK_AF_INET6
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_SOCK_STREAM
),
MP_OBJ_NEW_SMALL
_INT
(
MOD_NETWORK_SOCK_STREAM
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_SOCK_DGRAM
),
MP_OBJ_NEW_SMALL
_INT
(
MOD_NETWORK_SOCK_DGRAM
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_SOCK_RAW
),
MP_OBJ_NEW_SMALL
_INT
(
MOD_NETWORK_SOCK_RAW
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_SOCK_STREAM
),
MP_ROM
_INT
(
MOD_NETWORK_SOCK_STREAM
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_SOCK_DGRAM
),
MP_ROM
_INT
(
MOD_NETWORK_SOCK_DGRAM
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_SOCK_RAW
),
MP_ROM
_INT
(
MOD_NETWORK_SOCK_RAW
)
},
/*
{ MP_
OBJ_NEW_QSTR(MP_QSTR_IPPROTO_IP), MP_OBJ_NEW_SMALL
_INT(MOD_NETWORK_IPPROTO_IP) },
{ MP_
OBJ_NEW_QSTR(MP_QSTR_IPPROTO_ICMP), MP_OBJ_NEW_SMALL
_INT(MOD_NETWORK_IPPROTO_ICMP) },
{ MP_
OBJ_NEW_QSTR(MP_QSTR_IPPROTO_IPV4), MP_OBJ_NEW_SMALL
_INT(MOD_NETWORK_IPPROTO_IPV4) },
{ MP_
OBJ_NEW_QSTR(MP_QSTR_IPPROTO_TCP), MP_OBJ_NEW_SMALL
_INT(MOD_NETWORK_IPPROTO_TCP) },
{ MP_
OBJ_NEW_QSTR(MP_QSTR_IPPROTO_UDP), MP_OBJ_NEW_SMALL
_INT(MOD_NETWORK_IPPROTO_UDP) },
{ MP_
OBJ_NEW_QSTR(MP_QSTR_IPPROTO_IPV6), MP_OBJ_NEW_SMALL
_INT(MOD_NETWORK_IPPROTO_IPV6) },
{ MP_
OBJ_NEW_QSTR(MP_QSTR_IPPROTO_RAW), MP_OBJ_NEW_SMALL
_INT(MOD_NETWORK_IPPROTO_RAW) },
{ MP_
ROM_QSTR(MP_QSTR_IPPROTO_IP), MP_ROM
_INT(MOD_NETWORK_IPPROTO_IP) },
{ MP_
ROM_QSTR(MP_QSTR_IPPROTO_ICMP), MP_ROM
_INT(MOD_NETWORK_IPPROTO_ICMP) },
{ MP_
ROM_QSTR(MP_QSTR_IPPROTO_IPV4), MP_ROM
_INT(MOD_NETWORK_IPPROTO_IPV4) },
{ MP_
ROM_QSTR(MP_QSTR_IPPROTO_TCP), MP_ROM
_INT(MOD_NETWORK_IPPROTO_TCP) },
{ MP_
ROM_QSTR(MP_QSTR_IPPROTO_UDP), MP_ROM
_INT(MOD_NETWORK_IPPROTO_UDP) },
{ MP_
ROM_QSTR(MP_QSTR_IPPROTO_IPV6), MP_ROM
_INT(MOD_NETWORK_IPPROTO_IPV6) },
{ MP_
ROM_QSTR(MP_QSTR_IPPROTO_RAW), MP_ROM
_INT(MOD_NETWORK_IPPROTO_RAW) },
*/
};
...
...
stmhal/pin.c
浏览文件 @
09866754
...
...
@@ -496,47 +496,47 @@ STATIC mp_obj_t pin_af(mp_obj_t self_in) {
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
pin_af_obj
,
pin_af
);
STATIC
const
mp_map_elem_t
pin_locals_dict_table
[]
=
{
STATIC
const
mp_
rom_
map_elem_t
pin_locals_dict_table
[]
=
{
// instance methods
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_init
),
(
mp_obj_t
)
&
pin_init_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_value
),
(
mp_obj_t
)
&
pin_value_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_low
),
(
mp_obj_t
)
&
pin_low_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_high
),
(
mp_obj_t
)
&
pin_high_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_name
),
(
mp_obj_t
)
&
pin_name_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_names
),
(
mp_obj_t
)
&
pin_names_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_af_list
),
(
mp_obj_t
)
&
pin_af_list_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_port
),
(
mp_obj_t
)
&
pin_port_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_pin
),
(
mp_obj_t
)
&
pin_pin_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_gpio
),
(
mp_obj_t
)
&
pin_gpio_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_mode
),
(
mp_obj_t
)
&
pin_mode_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_pull
),
(
mp_obj_t
)
&
pin_pull_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_af
),
(
mp_obj_t
)
&
pin_af_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_init
),
MP_ROM_PTR
(
&
pin_init_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_value
),
MP_ROM_PTR
(
&
pin_value_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_low
),
MP_ROM_PTR
(
&
pin_low_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_high
),
MP_ROM_PTR
(
&
pin_high_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_name
),
MP_ROM_PTR
(
&
pin_name_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_names
),
MP_ROM_PTR
(
&
pin_names_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_af_list
),
MP_ROM_PTR
(
&
pin_af_list_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_port
),
MP_ROM_PTR
(
&
pin_port_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_pin
),
MP_ROM_PTR
(
&
pin_pin_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_gpio
),
MP_ROM_PTR
(
&
pin_gpio_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_mode
),
MP_ROM_PTR
(
&
pin_mode_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_pull
),
MP_ROM_PTR
(
&
pin_pull_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_af
),
MP_ROM_PTR
(
&
pin_af_obj
)
},
// class methods
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_mapper
),
(
mp_obj_t
)
&
pin_mapper_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_dict
),
(
mp_obj_t
)
&
pin_map_dict_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_debug
),
(
mp_obj_t
)
&
pin_debug_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_mapper
),
MP_ROM_PTR
(
&
pin_mapper_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_dict
),
MP_ROM_PTR
(
&
pin_map_dict_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_debug
),
MP_ROM_PTR
(
&
pin_debug_obj
)
},
// class attributes
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_board
),
(
mp_obj_t
)
&
pin_board_pins_obj_type
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_cpu
),
(
mp_obj_t
)
&
pin_cpu_pins_obj_type
},
{
MP_
ROM_QSTR
(
MP_QSTR_board
),
MP_ROM_PTR
(
&
pin_board_pins_obj_type
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_cpu
),
MP_ROM_PTR
(
&
pin_cpu_pins_obj_type
)
},
// class constants
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_IN
),
MP_OBJ_NEW_SMALL
_INT
(
GPIO_MODE_INPUT
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_OUT
),
MP_OBJ_NEW_SMALL
_INT
(
GPIO_MODE_OUTPUT_PP
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_OPEN_DRAIN
),
MP_OBJ_NEW_SMALL
_INT
(
GPIO_MODE_OUTPUT_OD
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_ALT
),
MP_OBJ_NEW_SMALL
_INT
(
GPIO_MODE_AF_PP
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_ALT_OPEN_DRAIN
),
MP_OBJ_NEW_SMALL
_INT
(
GPIO_MODE_AF_OD
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_ANALOG
),
MP_OBJ_NEW_SMALL
_INT
(
GPIO_MODE_ANALOG
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_PULL_UP
),
MP_OBJ_NEW_SMALL
_INT
(
GPIO_PULLUP
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_PULL_DOWN
),
MP_OBJ_NEW_SMALL
_INT
(
GPIO_PULLDOWN
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_IN
),
MP_ROM
_INT
(
GPIO_MODE_INPUT
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_OUT
),
MP_ROM
_INT
(
GPIO_MODE_OUTPUT_PP
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_OPEN_DRAIN
),
MP_ROM
_INT
(
GPIO_MODE_OUTPUT_OD
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_ALT
),
MP_ROM
_INT
(
GPIO_MODE_AF_PP
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_ALT_OPEN_DRAIN
),
MP_ROM
_INT
(
GPIO_MODE_AF_OD
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_ANALOG
),
MP_ROM
_INT
(
GPIO_MODE_ANALOG
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_PULL_UP
),
MP_ROM
_INT
(
GPIO_PULLUP
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_PULL_DOWN
),
MP_ROM
_INT
(
GPIO_PULLDOWN
)
},
// legacy class constants
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_OUT_PP
),
MP_OBJ_NEW_SMALL
_INT
(
GPIO_MODE_OUTPUT_PP
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_OUT_OD
),
MP_OBJ_NEW_SMALL
_INT
(
GPIO_MODE_OUTPUT_OD
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_AF_PP
),
MP_OBJ_NEW_SMALL
_INT
(
GPIO_MODE_AF_PP
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_AF_OD
),
MP_OBJ_NEW_SMALL
_INT
(
GPIO_MODE_AF_OD
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_PULL_NONE
),
MP_OBJ_NEW_SMALL
_INT
(
GPIO_NOPULL
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_OUT_PP
),
MP_ROM
_INT
(
GPIO_MODE_OUTPUT_PP
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_OUT_OD
),
MP_ROM
_INT
(
GPIO_MODE_OUTPUT_OD
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_AF_PP
),
MP_ROM
_INT
(
GPIO_MODE_AF_PP
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_AF_OD
),
MP_ROM
_INT
(
GPIO_MODE_AF_OD
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_PULL_NONE
),
MP_ROM
_INT
(
GPIO_NOPULL
)
},
#include "genhdr/pins_af_const.h"
};
...
...
@@ -570,7 +570,7 @@ const mp_obj_type_t pin_type = {
.
make_new
=
mp_pin_make_new
,
.
call
=
pin_call
,
.
protocol
=
&
pin_pin_p
,
.
locals_dict
=
(
mp_obj_
t
)
&
pin_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
pin_locals_dict
,
};
/// \moduleref pyb
...
...
@@ -633,10 +633,10 @@ STATIC mp_obj_t pin_af_reg(mp_obj_t self_in) {
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
pin_af_reg_obj
,
pin_af_reg
);
STATIC
const
mp_map_elem_t
pin_af_locals_dict_table
[]
=
{
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_index
),
(
mp_obj_t
)
&
pin_af_index_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_name
),
(
mp_obj_t
)
&
pin_af_name_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_reg
),
(
mp_obj_t
)
&
pin_af_reg_obj
},
STATIC
const
mp_
rom_
map_elem_t
pin_af_locals_dict_table
[]
=
{
{
MP_
ROM_QSTR
(
MP_QSTR_index
),
MP_ROM_PTR
(
&
pin_af_index_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_name
),
MP_ROM_PTR
(
&
pin_af_name_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_reg
),
MP_ROM_PTR
(
&
pin_af_reg_obj
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
pin_af_locals_dict
,
pin_af_locals_dict_table
);
...
...
@@ -644,5 +644,5 @@ const mp_obj_type_t pin_af_type = {
{
&
mp_type_type
},
.
name
=
MP_QSTR_PinAF
,
.
print
=
pin_af_obj_print
,
.
locals_dict
=
(
mp_obj_
t
)
&
pin_af_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
pin_af_locals_dict
,
};
stmhal/pybstdio.c
浏览文件 @
09866754
...
...
@@ -92,19 +92,19 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(stdio_obj___exit___obj, 4, 4, stdio_o
// TODO gc hook to close the file if not already closed
STATIC
const
mp_map_elem_t
stdio_locals_dict_table
[]
=
{
STATIC
const
mp_
rom_
map_elem_t
stdio_locals_dict_table
[]
=
{
#if MICROPY_PY_SYS_STDIO_BUFFER
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_buffer
),
(
mp_obj_t
)
&
stdio_buffer_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_buffer
),
MP_ROM_PTR
(
&
stdio_buffer_obj
)
},
#endif
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_read
),
(
mp_obj_t
)
&
mp_stream_read_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_readinto
),
(
mp_obj_t
)
&
mp_stream_readinto_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_readline
),
(
mp_obj_t
)
&
mp_stream_unbuffered_readline_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_readlines
),
(
mp_obj_t
)
&
mp_stream_unbuffered_readlines_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_write
),
(
mp_obj_t
)
&
mp_stream_write_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_close
),
(
mp_obj_t
)
&
mp_identity_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR___del__
),
(
mp_obj_t
)
&
mp_identity_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR___enter__
),
(
mp_obj_t
)
&
mp_identity_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR___exit__
),
(
mp_obj_t
)
&
stdio_obj___exit___obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_read
),
MP_ROM_PTR
(
&
mp_stream_read_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_readinto
),
MP_ROM_PTR
(
&
mp_stream_readinto_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_readline
),
MP_ROM_PTR
(
&
mp_stream_unbuffered_readline_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_readlines
),
MP_ROM_PTR
(
&
mp_stream_unbuffered_readlines_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_write
),
MP_ROM_PTR
(
&
mp_stream_write_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_close
),
MP_ROM_PTR
(
&
mp_identity_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR___del__
),
MP_ROM_PTR
(
&
mp_identity_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR___enter__
),
MP_ROM_PTR
(
&
mp_identity_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR___exit__
),
MP_ROM_PTR
(
&
stdio_obj___exit___obj
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
stdio_locals_dict
,
stdio_locals_dict_table
);
...
...
@@ -123,7 +123,7 @@ STATIC const mp_obj_type_t stdio_obj_type = {
.
getiter
=
mp_identity_getiter
,
.
iternext
=
mp_stream_unbuffered_iter
,
.
protocol
=
&
stdio_obj_stream_p
,
.
locals_dict
=
(
mp_obj_
t
)
&
stdio_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
stdio_locals_dict
,
};
const
pyb_stdio_obj_t
mp_sys_stdin_obj
=
{{
&
stdio_obj_type
},
.
fd
=
STDIO_FD_IN
};
...
...
stmhal/rtc.c
浏览文件 @
09866754
...
...
@@ -718,12 +718,12 @@ mp_obj_t pyb_rtc_calibration(mp_uint_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
pyb_rtc_calibration_obj
,
1
,
2
,
pyb_rtc_calibration
);
STATIC
const
mp_map_elem_t
pyb_rtc_locals_dict_table
[]
=
{
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_init
),
(
mp_obj_t
)
&
pyb_rtc_init_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_info
),
(
mp_obj_t
)
&
pyb_rtc_info_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_datetime
),
(
mp_obj_t
)
&
pyb_rtc_datetime_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_wakeup
),
(
mp_obj_t
)
&
pyb_rtc_wakeup_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_calibration
),
(
mp_obj_t
)
&
pyb_rtc_calibration_obj
},
STATIC
const
mp_
rom_
map_elem_t
pyb_rtc_locals_dict_table
[]
=
{
{
MP_
ROM_QSTR
(
MP_QSTR_init
),
MP_ROM_PTR
(
&
pyb_rtc_init_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_info
),
MP_ROM_PTR
(
&
pyb_rtc_info_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_datetime
),
MP_ROM_PTR
(
&
pyb_rtc_datetime_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_wakeup
),
MP_ROM_PTR
(
&
pyb_rtc_wakeup_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_calibration
),
MP_ROM_PTR
(
&
pyb_rtc_calibration_obj
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
pyb_rtc_locals_dict
,
pyb_rtc_locals_dict_table
);
...
...
@@ -731,5 +731,5 @@ const mp_obj_type_t pyb_rtc_type = {
{
&
mp_type_type
},
.
name
=
MP_QSTR_RTC
,
.
make_new
=
pyb_rtc_make_new
,
.
locals_dict
=
(
mp_obj_
t
)
&
pyb_rtc_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
pyb_rtc_locals_dict
,
};
stmhal/sdcard.c
浏览文件 @
09866754
...
...
@@ -469,16 +469,16 @@ STATIC mp_obj_t pyb_sdcard_ioctl(mp_obj_t self, mp_obj_t cmd_in, mp_obj_t arg_in
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_3
(
pyb_sdcard_ioctl_obj
,
pyb_sdcard_ioctl
);
STATIC
const
mp_map_elem_t
pyb_sdcard_locals_dict_table
[]
=
{
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_present
),
(
mp_obj_t
)
&
sd_present_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_power
),
(
mp_obj_t
)
&
sd_power_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_info
),
(
mp_obj_t
)
&
sd_info_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_read
),
(
mp_obj_t
)
&
sd_read_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_write
),
(
mp_obj_t
)
&
sd_write_obj
},
STATIC
const
mp_
rom_
map_elem_t
pyb_sdcard_locals_dict_table
[]
=
{
{
MP_
ROM_QSTR
(
MP_QSTR_present
),
MP_ROM_PTR
(
&
sd_present_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_power
),
MP_ROM_PTR
(
&
sd_power_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_info
),
MP_ROM_PTR
(
&
sd_info_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_read
),
MP_ROM_PTR
(
&
sd_read_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_write
),
MP_ROM_PTR
(
&
sd_write_obj
)
},
// block device protocol
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_readblocks
),
(
mp_obj_t
)
&
pyb_sdcard_readblocks_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_writeblocks
),
(
mp_obj_t
)
&
pyb_sdcard_writeblocks_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_ioctl
),
(
mp_obj_t
)
&
pyb_sdcard_ioctl_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_readblocks
),
MP_ROM_PTR
(
&
pyb_sdcard_readblocks_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_writeblocks
),
MP_ROM_PTR
(
&
pyb_sdcard_writeblocks_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_ioctl
),
MP_ROM_PTR
(
&
pyb_sdcard_ioctl_obj
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
pyb_sdcard_locals_dict
,
pyb_sdcard_locals_dict_table
);
...
...
@@ -487,7 +487,7 @@ const mp_obj_type_t pyb_sdcard_type = {
{
&
mp_type_type
},
.
name
=
MP_QSTR_SDCard
,
.
make_new
=
pyb_sdcard_make_new
,
.
locals_dict
=
(
mp_obj_
t
)
&
pyb_sdcard_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
pyb_sdcard_locals_dict
,
};
void
sdcard_init_vfs
(
fs_user_mount_t
*
vfs
,
int
part
)
{
...
...
stmhal/servo.c
浏览文件 @
09866754
...
...
@@ -317,11 +317,11 @@ STATIC mp_obj_t pyb_servo_speed(mp_uint_t n_args, const mp_obj_t *args) {
STATIC
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
pyb_servo_speed_obj
,
1
,
3
,
pyb_servo_speed
);
STATIC
const
mp_map_elem_t
pyb_servo_locals_dict_table
[]
=
{
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_pulse_width
),
(
mp_obj_t
)
&
pyb_servo_pulse_width_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_calibration
),
(
mp_obj_t
)
&
pyb_servo_calibration_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_angle
),
(
mp_obj_t
)
&
pyb_servo_angle_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_speed
),
(
mp_obj_t
)
&
pyb_servo_speed_obj
},
STATIC
const
mp_
rom_
map_elem_t
pyb_servo_locals_dict_table
[]
=
{
{
MP_
ROM_QSTR
(
MP_QSTR_pulse_width
),
MP_ROM_PTR
(
&
pyb_servo_pulse_width_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_calibration
),
MP_ROM_PTR
(
&
pyb_servo_calibration_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_angle
),
MP_ROM_PTR
(
&
pyb_servo_angle_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_speed
),
MP_ROM_PTR
(
&
pyb_servo_speed_obj
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
pyb_servo_locals_dict
,
pyb_servo_locals_dict_table
);
...
...
@@ -331,5 +331,5 @@ const mp_obj_type_t pyb_servo_type = {
.
name
=
MP_QSTR_Servo
,
.
print
=
pyb_servo_print
,
.
make_new
=
pyb_servo_make_new
,
.
locals_dict
=
(
mp_obj_
t
)
&
pyb_servo_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
pyb_servo_locals_dict
,
};
stmhal/spi.c
浏览文件 @
09866754
...
...
@@ -783,37 +783,37 @@ STATIC mp_obj_t pyb_spi_send_recv(mp_uint_t n_args, const mp_obj_t *pos_args, mp
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_KW
(
pyb_spi_send_recv_obj
,
1
,
pyb_spi_send_recv
);
STATIC
const
mp_map_elem_t
pyb_spi_locals_dict_table
[]
=
{
STATIC
const
mp_
rom_
map_elem_t
pyb_spi_locals_dict_table
[]
=
{
// instance methods
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_init
),
(
mp_obj_t
)
&
pyb_spi_init_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_deinit
),
(
mp_obj_t
)
&
pyb_spi_deinit_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_init
),
MP_ROM_PTR
(
&
pyb_spi_init_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_deinit
),
MP_ROM_PTR
(
&
pyb_spi_deinit_obj
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_read
),
(
mp_obj_t
)
&
mp_machine_spi_read_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_readinto
),
(
mp_obj_t
)
&
mp_machine_spi_readinto_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_write
),
(
mp_obj_t
)
&
mp_machine_spi_write_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_write_readinto
),
(
mp_obj_t
)
&
mp_machine_spi_write_readinto_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_read
),
MP_ROM_PTR
(
&
mp_machine_spi_read_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_readinto
),
MP_ROM_PTR
(
&
mp_machine_spi_readinto_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_write
),
MP_ROM_PTR
(
&
mp_machine_spi_write_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_write_readinto
),
MP_ROM_PTR
(
&
mp_machine_spi_write_readinto_obj
)
},
// legacy methods
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_send
),
(
mp_obj_t
)
&
pyb_spi_send_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_recv
),
(
mp_obj_t
)
&
pyb_spi_recv_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_send_recv
),
(
mp_obj_t
)
&
pyb_spi_send_recv_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_send
),
MP_ROM_PTR
(
&
pyb_spi_send_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_recv
),
MP_ROM_PTR
(
&
pyb_spi_recv_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_send_recv
),
MP_ROM_PTR
(
&
pyb_spi_send_recv_obj
)
},
// class constants
/// \constant MASTER - for initialising the bus to master mode
/// \constant SLAVE - for initialising the bus to slave mode
/// \constant MSB - set the first bit to MSB
/// \constant LSB - set the first bit to LSB
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_MASTER
),
MP_OBJ_NEW_SMALL
_INT
(
SPI_MODE_MASTER
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_SLAVE
),
MP_OBJ_NEW_SMALL
_INT
(
SPI_MODE_SLAVE
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_MSB
),
MP_OBJ_NEW_SMALL
_INT
(
SPI_FIRSTBIT_MSB
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_LSB
),
MP_OBJ_NEW_SMALL
_INT
(
SPI_FIRSTBIT_LSB
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_MASTER
),
MP_ROM
_INT
(
SPI_MODE_MASTER
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_SLAVE
),
MP_ROM
_INT
(
SPI_MODE_SLAVE
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_MSB
),
MP_ROM
_INT
(
SPI_FIRSTBIT_MSB
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_LSB
),
MP_ROM
_INT
(
SPI_FIRSTBIT_LSB
)
},
/* TODO
{ MP_
OBJ_NEW
_QSTR(MP_QSTR_DIRECTION_2LINES ((uint32_t)0x00000000)
{ MP_
OBJ_NEW
_QSTR(MP_QSTR_DIRECTION_2LINES_RXONLY SPI_CR1_RXONLY
{ MP_
OBJ_NEW
_QSTR(MP_QSTR_DIRECTION_1LINE SPI_CR1_BIDIMODE
{ MP_
OBJ_NEW
_QSTR(MP_QSTR_NSS_SOFT SPI_CR1_SSM
{ MP_
OBJ_NEW
_QSTR(MP_QSTR_NSS_HARD_INPUT ((uint32_t)0x00000000)
{ MP_
OBJ_NEW
_QSTR(MP_QSTR_NSS_HARD_OUTPUT ((uint32_t)0x00040000)
{ MP_
ROM
_QSTR(MP_QSTR_DIRECTION_2LINES ((uint32_t)0x00000000)
{ MP_
ROM
_QSTR(MP_QSTR_DIRECTION_2LINES_RXONLY SPI_CR1_RXONLY
{ MP_
ROM
_QSTR(MP_QSTR_DIRECTION_1LINE SPI_CR1_BIDIMODE
{ MP_
ROM
_QSTR(MP_QSTR_NSS_SOFT SPI_CR1_SSM
{ MP_
ROM
_QSTR(MP_QSTR_NSS_HARD_INPUT ((uint32_t)0x00000000)
{ MP_
ROM
_QSTR(MP_QSTR_NSS_HARD_OUTPUT ((uint32_t)0x00040000)
*/
};
...
...
@@ -833,7 +833,7 @@ const mp_obj_type_t pyb_spi_type = {
.
print
=
pyb_spi_print
,
.
make_new
=
pyb_spi_make_new
,
.
protocol
=
&
pyb_spi_p
,
.
locals_dict
=
(
mp_obj_
t
)
&
pyb_spi_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
pyb_spi_locals_dict
,
};
/******************************************************************************/
...
...
stmhal/storage.c
浏览文件 @
09866754
...
...
@@ -488,10 +488,10 @@ STATIC mp_obj_t pyb_flash_ioctl(mp_obj_t self, mp_obj_t cmd_in, mp_obj_t arg_in)
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_3
(
pyb_flash_ioctl_obj
,
pyb_flash_ioctl
);
STATIC
const
mp_map_elem_t
pyb_flash_locals_dict_table
[]
=
{
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_readblocks
),
(
mp_obj_t
)
&
pyb_flash_readblocks_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_writeblocks
),
(
mp_obj_t
)
&
pyb_flash_writeblocks_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_ioctl
),
(
mp_obj_t
)
&
pyb_flash_ioctl_obj
},
STATIC
const
mp_
rom_
map_elem_t
pyb_flash_locals_dict_table
[]
=
{
{
MP_
ROM_QSTR
(
MP_QSTR_readblocks
),
MP_ROM_PTR
(
&
pyb_flash_readblocks_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_writeblocks
),
MP_ROM_PTR
(
&
pyb_flash_writeblocks_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_ioctl
),
MP_ROM_PTR
(
&
pyb_flash_ioctl_obj
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
pyb_flash_locals_dict
,
pyb_flash_locals_dict_table
);
...
...
@@ -500,7 +500,7 @@ const mp_obj_type_t pyb_flash_type = {
{
&
mp_type_type
},
.
name
=
MP_QSTR_Flash
,
.
make_new
=
pyb_flash_make_new
,
.
locals_dict
=
(
mp_obj_
t
)
&
pyb_flash_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
pyb_flash_locals_dict
,
};
void
pyb_flash_init_vfs
(
fs_user_mount_t
*
vfs
)
{
...
...
stmhal/timer.c
浏览文件 @
09866754
...
...
@@ -1180,37 +1180,37 @@ STATIC mp_obj_t pyb_timer_callback(mp_obj_t self_in, mp_obj_t callback) {
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_2
(
pyb_timer_callback_obj
,
pyb_timer_callback
);
STATIC
const
mp_map_elem_t
pyb_timer_locals_dict_table
[]
=
{
STATIC
const
mp_
rom_
map_elem_t
pyb_timer_locals_dict_table
[]
=
{
// instance methods
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_init
),
(
mp_obj_t
)
&
pyb_timer_init_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_deinit
),
(
mp_obj_t
)
&
pyb_timer_deinit_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_channel
),
(
mp_obj_t
)
&
pyb_timer_channel_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_counter
),
(
mp_obj_t
)
&
pyb_timer_counter_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_source_freq
),
(
mp_obj_t
)
&
pyb_timer_source_freq_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_freq
),
(
mp_obj_t
)
&
pyb_timer_freq_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_prescaler
),
(
mp_obj_t
)
&
pyb_timer_prescaler_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_period
),
(
mp_obj_t
)
&
pyb_timer_period_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_callback
),
(
mp_obj_t
)
&
pyb_timer_callback_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_UP
),
MP_OBJ_NEW_SMALL
_INT
(
TIM_COUNTERMODE_UP
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_DOWN
),
MP_OBJ_NEW_SMALL
_INT
(
TIM_COUNTERMODE_DOWN
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_CENTER
),
MP_OBJ_NEW_SMALL
_INT
(
TIM_COUNTERMODE_CENTERALIGNED1
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_PWM
),
MP_OBJ_NEW_SMALL
_INT
(
CHANNEL_MODE_PWM_NORMAL
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_PWM_INVERTED
),
MP_OBJ_NEW_SMALL
_INT
(
CHANNEL_MODE_PWM_INVERTED
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_OC_TIMING
),
MP_OBJ_NEW_SMALL
_INT
(
CHANNEL_MODE_OC_TIMING
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_OC_ACTIVE
),
MP_OBJ_NEW_SMALL
_INT
(
CHANNEL_MODE_OC_ACTIVE
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_OC_INACTIVE
),
MP_OBJ_NEW_SMALL
_INT
(
CHANNEL_MODE_OC_INACTIVE
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_OC_TOGGLE
),
MP_OBJ_NEW_SMALL
_INT
(
CHANNEL_MODE_OC_TOGGLE
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_OC_FORCED_ACTIVE
),
MP_OBJ_NEW_SMALL
_INT
(
CHANNEL_MODE_OC_FORCED_ACTIVE
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_OC_FORCED_INACTIVE
),
MP_OBJ_NEW_SMALL
_INT
(
CHANNEL_MODE_OC_FORCED_INACTIVE
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_IC
),
MP_OBJ_NEW_SMALL
_INT
(
CHANNEL_MODE_IC
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_ENC_A
),
MP_OBJ_NEW_SMALL
_INT
(
CHANNEL_MODE_ENC_A
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_ENC_B
),
MP_OBJ_NEW_SMALL
_INT
(
CHANNEL_MODE_ENC_B
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_ENC_AB
),
MP_OBJ_NEW_SMALL
_INT
(
CHANNEL_MODE_ENC_AB
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_HIGH
),
MP_OBJ_NEW_SMALL
_INT
(
TIM_OCPOLARITY_HIGH
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_LOW
),
MP_OBJ_NEW_SMALL
_INT
(
TIM_OCPOLARITY_LOW
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_RISING
),
MP_OBJ_NEW_SMALL
_INT
(
TIM_ICPOLARITY_RISING
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_FALLING
),
MP_OBJ_NEW_SMALL
_INT
(
TIM_ICPOLARITY_FALLING
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_BOTH
),
MP_OBJ_NEW_SMALL
_INT
(
TIM_ICPOLARITY_BOTHEDGE
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_init
),
MP_ROM_PTR
(
&
pyb_timer_init_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_deinit
),
MP_ROM_PTR
(
&
pyb_timer_deinit_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_channel
),
MP_ROM_PTR
(
&
pyb_timer_channel_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_counter
),
MP_ROM_PTR
(
&
pyb_timer_counter_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_source_freq
),
MP_ROM_PTR
(
&
pyb_timer_source_freq_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_freq
),
MP_ROM_PTR
(
&
pyb_timer_freq_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_prescaler
),
MP_ROM_PTR
(
&
pyb_timer_prescaler_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_period
),
MP_ROM_PTR
(
&
pyb_timer_period_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_callback
),
MP_ROM_PTR
(
&
pyb_timer_callback_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_UP
),
MP_ROM
_INT
(
TIM_COUNTERMODE_UP
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_DOWN
),
MP_ROM
_INT
(
TIM_COUNTERMODE_DOWN
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_CENTER
),
MP_ROM
_INT
(
TIM_COUNTERMODE_CENTERALIGNED1
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_PWM
),
MP_ROM
_INT
(
CHANNEL_MODE_PWM_NORMAL
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_PWM_INVERTED
),
MP_ROM
_INT
(
CHANNEL_MODE_PWM_INVERTED
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_OC_TIMING
),
MP_ROM
_INT
(
CHANNEL_MODE_OC_TIMING
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_OC_ACTIVE
),
MP_ROM
_INT
(
CHANNEL_MODE_OC_ACTIVE
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_OC_INACTIVE
),
MP_ROM
_INT
(
CHANNEL_MODE_OC_INACTIVE
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_OC_TOGGLE
),
MP_ROM
_INT
(
CHANNEL_MODE_OC_TOGGLE
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_OC_FORCED_ACTIVE
),
MP_ROM
_INT
(
CHANNEL_MODE_OC_FORCED_ACTIVE
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_OC_FORCED_INACTIVE
),
MP_ROM
_INT
(
CHANNEL_MODE_OC_FORCED_INACTIVE
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_IC
),
MP_ROM
_INT
(
CHANNEL_MODE_IC
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_ENC_A
),
MP_ROM
_INT
(
CHANNEL_MODE_ENC_A
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_ENC_B
),
MP_ROM
_INT
(
CHANNEL_MODE_ENC_B
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_ENC_AB
),
MP_ROM
_INT
(
CHANNEL_MODE_ENC_AB
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_HIGH
),
MP_ROM
_INT
(
TIM_OCPOLARITY_HIGH
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_LOW
),
MP_ROM
_INT
(
TIM_OCPOLARITY_LOW
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_RISING
),
MP_ROM
_INT
(
TIM_ICPOLARITY_RISING
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_FALLING
),
MP_ROM
_INT
(
TIM_ICPOLARITY_FALLING
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_BOTH
),
MP_ROM
_INT
(
TIM_ICPOLARITY_BOTHEDGE
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
pyb_timer_locals_dict
,
pyb_timer_locals_dict_table
);
...
...
@@ -1219,7 +1219,7 @@ const mp_obj_type_t pyb_timer_type = {
.
name
=
MP_QSTR_Timer
,
.
print
=
pyb_timer_print
,
.
make_new
=
pyb_timer_make_new
,
.
locals_dict
=
(
mp_obj_
t
)
&
pyb_timer_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
pyb_timer_locals_dict
,
};
/// \moduleref pyb
...
...
@@ -1337,13 +1337,13 @@ STATIC mp_obj_t pyb_timer_channel_callback(mp_obj_t self_in, mp_obj_t callback)
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_2
(
pyb_timer_channel_callback_obj
,
pyb_timer_channel_callback
);
STATIC
const
mp_map_elem_t
pyb_timer_channel_locals_dict_table
[]
=
{
STATIC
const
mp_
rom_
map_elem_t
pyb_timer_channel_locals_dict_table
[]
=
{
// instance methods
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_callback
),
(
mp_obj_t
)
&
pyb_timer_channel_callback_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_pulse_width
),
(
mp_obj_t
)
&
pyb_timer_channel_capture_compare_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_pulse_width_percent
),
(
mp_obj_t
)
&
pyb_timer_channel_pulse_width_percent_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_capture
),
(
mp_obj_t
)
&
pyb_timer_channel_capture_compare_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_compare
),
(
mp_obj_t
)
&
pyb_timer_channel_capture_compare_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_callback
),
MP_ROM_PTR
(
&
pyb_timer_channel_callback_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_pulse_width
),
MP_ROM_PTR
(
&
pyb_timer_channel_capture_compare_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_pulse_width_percent
),
MP_ROM_PTR
(
&
pyb_timer_channel_pulse_width_percent_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_capture
),
MP_ROM_PTR
(
&
pyb_timer_channel_capture_compare_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_compare
),
MP_ROM_PTR
(
&
pyb_timer_channel_capture_compare_obj
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
pyb_timer_channel_locals_dict
,
pyb_timer_channel_locals_dict_table
);
...
...
@@ -1351,7 +1351,7 @@ STATIC const mp_obj_type_t pyb_timer_channel_type = {
{
&
mp_type_type
},
.
name
=
MP_QSTR_TimerChannel
,
.
print
=
pyb_timer_channel_print
,
.
locals_dict
=
(
mp_obj_
t
)
&
pyb_timer_channel_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
pyb_timer_channel_locals_dict
,
};
STATIC
void
timer_handle_irq_channel
(
pyb_timer_obj_t
*
tim
,
uint8_t
channel
,
mp_obj_t
callback
)
{
...
...
stmhal/uart.c
浏览文件 @
09866754
...
...
@@ -910,29 +910,29 @@ STATIC mp_obj_t pyb_uart_sendbreak(mp_obj_t self_in) {
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
pyb_uart_sendbreak_obj
,
pyb_uart_sendbreak
);
STATIC
const
mp_map_elem_t
pyb_uart_locals_dict_table
[]
=
{
STATIC
const
mp_
rom_
map_elem_t
pyb_uart_locals_dict_table
[]
=
{
// instance methods
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_init
),
(
mp_obj_t
)
&
pyb_uart_init_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_deinit
),
(
mp_obj_t
)
&
pyb_uart_deinit_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_any
),
(
mp_obj_t
)
&
pyb_uart_any_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_init
),
MP_ROM_PTR
(
&
pyb_uart_init_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_deinit
),
MP_ROM_PTR
(
&
pyb_uart_deinit_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_any
),
MP_ROM_PTR
(
&
pyb_uart_any_obj
)
},
/// \method read([nbytes])
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_read
),
(
mp_obj_t
)
&
mp_stream_read_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_read
),
MP_ROM_PTR
(
&
mp_stream_read_obj
)
},
/// \method readline()
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_readline
),
(
mp_obj_t
)
&
mp_stream_unbuffered_readline_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_readline
),
MP_ROM_PTR
(
&
mp_stream_unbuffered_readline_obj
)
},
/// \method readinto(buf[, nbytes])
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_readinto
),
(
mp_obj_t
)
&
mp_stream_readinto_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_readinto
),
MP_ROM_PTR
(
&
mp_stream_readinto_obj
)
},
/// \method write(buf)
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_write
),
(
mp_obj_t
)
&
mp_stream_write_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_write
),
MP_ROM_PTR
(
&
mp_stream_write_obj
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_writechar
),
(
mp_obj_t
)
&
pyb_uart_writechar_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_readchar
),
(
mp_obj_t
)
&
pyb_uart_readchar_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_sendbreak
),
(
mp_obj_t
)
&
pyb_uart_sendbreak_obj
},
{
MP_
ROM_QSTR
(
MP_QSTR_writechar
),
MP_ROM_PTR
(
&
pyb_uart_writechar_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_readchar
),
MP_ROM_PTR
(
&
pyb_uart_readchar_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_sendbreak
),
MP_ROM_PTR
(
&
pyb_uart_sendbreak_obj
)
},
// class constants
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_RTS
),
MP_OBJ_NEW_SMALL
_INT
(
UART_HWCONTROL_RTS
)
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_CTS
),
MP_OBJ_NEW_SMALL
_INT
(
UART_HWCONTROL_CTS
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_RTS
),
MP_ROM
_INT
(
UART_HWCONTROL_RTS
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_CTS
),
MP_ROM
_INT
(
UART_HWCONTROL_CTS
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
pyb_uart_locals_dict
,
pyb_uart_locals_dict_table
);
...
...
@@ -1040,5 +1040,5 @@ const mp_obj_type_t pyb_uart_type = {
.
getiter
=
mp_identity_getiter
,
.
iternext
=
mp_stream_unbuffered_iter
,
.
protocol
=
&
uart_stream_p
,
.
locals_dict
=
(
mp_obj_
t
)
&
pyb_uart_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
pyb_uart_locals_dict
,
};
stmhal/usb.c
浏览文件 @
09866754
...
...
@@ -450,21 +450,21 @@ mp_obj_t pyb_usb_vcp___exit__(mp_uint_t n_args, const mp_obj_t *args) {
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
pyb_usb_vcp___exit___obj
,
4
,
4
,
pyb_usb_vcp___exit__
);
STATIC
const
mp_map_elem_t
pyb_usb_vcp_locals_dict_table
[]
=
{
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_setinterrupt
),
(
mp_obj_t
)
&
pyb_usb_vcp_setinterrupt_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_isconnected
),
(
mp_obj_t
)
&
pyb_usb_vcp_isconnected_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_any
),
(
mp_obj_t
)
&
pyb_usb_vcp_any_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_send
),
(
mp_obj_t
)
&
pyb_usb_vcp_send_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_recv
),
(
mp_obj_t
)
&
pyb_usb_vcp_recv_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_read
),
(
mp_obj_t
)
&
mp_stream_read_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_readinto
),
(
mp_obj_t
)
&
mp_stream_readinto_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_readline
),
(
mp_obj_t
)
&
mp_stream_unbuffered_readline_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_readlines
),
(
mp_obj_t
)
&
mp_stream_unbuffered_readlines_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_write
),
(
mp_obj_t
)
&
mp_stream_write_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_close
),
(
mp_obj_t
)
&
mp_identity_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR___del__
),
(
mp_obj_t
)
&
mp_identity_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR___enter__
),
(
mp_obj_t
)
&
mp_identity_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR___exit__
),
(
mp_obj_t
)
&
pyb_usb_vcp___exit___obj
},
STATIC
const
mp_
rom_
map_elem_t
pyb_usb_vcp_locals_dict_table
[]
=
{
{
MP_
ROM_QSTR
(
MP_QSTR_setinterrupt
),
MP_ROM_PTR
(
&
pyb_usb_vcp_setinterrupt_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_isconnected
),
MP_ROM_PTR
(
&
pyb_usb_vcp_isconnected_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_any
),
MP_ROM_PTR
(
&
pyb_usb_vcp_any_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_send
),
MP_ROM_PTR
(
&
pyb_usb_vcp_send_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_recv
),
MP_ROM_PTR
(
&
pyb_usb_vcp_recv_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_read
),
MP_ROM_PTR
(
&
mp_stream_read_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_readinto
),
MP_ROM_PTR
(
&
mp_stream_readinto_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_readline
),
MP_ROM_PTR
(
&
mp_stream_unbuffered_readline_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_readlines
),
MP_ROM_PTR
(
&
mp_stream_unbuffered_readlines_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_write
),
MP_ROM_PTR
(
&
mp_stream_write_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_close
),
MP_ROM_PTR
(
&
mp_identity_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR___del__
),
MP_ROM_PTR
(
&
mp_identity_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR___enter__
),
MP_ROM_PTR
(
&
mp_identity_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR___exit__
),
MP_ROM_PTR
(
&
pyb_usb_vcp___exit___obj
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
pyb_usb_vcp_locals_dict
,
pyb_usb_vcp_locals_dict_table
);
...
...
@@ -521,7 +521,7 @@ const mp_obj_type_t pyb_usb_vcp_type = {
.
getiter
=
mp_identity_getiter
,
.
iternext
=
mp_stream_unbuffered_iter
,
.
protocol
=
&
pyb_usb_vcp_stream_p
,
.
locals_dict
=
(
mp_obj_
t
)
&
pyb_usb_vcp_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
pyb_usb_vcp_locals_dict
,
};
/******************************************************************************/
...
...
@@ -616,9 +616,9 @@ STATIC mp_obj_t pyb_hid_send_report(mp_obj_t arg) {
}
MP_DEFINE_CONST_FUN_OBJ_1
(
pyb_hid_send_report_obj
,
pyb_hid_send_report
);
STATIC
const
mp_map_elem_t
pyb_usb_hid_locals_dict_table
[]
=
{
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_send
),
(
mp_obj_t
)
&
pyb_usb_hid_send_obj
},
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_recv
),
(
mp_obj_t
)
&
pyb_usb_hid_recv_obj
},
STATIC
const
mp_
rom_
map_elem_t
pyb_usb_hid_locals_dict_table
[]
=
{
{
MP_
ROM_QSTR
(
MP_QSTR_send
),
MP_ROM_PTR
(
&
pyb_usb_hid_send_obj
)
},
{
MP_
ROM_QSTR
(
MP_QSTR_recv
),
MP_ROM_PTR
(
&
pyb_usb_hid_recv_obj
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
pyb_usb_hid_locals_dict
,
pyb_usb_hid_locals_dict_table
);
...
...
@@ -650,7 +650,7 @@ const mp_obj_type_t pyb_usb_hid_type = {
.
name
=
MP_QSTR_USB_HID
,
.
make_new
=
pyb_usb_hid_make_new
,
.
protocol
=
&
pyb_usb_hid_stream_p
,
.
locals_dict
=
(
mp_obj_
t
)
&
pyb_usb_hid_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
pyb_usb_hid_locals_dict
,
};
/******************************************************************************/
...
...
stmhal/usrsw.c
浏览文件 @
09866754
...
...
@@ -122,8 +122,8 @@ mp_obj_t pyb_switch_callback(mp_obj_t self_in, mp_obj_t callback) {
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_2
(
pyb_switch_callback_obj
,
pyb_switch_callback
);
STATIC
const
mp_map_elem_t
pyb_switch_locals_dict_table
[]
=
{
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_callback
),
(
mp_obj_t
)
&
pyb_switch_callback_obj
},
STATIC
const
mp_
rom_
map_elem_t
pyb_switch_locals_dict_table
[]
=
{
{
MP_
ROM_QSTR
(
MP_QSTR_callback
),
MP_ROM_PTR
(
&
pyb_switch_callback_obj
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
pyb_switch_locals_dict
,
pyb_switch_locals_dict_table
);
...
...
@@ -134,7 +134,7 @@ const mp_obj_type_t pyb_switch_type = {
.
print
=
pyb_switch_print
,
.
make_new
=
pyb_switch_make_new
,
.
call
=
pyb_switch_call
,
.
locals_dict
=
(
mp_obj_
t
)
&
pyb_switch_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
pyb_switch_locals_dict
,
};
#endif // MICROPY_HW_HAS_SWITCH
stmhal/wdt.c
浏览文件 @
09866754
...
...
@@ -94,8 +94,8 @@ STATIC mp_obj_t pyb_wdt_feed(mp_obj_t self_in) {
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
pyb_wdt_feed_obj
,
pyb_wdt_feed
);
STATIC
const
mp_map_elem_t
pyb_wdt_locals_dict_table
[]
=
{
{
MP_
OBJ_NEW_QSTR
(
MP_QSTR_feed
),
(
mp_obj_t
)
&
pyb_wdt_feed_obj
},
STATIC
const
mp_
rom_
map_elem_t
pyb_wdt_locals_dict_table
[]
=
{
{
MP_
ROM_QSTR
(
MP_QSTR_feed
),
MP_ROM_PTR
(
&
pyb_wdt_feed_obj
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
pyb_wdt_locals_dict
,
pyb_wdt_locals_dict_table
);
...
...
@@ -104,5 +104,5 @@ const mp_obj_type_t pyb_wdt_type = {
{
&
mp_type_type
},
.
name
=
MP_QSTR_WDT
,
.
make_new
=
pyb_wdt_make_new
,
.
locals_dict
=
(
mp_obj_
t
)
&
pyb_wdt_locals_dict
,
.
locals_dict
=
(
mp_obj_
dict_t
*
)
&
pyb_wdt_locals_dict
,
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录