diff options
| author | Daniel Campora | 2015-06-06 18:42:51 +0200 |
|---|---|---|
| committer | Daniel Campora | 2015-06-07 00:06:27 +0200 |
| commit | a3acaa000c0835c0b4e8c3f488071b0ff2caa58b (patch) | |
| tree | 99b09a92ffbfaa46ce91c5cb16c5d0f8800339e7 /cc3200/misc | |
| parent | 098f5ae2216668e370468d3c6f4a663b94f767e0 (diff) | |
cc3200: Add antenna selection feature to WLAN.
Diffstat (limited to 'cc3200/misc')
| -rw-r--r-- | cc3200/misc/mperror.c | 23 | ||||
| -rw-r--r-- | cc3200/misc/mperror.h | 2 |
2 files changed, 9 insertions, 16 deletions
diff --git a/cc3200/misc/mperror.c b/cc3200/misc/mperror.c index 7f5964daf..ca729b2a2 100644 --- a/cc3200/misc/mperror.c +++ b/cc3200/misc/mperror.c @@ -91,6 +91,7 @@ void mperror_init0 (void) { // configure the system led pin_config ((pin_obj_t *)&MICROPY_SYS_LED_GPIO, PIN_MODE_0, GPIO_DIR_MODE_OUT, PIN_TYPE_STD, PIN_STRENGTH_6MA); #endif + mperror_heart_beat.enabled = true; mperror_heartbeat_switch_off(); } @@ -132,25 +133,19 @@ void mperror_signal_error (void) { } } -void mperror_enable_heartbeat (void) { - mperror_heart_beat.enabled = true; -} - void mperror_heartbeat_switch_off (void) { - mperror_heart_beat.on_time = 0; - mperror_heart_beat.off_time = 0; - MAP_GPIOPinWrite(MICROPY_SYS_LED_PORT, MICROPY_SYS_LED_PORT_PIN, 0); -} - -void mperror_disable_heartbeat (void) { - mperror_heart_beat.do_disable = true; + if (mperror_heart_beat.enabled) { + mperror_heart_beat.on_time = 0; + mperror_heart_beat.off_time = 0; + MAP_GPIOPinWrite(MICROPY_SYS_LED_PORT, MICROPY_SYS_LED_PORT_PIN, 0); + } } void mperror_heartbeat_signal (void) { if (mperror_heart_beat.do_disable) { - mperror_heart_beat.enabled = false; mperror_heart_beat.do_disable = false; mperror_heartbeat_switch_off(); + mperror_heart_beat.enabled = false; } else if (mperror_heart_beat.enabled) { if (!mperror_heart_beat.beating) { @@ -206,7 +201,7 @@ void nlr_jump_fail(void *val) { /// \function enable() /// Enables the heartbeat signal STATIC mp_obj_t pyb_enable_heartbeat(mp_obj_t self) { - mperror_enable_heartbeat (); + mperror_heart_beat.enabled = true; return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_enable_heartbeat_obj, pyb_enable_heartbeat); @@ -214,7 +209,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_enable_heartbeat_obj, pyb_enable_heartbeat) /// \function disable() /// Disables the heartbeat signal STATIC mp_obj_t pyb_disable_heartbeat(mp_obj_t self) { - mperror_disable_heartbeat (); + mperror_heart_beat.do_disable = true; return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_disable_heartbeat_obj, pyb_disable_heartbeat); diff --git a/cc3200/misc/mperror.h b/cc3200/misc/mperror.h index 2c443f449..7f0a634d8 100644 --- a/cc3200/misc/mperror.h +++ b/cc3200/misc/mperror.h @@ -38,9 +38,7 @@ void mperror_init0 (void); void mperror_bootloader_check_reset_cause (void); void mperror_deinit_sfe_pin (void); void mperror_signal_error (void); -void mperror_enable_heartbeat (void); void mperror_heartbeat_switch_off (void); -void mperror_disable_heartbeat (void); void mperror_heartbeat_signal (void); #endif // MPERROR_H_ |
