aboutsummaryrefslogtreecommitdiff
path: root/stmhal/mpconfigport.h
diff options
context:
space:
mode:
authorDamien George2014-04-10 22:46:40 +0100
committerDamien George2014-04-10 22:46:40 +0100
commit3f4898456bb1a451e5e6d45cb62c9c718f2b8a76 (patch)
tree2b1208d70e5bf052988e8e550ac0fff594e4654d /stmhal/mpconfigport.h
parent57e99ebc868aeaae3b0f826beef7f82c01e56405 (diff)
stmhal: Add stm module, which contains some constants for the MCU.
Also contains raw memory read/write functions, read8, read16, read32, write8, write16, write32. Can now do: stm.write16(stm.GPIOA + stm.GPIO_BSRRL, 1 << 13) This turns on the red LED. With the new constant folding, the above constants for the GPIO address are actually compiled to constants (and the addition done) at compile time. For viper code and inline assembler, this optimisation will make a big difference. In the inline assembler, using these constants would not be possible without this constant folding.
Diffstat (limited to 'stmhal/mpconfigport.h')
-rw-r--r--stmhal/mpconfigport.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h
index 08ba923e4..552910142 100644
--- a/stmhal/mpconfigport.h
+++ b/stmhal/mpconfigport.h
@@ -31,12 +31,19 @@ extern const struct _mp_obj_fun_native_t mp_builtin_open_obj;
// extra built in modules to add to the list of known ones
extern const struct _mp_obj_module_t os_module;
extern const struct _mp_obj_module_t pyb_module;
+extern const struct _mp_obj_module_t stm_module;
extern const struct _mp_obj_module_t time_module;
#define MICROPY_EXTRA_BUILTIN_MODULES \
{ MP_OBJ_NEW_QSTR(MP_QSTR_os), (mp_obj_t)&os_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_pyb), (mp_obj_t)&pyb_module }, \
+ { MP_OBJ_NEW_QSTR(MP_QSTR_stm), (mp_obj_t)&stm_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&time_module }, \
+// extra constants
+#define MICROPY_EXTRA_CONSTANTS \
+ { MP_OBJ_NEW_QSTR(MP_QSTR_pyb), (mp_obj_t)&pyb_module }, \
+ { MP_OBJ_NEW_QSTR(MP_QSTR_stm), (mp_obj_t)&stm_module }, \
+
// type definitions for the specific machine
#define BYTES_PER_WORD (4)