Development mbed library for MAX32630FTHR

Dependents:   blinky_max32630fthr

Committer:
switches
Date:
Fri Dec 16 16:27:57 2016 +0000
Revision:
3:1198227e6421
Parent:
0:5c4d7b2438d3
Changed ADC scale for MAX32625 platforms to 1.2V full scale to match MAX32630 platforms

Who changed what in which revision?

UserRevisionLine numberNew contents of line
switches 0:5c4d7b2438d3 1 /* mbed Microcontroller Library
switches 0:5c4d7b2438d3 2 * Copyright (c) 2006-2012 ARM Limited
switches 0:5c4d7b2438d3 3 *
switches 0:5c4d7b2438d3 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
switches 0:5c4d7b2438d3 5 * of this software and associated documentation files (the "Software"), to deal
switches 0:5c4d7b2438d3 6 * in the Software without restriction, including without limitation the rights
switches 0:5c4d7b2438d3 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
switches 0:5c4d7b2438d3 8 * copies of the Software, and to permit persons to whom the Software is
switches 0:5c4d7b2438d3 9 * furnished to do so, subject to the following conditions:
switches 0:5c4d7b2438d3 10 *
switches 0:5c4d7b2438d3 11 * The above copyright notice and this permission notice shall be included in
switches 0:5c4d7b2438d3 12 * all copies or substantial portions of the Software.
switches 0:5c4d7b2438d3 13 *
switches 0:5c4d7b2438d3 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
switches 0:5c4d7b2438d3 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
switches 0:5c4d7b2438d3 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
switches 0:5c4d7b2438d3 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
switches 0:5c4d7b2438d3 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
switches 0:5c4d7b2438d3 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
switches 0:5c4d7b2438d3 20 * SOFTWARE.
switches 0:5c4d7b2438d3 21 */
switches 0:5c4d7b2438d3 22 #ifndef RTOS_TIMER_H
switches 0:5c4d7b2438d3 23 #define RTOS_TIMER_H
switches 0:5c4d7b2438d3 24
switches 0:5c4d7b2438d3 25 #include <stdint.h>
switches 0:5c4d7b2438d3 26 #include "cmsis_os.h"
switches 0:5c4d7b2438d3 27 #include "platform/Callback.h"
switches 0:5c4d7b2438d3 28 #include "platform/toolchain.h"
switches 0:5c4d7b2438d3 29
switches 0:5c4d7b2438d3 30 namespace rtos {
switches 0:5c4d7b2438d3 31 /** \addtogroup rtos */
switches 0:5c4d7b2438d3 32 /** @{*/
switches 0:5c4d7b2438d3 33
switches 0:5c4d7b2438d3 34 /** The RtosTimer class allow creating and and controlling of timer functions in the system.
switches 0:5c4d7b2438d3 35 A timer function is called when a time period expires whereby both on-shot and
switches 0:5c4d7b2438d3 36 periodic timers are possible. A timer can be started, restarted, or stopped.
switches 0:5c4d7b2438d3 37
switches 0:5c4d7b2438d3 38 Timers are handled in the thread osTimerThread.
switches 0:5c4d7b2438d3 39 Callback functions run under control of this thread and may use CMSIS-RTOS API calls.
switches 0:5c4d7b2438d3 40 */
switches 0:5c4d7b2438d3 41 class RtosTimer {
switches 0:5c4d7b2438d3 42 public:
switches 0:5c4d7b2438d3 43 /** Create timer.
switches 0:5c4d7b2438d3 44 @param func function to be executed by this timer.
switches 0:5c4d7b2438d3 45 @param type osTimerOnce for one-shot or osTimerPeriodic for periodic behaviour. (default: osTimerPeriodic)
switches 0:5c4d7b2438d3 46 @param argument argument to the timer call back function. (default: NULL)
switches 0:5c4d7b2438d3 47 @deprecated Replaced with RtosTimer(Callback<void()>, os_timer_type)
switches 0:5c4d7b2438d3 48 */
switches 0:5c4d7b2438d3 49 MBED_DEPRECATED_SINCE("mbed-os-5.1",
switches 0:5c4d7b2438d3 50 "Replaced with RtosTimer(Callback<void()>, os_timer_type)")
switches 0:5c4d7b2438d3 51 RtosTimer(void (*func)(void const *argument), os_timer_type type=osTimerPeriodic, void *argument=NULL) {
switches 0:5c4d7b2438d3 52 constructor(mbed::callback((void (*)(void *))func, argument), type);
switches 0:5c4d7b2438d3 53 }
switches 0:5c4d7b2438d3 54
switches 0:5c4d7b2438d3 55 /** Create timer.
switches 0:5c4d7b2438d3 56 @param func function to be executed by this timer.
switches 0:5c4d7b2438d3 57 @param type osTimerOnce for one-shot or osTimerPeriodic for periodic behaviour. (default: osTimerPeriodic)
switches 0:5c4d7b2438d3 58 */
switches 0:5c4d7b2438d3 59 RtosTimer(mbed::Callback<void()> func, os_timer_type type=osTimerPeriodic) {
switches 0:5c4d7b2438d3 60 constructor(func, type);
switches 0:5c4d7b2438d3 61 }
switches 0:5c4d7b2438d3 62
switches 0:5c4d7b2438d3 63 /** Create timer.
switches 0:5c4d7b2438d3 64 @param obj pointer to the object to call the member function on.
switches 0:5c4d7b2438d3 65 @param method member function to be executed by this timer.
switches 0:5c4d7b2438d3 66 @param type osTimerOnce for one-shot or osTimerPeriodic for periodic behaviour. (default: osTimerPeriodic)
switches 0:5c4d7b2438d3 67 @deprecated
switches 0:5c4d7b2438d3 68 The RtosTimer constructor does not support cv-qualifiers. Replaced by
switches 0:5c4d7b2438d3 69 RtosTimer(callback(obj, method), os_timer_type).
switches 0:5c4d7b2438d3 70 */
switches 0:5c4d7b2438d3 71 template <typename T, typename M>
switches 0:5c4d7b2438d3 72 MBED_DEPRECATED_SINCE("mbed-os-5.1",
switches 0:5c4d7b2438d3 73 "The RtosTimer constructor does not support cv-qualifiers. Replaced by "
switches 0:5c4d7b2438d3 74 "RtosTimer(callback(obj, method), os_timer_type).")
switches 0:5c4d7b2438d3 75 RtosTimer(T *obj, M method, os_timer_type type=osTimerPeriodic) {
switches 0:5c4d7b2438d3 76 constructor(mbed::callback(obj, method), type);
switches 0:5c4d7b2438d3 77 }
switches 0:5c4d7b2438d3 78
switches 0:5c4d7b2438d3 79 /** Stop the timer.
switches 0:5c4d7b2438d3 80 @return status code that indicates the execution status of the function.
switches 0:5c4d7b2438d3 81 */
switches 0:5c4d7b2438d3 82 osStatus stop(void);
switches 0:5c4d7b2438d3 83
switches 0:5c4d7b2438d3 84 /** Start the timer.
switches 0:5c4d7b2438d3 85 @param millisec time delay value of the timer.
switches 0:5c4d7b2438d3 86 @return status code that indicates the execution status of the function.
switches 0:5c4d7b2438d3 87 */
switches 0:5c4d7b2438d3 88 osStatus start(uint32_t millisec);
switches 0:5c4d7b2438d3 89
switches 0:5c4d7b2438d3 90 ~RtosTimer();
switches 0:5c4d7b2438d3 91
switches 0:5c4d7b2438d3 92 private:
switches 0:5c4d7b2438d3 93 // Required to share definitions without
switches 0:5c4d7b2438d3 94 // delegated constructors
switches 0:5c4d7b2438d3 95 void constructor(mbed::Callback<void()> func, os_timer_type type);
switches 0:5c4d7b2438d3 96
switches 0:5c4d7b2438d3 97 mbed::Callback<void()> _function;
switches 0:5c4d7b2438d3 98 osTimerId _timer_id;
switches 0:5c4d7b2438d3 99 osTimerDef_t _timer;
switches 0:5c4d7b2438d3 100 #if defined(CMSIS_OS_RTX) && !defined(__MBED_CMSIS_RTOS_CM)
switches 0:5c4d7b2438d3 101 uint32_t _timer_data[5];
switches 0:5c4d7b2438d3 102 #else
switches 0:5c4d7b2438d3 103 uint32_t _timer_data[6];
switches 0:5c4d7b2438d3 104 #endif
switches 0:5c4d7b2438d3 105 };
switches 0:5c4d7b2438d3 106
switches 0:5c4d7b2438d3 107 }
switches 0:5c4d7b2438d3 108
switches 0:5c4d7b2438d3 109 #endif
switches 0:5c4d7b2438d3 110
switches 0:5c4d7b2438d3 111 /** @}*/