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
switches 0:5c4d7b2438d3 23 #include "rtos/rtos_idle.h"
switches 0:5c4d7b2438d3 24
switches 0:5c4d7b2438d3 25 static void default_idle_hook(void)
switches 0:5c4d7b2438d3 26 {
switches 0:5c4d7b2438d3 27 /* Sleep: ideally, we should put the chip to sleep.
switches 0:5c4d7b2438d3 28 Unfortunately, this usually requires disconnecting the interface chip (debugger).
switches 0:5c4d7b2438d3 29 This can be done, but it would break the local file system.
switches 0:5c4d7b2438d3 30 */
switches 0:5c4d7b2438d3 31 // sleep();
switches 0:5c4d7b2438d3 32 }
switches 0:5c4d7b2438d3 33 static void (*idle_hook_fptr)(void) = &default_idle_hook;
switches 0:5c4d7b2438d3 34
switches 0:5c4d7b2438d3 35 void rtos_attach_idle_hook(void (*fptr)(void))
switches 0:5c4d7b2438d3 36 {
switches 0:5c4d7b2438d3 37 //Attach the specified idle hook, or the default idle hook in case of a NULL pointer
switches 0:5c4d7b2438d3 38 if (fptr != NULL) {
switches 0:5c4d7b2438d3 39 idle_hook_fptr = fptr;
switches 0:5c4d7b2438d3 40 } else {
switches 0:5c4d7b2438d3 41 idle_hook_fptr = default_idle_hook;
switches 0:5c4d7b2438d3 42 }
switches 0:5c4d7b2438d3 43 }
switches 0:5c4d7b2438d3 44
switches 0:5c4d7b2438d3 45 void rtos_idle_loop(void)
switches 0:5c4d7b2438d3 46 {
switches 0:5c4d7b2438d3 47 //Continuously call the idle hook function pointer
switches 0:5c4d7b2438d3 48 while (1) {
switches 0:5c4d7b2438d3 49 idle_hook_fptr();
switches 0:5c4d7b2438d3 50 }
switches 0:5c4d7b2438d3 51 }