summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/usrsw.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-03-30 12:30:35 +0100
committerDamien George <damien.p.george@gmail.com>2014-03-30 12:30:35 +0100
commit09d207785c77c85c957471b064ceebe0d2ee0a23 (patch)
tree6c34e11ee61c820c807db06d3d3cd69611c13ddb /stmhal/usrsw.c
parent24a140a444cfb2ebda7f0b6d0a88be9461a99d03 (diff)
downloadmicropython-09d207785c77c85c957471b064ceebe0d2ee0a23.tar.gz
micropython-09d207785c77c85c957471b064ceebe0d2ee0a23.zip
stmhal: Unify naming of HW config; make SD detect configurable.
All board config macros now begin with MICROPY_HW_. Renamed PYBv10 to PYBV10, since macros should be all uppercase. Made SDCARD_DETECT configurable in mpconfigport.h, so that the SD detect pin can be easily configured.
Diffstat (limited to 'stmhal/usrsw.c')
-rw-r--r--stmhal/usrsw.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/stmhal/usrsw.c b/stmhal/usrsw.c
index 60032c4ecb..038fbf9efb 100644
--- a/stmhal/usrsw.c
+++ b/stmhal/usrsw.c
@@ -42,26 +42,26 @@ static MP_DEFINE_CONST_FUN_OBJ_1(switch_callback_obj, switch_callback);
// this function inits the switch GPIO so that it can be used
void switch_init0(void) {
GPIO_InitTypeDef init;
- init.Pin = USRSW_PIN.pin_mask;
+ init.Pin = MICROPY_HW_USRSW_PIN.pin_mask;
init.Mode = GPIO_MODE_INPUT;
- init.Pull = USRSW_PULL;
+ init.Pull = MICROPY_HW_USRSW_PULL;
init.Speed = GPIO_SPEED_FAST;
- HAL_GPIO_Init(USRSW_PIN.gpio, &init);
+ HAL_GPIO_Init(MICROPY_HW_USRSW_PIN.gpio, &init);
}
// this function inits the callback and EXTI function of the switch
void switch_init(void) {
switch_user_callback_obj = mp_const_none;
- exti_register((mp_obj_t)&USRSW_PIN,
- MP_OBJ_NEW_SMALL_INT(USRSW_EXTI_MODE),
- MP_OBJ_NEW_SMALL_INT(USRSW_PULL),
+ exti_register((mp_obj_t)&MICROPY_HW_USRSW_PIN,
+ MP_OBJ_NEW_SMALL_INT(MICROPY_HW_USRSW_EXTI_MODE),
+ MP_OBJ_NEW_SMALL_INT(MICROPY_HW_USRSW_PULL),
(mp_obj_t)&switch_callback_obj,
NULL);
}
int switch_get(void) {
- int val = ((USRSW_PIN.gpio->IDR & USRSW_PIN.pin_mask) != 0);
- return val == USRSW_PRESSED;
+ int val = ((MICROPY_HW_USRSW_PIN.gpio->IDR & MICROPY_HW_USRSW_PIN.pin_mask) != 0);
+ return val == MICROPY_HW_USRSW_PRESSED;
}
/******************************************************************************/