Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
3101baa5
Commit
3101baa5
authored
9 years ago
by
Hauke Petersen
Browse files
Options
Downloads
Patches
Plain Diff
cpu/sam3: s/F_CPU/CLOCK_CORECLOCK/
parent
4f35f8d5
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
cpu/sam3/periph/pwm.c
+4
-4
4 additions, 4 deletions
cpu/sam3/periph/pwm.c
cpu/sam3/periph/timer.c
+1
-1
1 addition, 1 deletion
cpu/sam3/periph/timer.c
cpu/sam3/periph/uart.c
+1
-1
1 addition, 1 deletion
cpu/sam3/periph/uart.c
with
6 additions
and
6 deletions
cpu/sam3/periph/pwm.c
+
4
−
4
View file @
3101baa5
...
...
@@ -73,18 +73,18 @@ int pwm_init(pwm_t dev, pwm_mode_t mode,
* The pwm provides 11 prescaled clocks with (MCK/2^prea | prea=[0,10])
* and a divider (diva) with a denominator range [1,255] in line.
*/
if
(
F_CPU
<
pwm_clk
)
{
/* Have to cut down resulting frequency. */
frequency
=
F_CPU
/
resolution
;
if
(
CLOCK_CORECLOCK
<
pwm_clk
)
{
/* Have to cut down resulting frequency. */
frequency
=
CLOCK_CORECLOCK
/
resolution
;
}
else
{
/* Estimate prescaler and divider. */
diva
=
F_CPU
/
pwm_clk
;
diva
=
CLOCK_CORECLOCK
/
pwm_clk
;
while
((
prea
<
MCK_DIV_LB_MAX
)
&&
(
~
0xff
&
diva
))
{
prea
=
prea
+
1
;
diva
=
diva
>>
1
;
}
frequency
=
F_CPU
/
((
resolution
*
diva
)
<<
prea
);
frequency
=
CLOCK_CORECLOCK
/
((
resolution
*
diva
)
<<
prea
);
}
retval
=
frequency
;
...
...
This diff is collapsed.
Click to expand it.
cpu/sam3/periph/timer.c
+
1
−
1
View file @
3101baa5
...
...
@@ -117,7 +117,7 @@ int timer_init(tim_t dev, unsigned int ticks_per_us, void (*callback)(int))
* channel 2 toggles this line on each timer tick, the actual frequency driving ch0/1
* is f_ch2 / 2 --> f_ch0/1 = (MCK / 2 / 2 / 1000000) * ticks_per_us.
*/
tim
->
TC_CHANNEL
[
2
].
TC_RC
=
((
F_CPU
/
1000000
)
/
4
)
*
ticks_per_us
;
tim
->
TC_CHANNEL
[
2
].
TC_RC
=
((
CLOCK_CORECLOCK
/
1000000
)
/
4
)
*
ticks_per_us
;
/* start channel 2 */
tim
->
TC_CHANNEL
[
2
].
TC_CCR
=
TC_CCR_CLKEN
|
TC_CCR_SWTRG
;
...
...
This diff is collapsed.
Click to expand it.
cpu/sam3/periph/uart.c
+
1
−
1
View file @
3101baa5
...
...
@@ -63,7 +63,7 @@ int uart_init(uart_t uart, uint32_t baudrate, uart_rx_cb_t rx_cb, void *arg)
uart_config
[
uart
].
tx_pin
);
/* configure baud rate and set mode to 8N1 */
dev
->
UART_BRGR
=
(
F_CPU
/
(
16
*
baudrate
));
dev
->
UART_BRGR
=
(
CLOCK_CORECLOCK
/
(
16
*
baudrate
));
dev
->
UART_MR
=
UART_MR_PAR_NO
|
US_MR_CHRL_8_BIT
;
dev
->
UART_CR
=
UART_CR_RXEN
|
UART_CR_TXEN
|
UART_CR_RSTSTA
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment