MCPcopy Index your code
hub / github.com/FrameworkComputer/inputmodule-rs / main

Function main

ledmatrix/src/main.rs:158–561  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

156
157#[entry]
158fn main() -> ! {
159 let mut pac = pac::Peripherals::take().unwrap();
160 let core = pac::CorePeripherals::take().unwrap();
161 let mut watchdog = Watchdog::new(pac.WATCHDOG);
162 let sio = Sio::new(pac.SIO);
163
164 let clocks = init_clocks_and_plls(
165 bsp::XOSC_CRYSTAL_FREQ,
166 pac.XOSC,
167 pac.CLOCKS,
168 pac.PLL_SYS,
169 pac.PLL_USB,
170 &mut pac.RESETS,
171 &mut watchdog,
172 )
173 .ok()
174 .unwrap();
175 //rp2040_pac::rosc::RANDOMBIT::read(&self)
176 let rosc = rp2040_hal::rosc::RingOscillator::new(pac.ROSC);
177 let rosc = rosc.initialize();
178
179 let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());
180
181 let pins = bsp::Pins::new(
182 pac.IO_BANK0,
183 pac.PADS_BANK0,
184 sio.gpio_bank0,
185 &mut pac.RESETS,
186 );
187
188 // Set up the USB driver
189 let usb_bus = UsbBusAllocator::new(usb::UsbBus::new(
190 pac.USBCTRL_REGS,
191 pac.USBCTRL_DPRAM,
192 clocks.usb_clock,
193 true,
194 &mut pac.RESETS,
195 ));
196
197 // Set up the USB Communications Class Device driver
198 let mut serial = SerialPort::new(&usb_bus);
199
200 let serialnum = if let Some(serialnum) = get_serialnum() {
201 serialnum.serialnum
202 } else {
203 DEFAULT_SERIAL
204 };
205
206 let mut usb_dev = UsbDeviceBuilder::new(&usb_bus, UsbVidPid(0x32ac, 0x0020))
207 .manufacturer("Framework Computer Inc")
208 .product("LED Matrix Input Module")
209 .serial_number(serialnum)
210 .max_power(MAX_CURRENT)
211 .device_release(device_release())
212 .device_class(USB_CLASS_CDC)
213 .build();
214
215 // Enable LED controller

Callers

nothing calls this directly

Calls 15

get_serialnumFunction · 0.85
device_releaseFunction · 0.85
show_startup_animationFunction · 0.85
get_random_byteFunction · 0.85
fill_grid_pixelsFunction · 0.85
assign_sleep_reasonFunction · 0.85
parse_commandFunction · 0.85
handle_commandFunction · 0.85
unwrapMethod · 0.80
setupMethod · 0.80
set_scalingMethod · 0.80
handle_sleepFunction · 0.70

Tested by

no test coverage detected