max32630fthr quad spi , unexpected spi behavior

Committer:
boonshen
Date:
Tue Mar 13 21:12:00 2018 +0000
Revision:
0:a35c40f49345
MAX32630FTHR QuadSPI test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
boonshen 0:a35c40f49345 1 /* mbed Microcontroller Library
boonshen 0:a35c40f49345 2 * Copyright (c) 2006-2013 ARM Limited
boonshen 0:a35c40f49345 3 *
boonshen 0:a35c40f49345 4 * Licensed under the Apache License, Version 2.0 (the "License");
boonshen 0:a35c40f49345 5 * you may not use this file except in compliance with the License.
boonshen 0:a35c40f49345 6 * You may obtain a copy of the License at
boonshen 0:a35c40f49345 7 *
boonshen 0:a35c40f49345 8 * http://www.apache.org/licenses/LICENSE-2.0
boonshen 0:a35c40f49345 9 *
boonshen 0:a35c40f49345 10 * Unless required by applicable law or agreed to in writing, software
boonshen 0:a35c40f49345 11 * distributed under the License is distributed on an "AS IS" BASIS,
boonshen 0:a35c40f49345 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
boonshen 0:a35c40f49345 13 * See the License for the specific language governing permissions and
boonshen 0:a35c40f49345 14 * limitations under the License.
boonshen 0:a35c40f49345 15 */
boonshen 0:a35c40f49345 16 #ifndef MBED_TIMER_H
boonshen 0:a35c40f49345 17 #define MBED_TIMER_H
boonshen 0:a35c40f49345 18
boonshen 0:a35c40f49345 19 #include "platform/platform.h"
boonshen 0:a35c40f49345 20 #include "hal/ticker_api.h"
boonshen 0:a35c40f49345 21 #include "platform/NonCopyable.h"
boonshen 0:a35c40f49345 22 #include "platform/mbed_sleep.h"
boonshen 0:a35c40f49345 23
boonshen 0:a35c40f49345 24 namespace mbed {
boonshen 0:a35c40f49345 25 /** \addtogroup drivers */
boonshen 0:a35c40f49345 26
boonshen 0:a35c40f49345 27 /** A general purpose timer
boonshen 0:a35c40f49345 28 *
boonshen 0:a35c40f49345 29 * @note Synchronization level: Interrupt safe
boonshen 0:a35c40f49345 30 *
boonshen 0:a35c40f49345 31 * Example:
boonshen 0:a35c40f49345 32 * @code
boonshen 0:a35c40f49345 33 * // Count the time to toggle a LED
boonshen 0:a35c40f49345 34 *
boonshen 0:a35c40f49345 35 * #include "mbed.h"
boonshen 0:a35c40f49345 36 *
boonshen 0:a35c40f49345 37 * Timer timer;
boonshen 0:a35c40f49345 38 * DigitalOut led(LED1);
boonshen 0:a35c40f49345 39 * int begin, end;
boonshen 0:a35c40f49345 40 *
boonshen 0:a35c40f49345 41 * int main() {
boonshen 0:a35c40f49345 42 * timer.start();
boonshen 0:a35c40f49345 43 * begin = timer.read_us();
boonshen 0:a35c40f49345 44 * led = !led;
boonshen 0:a35c40f49345 45 * end = timer.read_us();
boonshen 0:a35c40f49345 46 * printf("Toggle the led takes %d us", end - begin);
boonshen 0:a35c40f49345 47 * }
boonshen 0:a35c40f49345 48 * @endcode
boonshen 0:a35c40f49345 49 * @ingroup drivers
boonshen 0:a35c40f49345 50 */
boonshen 0:a35c40f49345 51 class Timer : private NonCopyable<Timer> {
boonshen 0:a35c40f49345 52
boonshen 0:a35c40f49345 53 public:
boonshen 0:a35c40f49345 54 Timer();
boonshen 0:a35c40f49345 55 Timer(const ticker_data_t *data);
boonshen 0:a35c40f49345 56 ~Timer();
boonshen 0:a35c40f49345 57
boonshen 0:a35c40f49345 58 /** Start the timer
boonshen 0:a35c40f49345 59 */
boonshen 0:a35c40f49345 60 void start();
boonshen 0:a35c40f49345 61
boonshen 0:a35c40f49345 62 /** Stop the timer
boonshen 0:a35c40f49345 63 */
boonshen 0:a35c40f49345 64 void stop();
boonshen 0:a35c40f49345 65
boonshen 0:a35c40f49345 66 /** Reset the timer to 0.
boonshen 0:a35c40f49345 67 *
boonshen 0:a35c40f49345 68 * If it was already counting, it will continue
boonshen 0:a35c40f49345 69 */
boonshen 0:a35c40f49345 70 void reset();
boonshen 0:a35c40f49345 71
boonshen 0:a35c40f49345 72 /** Get the time passed in seconds
boonshen 0:a35c40f49345 73 *
boonshen 0:a35c40f49345 74 * @returns Time passed in seconds
boonshen 0:a35c40f49345 75 */
boonshen 0:a35c40f49345 76 float read();
boonshen 0:a35c40f49345 77
boonshen 0:a35c40f49345 78 /** Get the time passed in milli-seconds
boonshen 0:a35c40f49345 79 *
boonshen 0:a35c40f49345 80 * @returns Time passed in milli seconds
boonshen 0:a35c40f49345 81 */
boonshen 0:a35c40f49345 82 int read_ms();
boonshen 0:a35c40f49345 83
boonshen 0:a35c40f49345 84 /** Get the time passed in micro-seconds
boonshen 0:a35c40f49345 85 *
boonshen 0:a35c40f49345 86 * @returns Time passed in micro seconds
boonshen 0:a35c40f49345 87 */
boonshen 0:a35c40f49345 88 int read_us();
boonshen 0:a35c40f49345 89
boonshen 0:a35c40f49345 90 /** An operator shorthand for read()
boonshen 0:a35c40f49345 91 */
boonshen 0:a35c40f49345 92 operator float();
boonshen 0:a35c40f49345 93
boonshen 0:a35c40f49345 94 /** Get in a high resolution type the time passed in micro-seconds.
boonshen 0:a35c40f49345 95 */
boonshen 0:a35c40f49345 96 us_timestamp_t read_high_resolution_us();
boonshen 0:a35c40f49345 97
boonshen 0:a35c40f49345 98 protected:
boonshen 0:a35c40f49345 99 us_timestamp_t slicetime();
boonshen 0:a35c40f49345 100 int _running; // whether the timer is running
boonshen 0:a35c40f49345 101 us_timestamp_t _start; // the start time of the latest slice
boonshen 0:a35c40f49345 102 us_timestamp_t _time; // any accumulated time from previous slices
boonshen 0:a35c40f49345 103 const ticker_data_t *_ticker_data;
boonshen 0:a35c40f49345 104 bool _lock_deepsleep; // flag which indicates if deep-sleep should be disabled
boonshen 0:a35c40f49345 105 };
boonshen 0:a35c40f49345 106
boonshen 0:a35c40f49345 107 } // namespace mbed
boonshen 0:a35c40f49345 108
boonshen 0:a35c40f49345 109 #endif