summaryrefslogtreecommitdiff
path: root/cc3200/misc
diff options
context:
space:
mode:
Diffstat (limited to 'cc3200/misc')
-rw-r--r--cc3200/misc/help.c19
-rw-r--r--cc3200/misc/mpexception.c3
-rw-r--r--cc3200/misc/mpexception.h3
-rw-r--r--cc3200/misc/mpirq.c2
-rw-r--r--cc3200/misc/mpsystick.c71
-rw-r--r--cc3200/misc/mpsystick.h35
6 files changed, 3 insertions, 130 deletions
diff --git a/cc3200/misc/help.c b/cc3200/misc/help.c
index 4601818bd..cce515898 100644
--- a/cc3200/misc/help.c
+++ b/cc3200/misc/help.c
@@ -25,23 +25,8 @@
* THE SOFTWARE.
*/
-#include <stdio.h>
+#include "py/builtin.h"
-#include "lib/utils/pyhelp.h"
-
-STATIC const char help_text[] = "Welcome to MicroPython!\n"
+const char *cc3200_help_text = "Welcome to MicroPython!\n"
"For online help please visit http://micropython.org/help/.\n"
"For further help on a specific object, type help(obj)\n";
-
-STATIC mp_obj_t pyb_help(uint n_args, const mp_obj_t *args) {
- if (n_args == 0) {
- // print a general help message
- printf("%s", help_text);
- }
- else {
- // try to print something sensible about the given object
- pyhelp_print_obj(args[0]);
- }
- return mp_const_none;
-}
-MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_help_obj, 0, 1, pyb_help);
diff --git a/cc3200/misc/mpexception.c b/cc3200/misc/mpexception.c
index c45f0244b..068adb70b 100644
--- a/cc3200/misc/mpexception.c
+++ b/cc3200/misc/mpexception.c
@@ -40,9 +40,6 @@ STATIC void mpexception_set_user_interrupt (int chr, void *data);
/******************************************************************************
DECLARE EXPORTED DATA
******************************************************************************/
-const char mpexception_os_resource_not_avaliable[] = "resource not available";
-const char mpexception_os_operation_failed[] = "the requested operation failed";
-const char mpexception_os_request_not_possible[] = "the requested operation is not possible";
const char mpexception_value_invalid_arguments[] = "invalid argument(s) value";
const char mpexception_num_type_invalid_arguments[] = "invalid argument(s) num/type";
const char mpexception_uncaught[] = "uncaught exception";
diff --git a/cc3200/misc/mpexception.h b/cc3200/misc/mpexception.h
index f55aa739e..2f9d1877c 100644
--- a/cc3200/misc/mpexception.h
+++ b/cc3200/misc/mpexception.h
@@ -28,9 +28,6 @@
#ifndef MPEXCEPTION_H_
#define MPEXCEPTION_H_
-extern const char mpexception_os_resource_not_avaliable[];
-extern const char mpexception_os_operation_failed[];
-extern const char mpexception_os_request_not_possible[];
extern const char mpexception_value_invalid_arguments[];
extern const char mpexception_num_type_invalid_arguments[];
extern const char mpexception_uncaught[];
diff --git a/cc3200/misc/mpirq.c b/cc3200/misc/mpirq.c
index be5746759..37149089f 100644
--- a/cc3200/misc/mpirq.c
+++ b/cc3200/misc/mpirq.c
@@ -24,7 +24,7 @@
* THE SOFTWARE.
*/
-#include "std.h"
+#include <stdio.h>
#include "py/mpconfig.h"
#include "py/obj.h"
diff --git a/cc3200/misc/mpsystick.c b/cc3200/misc/mpsystick.c
deleted file mode 100644
index 7c35354e1..000000000
--- a/cc3200/misc/mpsystick.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * This file is part of the Micro Python project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2013, 2014 Damien P. George
- * Copyright (c) 2015 Daniel Campora
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include "py/mpconfig.h"
-#include "py/obj.h"
-#include "py/mphal.h"
-#include "mpsystick.h"
-#include "systick.h"
-#include "inc/hw_types.h"
-#include "inc/hw_nvic.h"
-
-#ifdef USE_FREERTOS
-#include "FreeRTOS.h"
-#include "task.h"
-#endif
-
-
-bool sys_tick_has_passed(uint32_t start_tick, uint32_t delay_ms) {
- return mp_hal_ticks_ms() - start_tick >= delay_ms;
-}
-
-// waits until at least delay_ms milliseconds have passed from the sampling of
-// startTick. Handles overflow properly. Assumes stc was taken from
-// mp_hal_ticks_ms() some time before calling this function.
-void sys_tick_wait_at_least(uint32_t start_tick, uint32_t delay_ms) {
-#ifdef USE_FREERTOS
- vTaskDelay (delay_ms / portTICK_PERIOD_MS);
-#else
- while (!sys_tick_has_passed(start_tick, delay_ms)) {
- __WFI(); // enter sleep mode, waiting for interrupt
- }
-#endif
-}
-
-// The SysTick timer counts down at HAL_FCPU_HZ, so we can use that knowledge
-// to grab a microsecond counter.
-// We assume that mp_hal_ticks_ms returns milliseconds.
-uint32_t sys_tick_get_microseconds(void) {
- mp_uint_t irq_state = disable_irq();
- uint32_t counter = SysTickValueGet();
- uint32_t milliseconds = mp_hal_ticks_ms();
- enable_irq(irq_state);
-
- uint32_t load = SysTickPeriodGet();
- counter = load - counter; // Convert from decrementing to incrementing
- return (milliseconds * 1000) + ((counter * 1000) / load);
-}
diff --git a/cc3200/misc/mpsystick.h b/cc3200/misc/mpsystick.h
deleted file mode 100644
index d7ad59461..000000000
--- a/cc3200/misc/mpsystick.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * This file is part of the Micro Python project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2013, 2014 Damien P. George
- * Copyright (c) 2015 Daniel Campora
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#ifndef MPSYSTICK_H
-#define MPSYSTICK_H
-
-void sys_tick_wait_at_least(uint32_t stc, uint32_t delay_ms);
-bool sys_tick_has_passed(uint32_t stc, uint32_t delay_ms);
-uint32_t sys_tick_get_microseconds(void);
-
-#endif // MPSYSTICK_H