Skip to content

Commit

Permalink
work with no poto
Browse files Browse the repository at this point in the history
  • Loading branch information
XdoctorwhoZ committed Jul 5, 2024
1 parent d923297 commit 1cae5f0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ heapless = "0.8.0"

irq = "0.2.3"

no_proto = "0.9.60"

# cargo build/run
[profile.dev]
codegen-units = 1
Expand Down
21 changes: 18 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ use bsp::hal::{

use rp_pico::hal::gpio::{FunctionPio0, Pin};

use no_proto::error::NP_Error;
use no_proto::NP_Factory;

#[entry]
fn main() -> ! {
info!("Program start");
Expand All @@ -47,6 +50,18 @@ fn main() -> ! {
let mut watchdog = Watchdog::new(pac.WATCHDOG);
let sio = Sio::new(pac.SIO);

let user_factory = NP_Factory::new(
r#"
struct({ fields: {
name: string(),
age: u16({ default: 0 }),
tags: list({ of: string() })
}})
"#,
)?;
// close buffer and get internal bytes
let user_bytes: Vec<u8> = user_buffer.finish().bytes();

// External high-speed crystal on the pico board is 12Mhz
let external_xtal_freq_hz = 12_000_000u32;
let clocks = init_clocks_and_plls(
Expand Down Expand Up @@ -96,10 +111,10 @@ fn main() -> ! {
let mut serial = SerialPort::new(&usb_bus);

// Create a USB device with a fake VID and PID
let mut usb_dev = UsbDeviceBuilder::new(&usb_bus, UsbVidPid(0x16c0, 0x27dd))
let mut usb_dev = UsbDeviceBuilder::new(&usb_bus, UsbVidPid(0x16c0, 0x05E1))
.strings(&[StringDescriptors::default()
.manufacturer("Fake company")
.product("Serial port")
.manufacturer("panduza")
.product("picoha-dio")
.serial_number("TEST")])
.unwrap()
.device_class(2) // from: https://www.usb.org/defined-class-codes
Expand Down

0 comments on commit 1cae5f0

Please sign in to comment.