max32630fthr quad spi , unexpected spi behavior
FTHR_USB_serial/mbed-os/drivers/Ticker.cpp@0:a35c40f49345, 2018-03-13 (annotated)
- Committer:
- boonshen
- Date:
- Tue Mar 13 21:12:00 2018 +0000
- Revision:
- 0:a35c40f49345
MAX32630FTHR QuadSPI test
Who changed what in which revision?
User | Revision | Line number | New 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 | #include "drivers/Ticker.h" |
boonshen | 0:a35c40f49345 | 17 | |
boonshen | 0:a35c40f49345 | 18 | #include "drivers/TimerEvent.h" |
boonshen | 0:a35c40f49345 | 19 | #include "platform/FunctionPointer.h" |
boonshen | 0:a35c40f49345 | 20 | #include "hal/ticker_api.h" |
boonshen | 0:a35c40f49345 | 21 | #include "platform/mbed_critical.h" |
boonshen | 0:a35c40f49345 | 22 | |
boonshen | 0:a35c40f49345 | 23 | namespace mbed { |
boonshen | 0:a35c40f49345 | 24 | |
boonshen | 0:a35c40f49345 | 25 | void Ticker::detach() { |
boonshen | 0:a35c40f49345 | 26 | core_util_critical_section_enter(); |
boonshen | 0:a35c40f49345 | 27 | remove(); |
boonshen | 0:a35c40f49345 | 28 | // unlocked only if we were attached (we locked it) and this is not low power ticker |
boonshen | 0:a35c40f49345 | 29 | if(_function && _lock_deepsleep) { |
boonshen | 0:a35c40f49345 | 30 | sleep_manager_unlock_deep_sleep(); |
boonshen | 0:a35c40f49345 | 31 | } |
boonshen | 0:a35c40f49345 | 32 | |
boonshen | 0:a35c40f49345 | 33 | _function = 0; |
boonshen | 0:a35c40f49345 | 34 | core_util_critical_section_exit(); |
boonshen | 0:a35c40f49345 | 35 | } |
boonshen | 0:a35c40f49345 | 36 | |
boonshen | 0:a35c40f49345 | 37 | void Ticker::setup(us_timestamp_t t) { |
boonshen | 0:a35c40f49345 | 38 | core_util_critical_section_enter(); |
boonshen | 0:a35c40f49345 | 39 | remove(); |
boonshen | 0:a35c40f49345 | 40 | _delay = t; |
boonshen | 0:a35c40f49345 | 41 | insert_absolute(_delay + ticker_read_us(_ticker_data)); |
boonshen | 0:a35c40f49345 | 42 | core_util_critical_section_exit(); |
boonshen | 0:a35c40f49345 | 43 | } |
boonshen | 0:a35c40f49345 | 44 | |
boonshen | 0:a35c40f49345 | 45 | void Ticker::handler() { |
boonshen | 0:a35c40f49345 | 46 | insert_absolute(event.timestamp + _delay); |
boonshen | 0:a35c40f49345 | 47 | if (_function) { |
boonshen | 0:a35c40f49345 | 48 | _function(); |
boonshen | 0:a35c40f49345 | 49 | } |
boonshen | 0:a35c40f49345 | 50 | } |
boonshen | 0:a35c40f49345 | 51 | |
boonshen | 0:a35c40f49345 | 52 | } // namespace mbed |