File tree Expand file tree Collapse file tree 4 files changed +67
-4
lines changed
targets/TARGET_NXP/TARGET_MCUXpresso_MCUS Expand file tree Collapse file tree 4 files changed +67
-4
lines changed Original file line number Diff line number Diff line change 1515 */
1616#include <stddef.h>
1717#include "us_ticker_api.h"
18+ #include "us_ticker_defines.h"
1819#include "fsl_pit.h"
1920#include "fsl_clock_config.h"
2021
@@ -85,9 +86,9 @@ void us_ticker_init(void)
8586 *
8687 * @return The current timer's counter value in ticks
8788 */
88- uint32_t us_ticker_read ()
89+ uint32_t ( us_ticker_read ) ()
8990{
90- return ~( PIT_GetCurrentTimerCount ( PIT , kPIT_Chnl_1 ) );
91+ return us_ticker_read ( );
9192}
9293
9394/** Disable us ticker interrupt
Original file line number Diff line number Diff line change 1+ /* mbed Microcontroller Library
2+ * Copyright (c) 2006-2019 ARM Limited
3+ * SPDX-License-Identifier: Apache-2.0
4+ *
5+ * Licensed under the Apache License, Version 2.0 (the "License");
6+ * you may not use this file except in compliance with the License.
7+ * You may obtain a copy of the License at
8+ *
9+ * http://www.apache.org/licenses/LICENSE-2.0
10+ *
11+ * Unless required by applicable law or agreed to in writing, software
12+ * distributed under the License is distributed on an "AS IS" BASIS,
13+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ * See the License for the specific language governing permissions and
15+ * limitations under the License.
16+ */
17+ #ifndef _NXP_US_TICKER_DEFINES_H_
18+ #define _NXP_US_TICKER_DEFINES_H_
19+
20+ #include "fsl_pit.h"
21+
22+ #define US_TICKER_PERIOD_NUM 1
23+ #define US_TICKER_PERIOD_DEN 1
24+
25+ #define US_TICKER_MASK 0xFFFFFFFF
26+
27+ /* Macro-optimised form of us_ticker_read */
28+ #define us_ticker_read () (~(PIT_GetCurrentTimerCount(PIT, kPIT_Chnl_1)))
29+
30+ #endif /* _NXP_US_TICKER_DEFINES_H_ */
Original file line number Diff line number Diff line change 1515 */
1616#include <stddef.h>
1717#include "us_ticker_api.h"
18+ #include "us_ticker_defines.h"
1819#include "fsl_ctimer.h"
1920#include "PeripheralNames.h"
2021
@@ -72,8 +73,9 @@ void us_ticker_init(void) {
7273 *
7374 * @return The current timer's counter value in ticks
7475 */
75- uint32_t us_ticker_read (void ) {
76- return CTIMER -> TC ;
76+ uint32_t (us_ticker_read )()
77+ {
78+ return us_ticker_read ();
7779}
7880
7981/** Set interrupt for specified timestamp
Original file line number Diff line number Diff line change 1+ /* mbed Microcontroller Library
2+ * Copyright (c) 2006-2019 ARM Limited
3+ * SPDX-License-Identifier: Apache-2.0
4+ *
5+ * Licensed under the Apache License, Version 2.0 (the "License");
6+ * you may not use this file except in compliance with the License.
7+ * You may obtain a copy of the License at
8+ *
9+ * http://www.apache.org/licenses/LICENSE-2.0
10+ *
11+ * Unless required by applicable law or agreed to in writing, software
12+ * distributed under the License is distributed on an "AS IS" BASIS,
13+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ * See the License for the specific language governing permissions and
15+ * limitations under the License.
16+ */
17+ #ifndef _NXP_US_TICKER_DEFINES_H_
18+ #define _NXP_US_TICKER_DEFINES_H_
19+
20+ #include "fsl_ctimer.h"
21+
22+ #define US_TICKER_PERIOD_NUM 1
23+ #define US_TICKER_PERIOD_DEN 1
24+
25+ #define US_TICKER_MASK 0xFFFFFFFF
26+
27+ /* Macro-optimised form of us_ticker_read */
28+ #define us_ticker_read () (CTIMER->TC)
29+
30+ #endif /* _NXP_US_TICKER_DEFINES_H_ */
You can’t perform that action at this time.
0 commit comments