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 15
15
*/
16
16
#include <stddef.h>
17
17
#include "us_ticker_api.h"
18
+ #include "us_ticker_defines.h"
18
19
#include "fsl_pit.h"
19
20
#include "fsl_clock_config.h"
20
21
@@ -85,9 +86,9 @@ void us_ticker_init(void)
85
86
*
86
87
* @return The current timer's counter value in ticks
87
88
*/
88
- uint32_t us_ticker_read ()
89
+ uint32_t ( us_ticker_read ) ()
89
90
{
90
- return ~( PIT_GetCurrentTimerCount ( PIT , kPIT_Chnl_1 ) );
91
+ return us_ticker_read ( );
91
92
}
92
93
93
94
/** 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 15
15
*/
16
16
#include <stddef.h>
17
17
#include "us_ticker_api.h"
18
+ #include "us_ticker_defines.h"
18
19
#include "fsl_ctimer.h"
19
20
#include "PeripheralNames.h"
20
21
@@ -72,8 +73,9 @@ void us_ticker_init(void) {
72
73
*
73
74
* @return The current timer's counter value in ticks
74
75
*/
75
- uint32_t us_ticker_read (void ) {
76
- return CTIMER -> TC ;
76
+ uint32_t (us_ticker_read )()
77
+ {
78
+ return us_ticker_read ();
77
79
}
78
80
79
81
/** 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