()
| 60 | |
| 61 | #[entry] |
| 62 | fn main() -> ! { |
| 63 | let mut pac = pac::Peripherals::take().unwrap(); |
| 64 | let core = pac::CorePeripherals::take().unwrap(); |
| 65 | let mut watchdog = Watchdog::new(pac.WATCHDOG); |
| 66 | let sio = Sio::new(pac.SIO); |
| 67 | |
| 68 | let clocks = init_clocks_and_plls( |
| 69 | bsp::XOSC_CRYSTAL_FREQ, |
| 70 | pac.XOSC, |
| 71 | pac.CLOCKS, |
| 72 | pac.PLL_SYS, |
| 73 | pac.PLL_USB, |
| 74 | &mut pac.RESETS, |
| 75 | &mut watchdog, |
| 76 | ) |
| 77 | .ok() |
| 78 | .unwrap(); |
| 79 | |
| 80 | let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz()); |
| 81 | |
| 82 | let pins = bsp::Pins::new( |
| 83 | pac.IO_BANK0, |
| 84 | pac.PADS_BANK0, |
| 85 | sio.gpio_bank0, |
| 86 | &mut pac.RESETS, |
| 87 | ); |
| 88 | |
| 89 | // Set up the USB driver |
| 90 | let usb_bus = UsbBusAllocator::new(usb::UsbBus::new( |
| 91 | pac.USBCTRL_REGS, |
| 92 | pac.USBCTRL_DPRAM, |
| 93 | clocks.usb_clock, |
| 94 | true, |
| 95 | &mut pac.RESETS, |
| 96 | )); |
| 97 | |
| 98 | // Set up the USB Communications Class Device driver |
| 99 | let mut serial = SerialPort::new(&usb_bus); |
| 100 | |
| 101 | let mut usb_dev = UsbDeviceBuilder::new(&usb_bus, UsbVidPid(FRAMEWORK_VID, COMMUNITY_PID)) |
| 102 | .manufacturer("Adafruit") |
| 103 | .product("QT PY - Framework 16 Inputmodule FW") |
| 104 | .max_power(500) |
| 105 | .device_release(device_release()) |
| 106 | .device_class(USB_CLASS_CDC) |
| 107 | .build(); |
| 108 | |
| 109 | let mut state = C1MinimalState { |
| 110 | sleeping: SimpleSleepState::Awake, |
| 111 | color: colors::GREEN, |
| 112 | brightness: 10, |
| 113 | }; |
| 114 | |
| 115 | let timer = Timer::new(pac.TIMER, &mut pac.RESETS); |
| 116 | let mut prev_timer = timer.get_counter().ticks(); |
| 117 | |
| 118 | pins.neopixel_power |
| 119 | .into_push_pull_output_in_state(PinState::High); |
nothing calls this directly
no test coverage detected