aboutsummaryrefslogtreecommitdiff
path: root/stmhal
diff options
context:
space:
mode:
authorDamien George2016-10-18 11:06:20 +1100
committerDamien George2016-10-21 16:26:01 +1100
commit4ebdb1f2b217410cdc1cee0e0c0da8fceb7627f2 (patch)
treed6188cf8f6579ffa66b8370032b8184a901a5312 /stmhal
parent5d0735b93a52ff7f2f41dd27f3a22ca847f6b49b (diff)
py: Be more specific with MP_DECLARE_CONST_FUN_OBJ macros.
In order to have more fine-grained control over how builtin functions are constructed, the MP_DECLARE_CONST_FUN_OBJ macros are made more specific, with suffix of _0, _1, _2, _3, _VAR, _VAR_BETEEN or _KW. These names now match the MP_DEFINE_CONST_FUN_OBJ macros.
Diffstat (limited to 'stmhal')
-rw-r--r--stmhal/irq.h8
-rw-r--r--stmhal/modmachine.h14
-rw-r--r--stmhal/modpyb.c2
-rw-r--r--stmhal/pin.h2
-rw-r--r--stmhal/portmodules.h8
-rw-r--r--stmhal/rng.h2
-rw-r--r--stmhal/servo.h4
-rw-r--r--stmhal/usb.h6
8 files changed, 23 insertions, 23 deletions
diff --git a/stmhal/irq.h b/stmhal/irq.h
index 5a08a7d50..bb1749e03 100644
--- a/stmhal/irq.h
+++ b/stmhal/irq.h
@@ -70,10 +70,10 @@ static inline void restore_irq_pri(uint32_t basepri) {
#endif
-MP_DECLARE_CONST_FUN_OBJ(pyb_wfi_obj);
-MP_DECLARE_CONST_FUN_OBJ(pyb_disable_irq_obj);
-MP_DECLARE_CONST_FUN_OBJ(pyb_enable_irq_obj);
-MP_DECLARE_CONST_FUN_OBJ(pyb_irq_stats_obj);
+MP_DECLARE_CONST_FUN_OBJ_0(pyb_wfi_obj);
+MP_DECLARE_CONST_FUN_OBJ_0(pyb_disable_irq_obj);
+MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_enable_irq_obj);
+MP_DECLARE_CONST_FUN_OBJ_0(pyb_irq_stats_obj);
// IRQ priority definitions.
//
diff --git a/stmhal/modmachine.h b/stmhal/modmachine.h
index 042afb850..164c5cfda 100644
--- a/stmhal/modmachine.h
+++ b/stmhal/modmachine.h
@@ -33,12 +33,12 @@
void machine_init(void);
-MP_DECLARE_CONST_FUN_OBJ(machine_info_obj);
-MP_DECLARE_CONST_FUN_OBJ(machine_unique_id_obj);
-MP_DECLARE_CONST_FUN_OBJ(machine_reset_obj);
-MP_DECLARE_CONST_FUN_OBJ(machine_bootloader_obj);
-MP_DECLARE_CONST_FUN_OBJ(machine_freq_obj);
-MP_DECLARE_CONST_FUN_OBJ(machine_sleep_obj);
-MP_DECLARE_CONST_FUN_OBJ(machine_deepsleep_obj);
+MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(machine_info_obj);
+MP_DECLARE_CONST_FUN_OBJ_0(machine_unique_id_obj);
+MP_DECLARE_CONST_FUN_OBJ_0(machine_reset_obj);
+MP_DECLARE_CONST_FUN_OBJ_0(machine_bootloader_obj);
+MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(machine_freq_obj);
+MP_DECLARE_CONST_FUN_OBJ_0(machine_sleep_obj);
+MP_DECLARE_CONST_FUN_OBJ_0(machine_deepsleep_obj);
#endif // __MICROPY_INCLUDED_STMHAL_MODMACHINE_H__
diff --git a/stmhal/modpyb.c b/stmhal/modpyb.c
index 5b2bf7aa9..e602234fc 100644
--- a/stmhal/modpyb.c
+++ b/stmhal/modpyb.c
@@ -126,7 +126,7 @@ STATIC mp_obj_t pyb_elapsed_micros(mp_obj_t start) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_elapsed_micros_obj, pyb_elapsed_micros);
-MP_DECLARE_CONST_FUN_OBJ(pyb_main_obj); // defined in main.c
+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) },
diff --git a/stmhal/pin.h b/stmhal/pin.h
index df7df0ce2..a11b0a0f8 100644
--- a/stmhal/pin.h
+++ b/stmhal/pin.h
@@ -86,7 +86,7 @@ extern const mp_obj_type_t pin_cpu_pins_obj_type;
extern const mp_obj_dict_t pin_cpu_pins_locals_dict;
extern const mp_obj_dict_t pin_board_pins_locals_dict;
-MP_DECLARE_CONST_FUN_OBJ(pin_init_obj);
+MP_DECLARE_CONST_FUN_OBJ_KW(pin_init_obj);
void pin_init0(void);
uint32_t pin_get_mode(const pin_obj_t *pin);
diff --git a/stmhal/portmodules.h b/stmhal/portmodules.h
index 68ae2f47c..173d53cc6 100644
--- a/stmhal/portmodules.h
+++ b/stmhal/portmodules.h
@@ -33,8 +33,8 @@ extern const mp_obj_module_t mp_module_usocket;
// additional helper functions exported by the modules
-MP_DECLARE_CONST_FUN_OBJ(time_sleep_ms_obj);
-MP_DECLARE_CONST_FUN_OBJ(time_sleep_us_obj);
+MP_DECLARE_CONST_FUN_OBJ_1(time_sleep_ms_obj);
+MP_DECLARE_CONST_FUN_OBJ_1(time_sleep_us_obj);
-MP_DECLARE_CONST_FUN_OBJ(mod_os_sync_obj);
-MP_DECLARE_CONST_FUN_OBJ(mod_os_dupterm_obj);
+MP_DECLARE_CONST_FUN_OBJ_0(mod_os_sync_obj);
+MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mod_os_dupterm_obj);
diff --git a/stmhal/rng.h b/stmhal/rng.h
index f1e5054ad..ce1833e80 100644
--- a/stmhal/rng.h
+++ b/stmhal/rng.h
@@ -27,4 +27,4 @@
void rng_init0(void);
uint32_t rng_get(void);
-MP_DECLARE_CONST_FUN_OBJ(pyb_rng_get_obj);
+MP_DECLARE_CONST_FUN_OBJ_0(pyb_rng_get_obj);
diff --git a/stmhal/servo.h b/stmhal/servo.h
index 121ce922d..0fca8fea1 100644
--- a/stmhal/servo.h
+++ b/stmhal/servo.h
@@ -29,5 +29,5 @@ void servo_timer_irq_callback(void);
extern const mp_obj_type_t pyb_servo_type;
-MP_DECLARE_CONST_FUN_OBJ(pyb_servo_set_obj);
-MP_DECLARE_CONST_FUN_OBJ(pyb_pwm_set_obj);
+MP_DECLARE_CONST_FUN_OBJ_2(pyb_servo_set_obj);
+MP_DECLARE_CONST_FUN_OBJ_2(pyb_pwm_set_obj);
diff --git a/stmhal/usb.h b/stmhal/usb.h
index debb4aa7c..e153f0c6b 100644
--- a/stmhal/usb.h
+++ b/stmhal/usb.h
@@ -53,9 +53,9 @@ extern const struct _mp_obj_tuple_t pyb_usb_hid_mouse_obj;
extern const struct _mp_obj_tuple_t pyb_usb_hid_keyboard_obj;
extern const mp_obj_type_t pyb_usb_vcp_type;
extern const mp_obj_type_t pyb_usb_hid_type;
-MP_DECLARE_CONST_FUN_OBJ(pyb_usb_mode_obj);
-MP_DECLARE_CONST_FUN_OBJ(pyb_have_cdc_obj); // deprecated
-MP_DECLARE_CONST_FUN_OBJ(pyb_hid_send_report_obj); // deprecated
+MP_DECLARE_CONST_FUN_OBJ_KW(pyb_usb_mode_obj);
+MP_DECLARE_CONST_FUN_OBJ_0(pyb_have_cdc_obj); // deprecated
+MP_DECLARE_CONST_FUN_OBJ_1(pyb_hid_send_report_obj); // deprecated
void pyb_usb_init0(void);
bool pyb_usb_dev_init(uint16_t vid, uint16_t pid, usb_device_mode_t mode, USBD_HID_ModeInfoTypeDef *hid_info);