Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sat Jun 03 00:22:44 2017 +0000
Revision:
46:b156ef445742
Parent:
18:6a4db94011d3
Final code for internal battlebot competition.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sahilmgandhi 18:6a4db94011d3 1
sahilmgandhi 18:6a4db94011d3 2 /** \addtogroup platform */
sahilmgandhi 18:6a4db94011d3 3 /** @{*/
sahilmgandhi 18:6a4db94011d3 4 /* mbed Microcontroller Library
sahilmgandhi 18:6a4db94011d3 5 * Copyright (c) 2006-2017 ARM Limited
sahilmgandhi 18:6a4db94011d3 6 *
sahilmgandhi 18:6a4db94011d3 7 * Licensed under the Apache License, Version 2.0 (the "License");
sahilmgandhi 18:6a4db94011d3 8 * you may not use this file except in compliance with the License.
sahilmgandhi 18:6a4db94011d3 9 * You may obtain a copy of the License at
sahilmgandhi 18:6a4db94011d3 10 *
sahilmgandhi 18:6a4db94011d3 11 * http://www.apache.org/licenses/LICENSE-2.0
sahilmgandhi 18:6a4db94011d3 12 *
sahilmgandhi 18:6a4db94011d3 13 * Unless required by applicable law or agreed to in writing, software
sahilmgandhi 18:6a4db94011d3 14 * distributed under the License is distributed on an "AS IS" BASIS,
sahilmgandhi 18:6a4db94011d3 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
sahilmgandhi 18:6a4db94011d3 16 * See the License for the specific language governing permissions and
sahilmgandhi 18:6a4db94011d3 17 * limitations under the License.
sahilmgandhi 18:6a4db94011d3 18 */
sahilmgandhi 18:6a4db94011d3 19 #ifndef MBED_SLEEP_H
sahilmgandhi 18:6a4db94011d3 20 #define MBED_SLEEP_H
sahilmgandhi 18:6a4db94011d3 21
sahilmgandhi 18:6a4db94011d3 22 #include "sleep_api.h"
sahilmgandhi 18:6a4db94011d3 23
sahilmgandhi 18:6a4db94011d3 24 #ifdef __cplusplus
sahilmgandhi 18:6a4db94011d3 25 extern "C" {
sahilmgandhi 18:6a4db94011d3 26 #endif
sahilmgandhi 18:6a4db94011d3 27
sahilmgandhi 18:6a4db94011d3 28 /** Send the microcontroller to sleep
sahilmgandhi 18:6a4db94011d3 29 *
sahilmgandhi 18:6a4db94011d3 30 * @note This function can be a noop if not implemented by the platform.
sahilmgandhi 18:6a4db94011d3 31 * @note This function will only put device to sleep in release mode (small profile or when NDEBUG is defined).
sahilmgandhi 18:6a4db94011d3 32 *
sahilmgandhi 18:6a4db94011d3 33 * The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the
sahilmgandhi 18:6a4db94011d3 34 * system clock to the core is stopped until a reset or an interrupt occurs. This eliminates
sahilmgandhi 18:6a4db94011d3 35 * dynamic power used by the processor, memory systems and buses. The processor, peripheral and
sahilmgandhi 18:6a4db94011d3 36 * memory state are maintained, and the peripherals continue to work and can generate interrupts.
sahilmgandhi 18:6a4db94011d3 37 *
sahilmgandhi 18:6a4db94011d3 38 * The processor can be woken up by any internal peripheral interrupt or external pin interrupt.
sahilmgandhi 18:6a4db94011d3 39 *
sahilmgandhi 18:6a4db94011d3 40 * @note
sahilmgandhi 18:6a4db94011d3 41 * The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
sahilmgandhi 18:6a4db94011d3 42 * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
sahilmgandhi 18:6a4db94011d3 43 * able to access the LocalFileSystem
sahilmgandhi 18:6a4db94011d3 44 */
sahilmgandhi 18:6a4db94011d3 45 __INLINE static void sleep(void)
sahilmgandhi 18:6a4db94011d3 46 {
sahilmgandhi 18:6a4db94011d3 47 #ifdef NDEBUG
sahilmgandhi 18:6a4db94011d3 48 #if DEVICE_SLEEP
sahilmgandhi 18:6a4db94011d3 49 hal_sleep();
sahilmgandhi 18:6a4db94011d3 50 #endif /* DEVICE_SLEEP */
sahilmgandhi 18:6a4db94011d3 51 #endif /* NDEBUG */
sahilmgandhi 18:6a4db94011d3 52 }
sahilmgandhi 18:6a4db94011d3 53
sahilmgandhi 18:6a4db94011d3 54 /** Send the microcontroller to deep sleep
sahilmgandhi 18:6a4db94011d3 55 *
sahilmgandhi 18:6a4db94011d3 56 * @note This function can be a noop if not implemented by the platform.
sahilmgandhi 18:6a4db94011d3 57 * @note This function will only put device to sleep in release mode (small profile or when NDEBUG is defined).
sahilmgandhi 18:6a4db94011d3 58 *
sahilmgandhi 18:6a4db94011d3 59 * This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode
sahilmgandhi 18:6a4db94011d3 60 * has the same sleep features as sleep plus it powers down peripherals and clocks. All state
sahilmgandhi 18:6a4db94011d3 61 * is still maintained.
sahilmgandhi 18:6a4db94011d3 62 *
sahilmgandhi 18:6a4db94011d3 63 * The processor can only be woken up by an external interrupt on a pin or a watchdog timer.
sahilmgandhi 18:6a4db94011d3 64 *
sahilmgandhi 18:6a4db94011d3 65 * @note
sahilmgandhi 18:6a4db94011d3 66 * The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
sahilmgandhi 18:6a4db94011d3 67 * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
sahilmgandhi 18:6a4db94011d3 68 * able to access the LocalFileSystem
sahilmgandhi 18:6a4db94011d3 69 */
sahilmgandhi 18:6a4db94011d3 70 __INLINE static void deepsleep(void)
sahilmgandhi 18:6a4db94011d3 71 {
sahilmgandhi 18:6a4db94011d3 72 #ifdef NDEBUG
sahilmgandhi 18:6a4db94011d3 73 #if DEVICE_SLEEP
sahilmgandhi 18:6a4db94011d3 74 hal_deepsleep();
sahilmgandhi 18:6a4db94011d3 75 #endif /* DEVICE_SLEEP */
sahilmgandhi 18:6a4db94011d3 76 #endif /* NDEBUG */
sahilmgandhi 18:6a4db94011d3 77 }
sahilmgandhi 18:6a4db94011d3 78
sahilmgandhi 18:6a4db94011d3 79 #ifdef __cplusplus
sahilmgandhi 18:6a4db94011d3 80 }
sahilmgandhi 18:6a4db94011d3 81 #endif
sahilmgandhi 18:6a4db94011d3 82
sahilmgandhi 18:6a4db94011d3 83 #endif
sahilmgandhi 18:6a4db94011d3 84
sahilmgandhi 18:6a4db94011d3 85 /** @}*/