Skip to content

Commit

Permalink
try femtopb
Browse files Browse the repository at this point in the history
  • Loading branch information
XdoctorwhoZ committed Jul 6, 2024
1 parent 1cae5f0 commit 9258761
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 14 deletions.
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ heapless = "0.8.0"

irq = "0.2.3"

no_proto = "0.9.60"
# no_proto = "0.9.60"
# protobuf-codegen = "3.5.0"
femtopb = "0.4.5"
serial-line-ip = "0.5.0"

# cargo build/run
[profile.dev]
Expand Down
16 changes: 16 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ use std::fs::File;
use std::io::Write;
use std::path::PathBuf;

// use protobuf_codegen;

fn main() {
// Put `memory.x` in our output directory and ensure it's
// on the linker search path.
Expand All @@ -28,4 +30,18 @@ fn main() {
// here, we ensure the build script is only re-run when
// `memory.x` is changed.
println!("cargo:rerun-if-changed=memory.x");

// protobuf_codegen::Codegen::new()
// // Use `protoc` parser, optional.
// .protoc()
// // Use `protoc-bin-vendored` bundled protoc command, optional.
// .protoc_path(&protoc_bin_vendored::protoc_bin_path().unwrap())
// // All inputs and imports from the inputs must reside in `includes` directories.
// .includes(&["src/protos"])
// // Inputs must reside in some of include paths.
// .input("src/protos/apple.proto")
// .input("src/protos/banana.proto")
// // Specify output directory relative to Cargo output directory.
// .cargo_out_dir("protos")
// .run_from_script();
}
31 changes: 18 additions & 13 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ use bsp::hal::{

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

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

use serial_line_ip;

#[entry]
fn main() -> ! {
Expand All @@ -50,17 +52,20 @@ 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();
// let user_factory = NP_Factory::new(
// r#"
// struct({ fields: {
// command: u8({ default: 0 }),
// pin: u8({ default: 0 }),
// value: u8({ default: 0 }),
// }})
// "#,
// )?;
// // close buffer and get internal bytes
// let user_bytes: Vec<u8> = user_buffer.finish().bytes();

// let mut slip = serial_line_ip::Encoder::new();
// let mut totals = slip.encode(INPUT_1, &mut output).unwrap();

// External high-speed crystal on the pico board is 12Mhz
let external_xtal_freq_hz = 12_000_000u32;
Expand Down

0 comments on commit 9258761

Please sign in to comment.