summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/can.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-05-27 16:51:04 +0100
committerDamien George <damien.p.george@gmail.com>2015-05-27 16:51:04 +0100
commit1775b65e07fae808dc50f9cee2005608cd3a26de (patch)
tree128a45e0be3e09165980c94bfe3614309123077b /stmhal/can.c
parent9ae3fc65235303322ef5282d3cdd4ca99a2c37cc (diff)
downloadmicropython-1775b65e07fae808dc50f9cee2005608cd3a26de.tar.gz
micropython-1775b65e07fae808dc50f9cee2005608cd3a26de.zip
stmhal: Remove PYBVxx defines and use config vars for UART/CAN names.
Now all stmhal-based boards can name their peripherals (if they want) to any string.
Diffstat (limited to 'stmhal/can.c')
-rw-r--r--stmhal/can.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/stmhal/can.c b/stmhal/can.c
index f4758399ce..18fd31eeb6 100644
--- a/stmhal/can.c
+++ b/stmhal/can.c
@@ -352,11 +352,13 @@ STATIC mp_obj_t pyb_can_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n
if (MP_OBJ_IS_STR(args[0])) {
const char *port = mp_obj_str_get_str(args[0]);
if (0) {
- #if defined(PYBV10)
- } else if (strcmp(port, "YA") == 0) {
- o->can_id = PYB_CAN_YA;
- } else if (strcmp(port, "YB") == 0) {
- o->can_id = PYB_CAN_YB;
+ #ifdef MICROPY_HW_CAN1_NAME
+ } else if (strcmp(port, MICROPY_HW_CAN1_NAME) == 0) {
+ o->can_id = PYB_CAN_1;
+ #endif
+ #ifdef MICROPY_HW_CAN2_NAME
+ } else if (strcmp(port, MICROPY_HW_CAN2_NAME) == 0) {
+ o->can_id = PYB_CAN_2;
#endif
} else {
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "CAN port %s does not exist", port));