MCPcopy Create free account
hub / github.com/SharpCoder/teensycore / initialize

Method initialize

src/serio.rs:177–278  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

175 }
176
177 fn initialize(&mut self) {
178 if self.initialized {
179 return;
180 }
181
182 // Initialize the pins
183 pin_mux_config(self.tx_pin, Alt::Alt2);
184 pin_pad_config(
185 self.tx_pin,
186 PadConfig {
187 hysterisis: true,
188 resistance: PullUpDown::PullDown100k,
189 pull_keep: PullKeep::Keeper,
190 pull_keep_en: false,
191 open_drain: false,
192 speed: PinSpeed::Low50MHz,
193 drive_strength: DriveStrength::MaxDiv3,
194 fast_slew_rate: true,
195 },
196 );
197
198 pin_mux_config(self.rx_pin, Alt::Alt2);
199 pin_pad_config(
200 self.rx_pin,
201 PadConfig {
202 hysterisis: true,
203 resistance: PullUpDown::PullUp22k,
204 pull_keep: PullKeep::Pull,
205 pull_keep_en: true,
206 open_drain: false,
207 speed: PinSpeed::Low50MHz,
208 drive_strength: DriveStrength::MaxDiv3,
209 fast_slew_rate: false,
210 },
211 );
212
213 // Configure the base settings
214 uart_disable(self.device);
215 uart_sw_reset(self.device, true);
216 uart_sw_reset(self.device, false);
217 uart_configure(
218 self.device,
219 UartConfig {
220 r9t8: false,
221 invert_transmission_polarity: false,
222 overrun_irq_en: true,
223 noise_error_irq_en: false,
224 framing_error_irq_en: false,
225 parity_error_irq_en: false,
226 tx_irq_en: false, // This gets set later
227 rx_irq_en: true,
228 tx_complete_irq_en: true,
229 idle_line_irq_en: true,
230 tx_en: false,
231 rx_en: false,
232 match1_irq_en: false,
233 match2_irq_en: false,
234 idle_config: IdleConfiguration::Idle64Char,

Callers 1

serial_initFunction · 0.80

Calls 15

pin_mux_configFunction · 0.85
pin_pad_configFunction · 0.85
uart_disableFunction · 0.85
uart_sw_resetFunction · 0.85
uart_configureFunction · 0.85
uart_configure_fifoFunction · 0.85
uart_set_pin_configFunction · 0.85
uart_disable_fifoFunction · 0.85
uart_watermarkFunction · 0.85
uart_enableFunction · 0.85
pin_modeFunction · 0.85
assignFunction · 0.85

Tested by

no test coverage detected