Skip to content
This repository was archived by the owner on Feb 13, 2019. It is now read-only.

Commit 03a90bc

Browse files
committed
Improve naming and add doc comments
1 parent 71b5d90 commit 03a90bc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/rcc.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,17 @@ pub struct CFGR {
9898
}
9999

100100
impl CFGR {
101-
pub fn hse<F>(mut self, freq: F) -> Self
101+
/// Uses HSE (external oscillator) instead of HSI (internal RC oscillator) as the clock source.
102+
/// Will result in a hang if an external oscillator is not connected or it fails to start.
103+
pub fn use_hse<F>(mut self, freq: F) -> Self
102104
where
103105
F: Into<Hertz>,
104106
{
105107
self.hse = Some(freq.into().0);
106108
self
107109
}
108110

111+
/// Sets the desired frequency for the HCLK clock
109112
pub fn hclk<F>(mut self, freq: F) -> Self
110113
where
111114
F: Into<Hertz>,
@@ -114,6 +117,7 @@ impl CFGR {
114117
self
115118
}
116119

120+
/// Sets the desired frequency for the PCKL1 clock
117121
pub fn pclk1<F>(mut self, freq: F) -> Self
118122
where
119123
F: Into<Hertz>,
@@ -122,6 +126,7 @@ impl CFGR {
122126
self
123127
}
124128

129+
/// Sets the desired frequency for the PCLK2 clock
125130
pub fn pclk2<F>(mut self, freq: F) -> Self
126131
where
127132
F: Into<Hertz>,
@@ -130,6 +135,7 @@ impl CFGR {
130135
self
131136
}
132137

138+
/// Sets the desired frequency for the SYSCLK clock
133139
pub fn sysclk<F>(mut self, freq: F) -> Self
134140
where
135141
F: Into<Hertz>,
@@ -256,7 +262,6 @@ impl CFGR {
256262
}
257263

258264
// set prescalers and clock source
259-
260265
rcc.cfgr.modify(|_, w| unsafe {
261266
w.ppre2()
262267
.bits(ppre2_bits)

0 commit comments

Comments
 (0)