mirror of
https://github.com/cccb/servicepoint.git
synced 2025-01-18 10:00:14 +01:00
move examples into package (include them in published crate)
This commit is contained in:
parent
5514f60c28
commit
c92493fad1
78
Cargo.lock
generated
78
Cargo.lock
generated
|
@ -17,15 +17,6 @@ dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "announce"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"clap 4.5.4",
|
|
||||||
"env_logger",
|
|
||||||
"servicepoint",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstream"
|
name = "anstream"
|
||||||
version = "0.6.14"
|
version = "0.6.14"
|
||||||
|
@ -250,29 +241,6 @@ dependencies = [
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "env_filter"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea"
|
|
||||||
dependencies = [
|
|
||||||
"log",
|
|
||||||
"regex",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "env_logger"
|
|
||||||
version = "0.11.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9"
|
|
||||||
dependencies = [
|
|
||||||
"anstream",
|
|
||||||
"anstyle",
|
|
||||||
"env_filter",
|
|
||||||
"humantime",
|
|
||||||
"log",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "errno"
|
name = "errno"
|
||||||
version = "0.3.9"
|
version = "0.3.9"
|
||||||
|
@ -299,16 +267,6 @@ dependencies = [
|
||||||
"miniz_oxide",
|
"miniz_oxide",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "game_of_life"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"clap 4.5.4",
|
|
||||||
"env_logger",
|
|
||||||
"rand",
|
|
||||||
"servicepoint",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "getrandom"
|
name = "getrandom"
|
||||||
version = "0.2.15"
|
version = "0.2.15"
|
||||||
|
@ -347,12 +305,6 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "humantime"
|
|
||||||
version = "2.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "1.9.3"
|
version = "1.9.3"
|
||||||
|
@ -425,15 +377,6 @@ dependencies = [
|
||||||
"adler",
|
"adler",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "moving_line"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"clap 4.5.4",
|
|
||||||
"env_logger",
|
|
||||||
"servicepoint",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "once_cell"
|
name = "once_cell"
|
||||||
version = "1.19.0"
|
version = "1.19.0"
|
||||||
|
@ -506,16 +449,6 @@ dependencies = [
|
||||||
"getrandom",
|
"getrandom",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "random_brightness"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"clap 4.5.4",
|
|
||||||
"env_logger",
|
|
||||||
"rand",
|
|
||||||
"servicepoint",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex"
|
name = "regex"
|
||||||
version = "1.10.4"
|
version = "1.10.4"
|
||||||
|
@ -610,8 +543,10 @@ name = "servicepoint"
|
||||||
version = "0.4.2"
|
version = "0.4.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bzip2",
|
"bzip2",
|
||||||
|
"clap 4.5.4",
|
||||||
"flate2",
|
"flate2",
|
||||||
"log",
|
"log",
|
||||||
|
"rand",
|
||||||
"rust-lzma",
|
"rust-lzma",
|
||||||
"zstd",
|
"zstd",
|
||||||
]
|
]
|
||||||
|
@ -831,15 +766,6 @@ version = "0.52.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
|
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wiping_clear"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"clap 4.5.4",
|
|
||||||
"env_logger",
|
|
||||||
"servicepoint",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zstd"
|
name = "zstd"
|
||||||
version = "0.13.1"
|
version = "0.13.1"
|
||||||
|
|
|
@ -4,10 +4,5 @@ members = [
|
||||||
"crates/servicepoint",
|
"crates/servicepoint",
|
||||||
"crates/servicepoint_binding_c",
|
"crates/servicepoint_binding_c",
|
||||||
"crates/servicepoint_binding_cs",
|
"crates/servicepoint_binding_cs",
|
||||||
"examples/announce",
|
"crates/servicepoint_binding_c/examples/lang_c"
|
||||||
"examples/game_of_life",
|
|
||||||
"examples/moving_line",
|
|
||||||
"examples/wiping_clear",
|
|
||||||
"examples/random_brightness",
|
|
||||||
"examples/lang_c"
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -26,3 +26,8 @@ compression_bzip2 = ["dep:bzip2"]
|
||||||
compression_lzma = ["dep:rust-lzma"]
|
compression_lzma = ["dep:rust-lzma"]
|
||||||
compression_zstd = ["dep:zstd"]
|
compression_zstd = ["dep:zstd"]
|
||||||
all_compressions = ["compression_zlib", "compression_bzip2", "compression_lzma", "compression_zstd"]
|
all_compressions = ["compression_zlib", "compression_bzip2", "compression_lzma", "compression_zstd"]
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
# for examples
|
||||||
|
clap = { version = "4.5", features = ["derive"] }
|
||||||
|
rand = "0.8"
|
|
@ -14,10 +14,11 @@ struct Cli {
|
||||||
|
|
||||||
/// example: `cargo run -- --text "Hallo,
|
/// example: `cargo run -- --text "Hallo,
|
||||||
/// CCCB"`
|
/// CCCB"`
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
env_logger::init();
|
let mut cli = Cli::parse();
|
||||||
let cli = Cli::parse();
|
if cli.text.is_empty() {
|
||||||
|
cli.text.push("Hello, CCCB!".to_string());
|
||||||
|
}
|
||||||
|
|
||||||
let connection = Connection::open(&cli.destination).unwrap();
|
let connection = Connection::open(&cli.destination).unwrap();
|
||||||
if cli.clear {
|
if cli.clear {
|
|
@ -14,7 +14,6 @@ struct Cli {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
env_logger::init();
|
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
|
|
||||||
let connection = Connection::open(&cli.destination).unwrap();
|
let connection = Connection::open(&cli.destination).unwrap();
|
||||||
|
@ -22,13 +21,11 @@ fn main() {
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
connection
|
connection
|
||||||
.send(
|
.send(Command::BitmapLinearWin(
|
||||||
Command::BitmapLinearWin(
|
Origin(0, 0),
|
||||||
Origin(0, 0),
|
field.clone(),
|
||||||
field.clone(),
|
CompressionCode::Lzma,
|
||||||
CompressionCode::Lzma,
|
))
|
||||||
)
|
|
||||||
)
|
|
||||||
.expect("could not send");
|
.expect("could not send");
|
||||||
thread::sleep(FRAME_PACING);
|
thread::sleep(FRAME_PACING);
|
||||||
field = iteration(field);
|
field = iteration(field);
|
|
@ -11,8 +11,6 @@ struct Cli {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
env_logger::init();
|
|
||||||
|
|
||||||
let connection = Connection::open(Cli::parse().destination).unwrap();
|
let connection = Connection::open(Cli::parse().destination).unwrap();
|
||||||
|
|
||||||
let mut pixels = PixelGrid::max_sized();
|
let mut pixels = PixelGrid::max_sized();
|
||||||
|
@ -23,13 +21,11 @@ fn main() {
|
||||||
pixels.set((y + x_offset) % PIXEL_WIDTH, y, true);
|
pixels.set((y + x_offset) % PIXEL_WIDTH, y, true);
|
||||||
}
|
}
|
||||||
connection
|
connection
|
||||||
.send(
|
.send(Command::BitmapLinearWin(
|
||||||
Command::BitmapLinearWin(
|
Origin(0, 0),
|
||||||
Origin(0, 0),
|
pixels.clone(),
|
||||||
pixels.clone(),
|
CompressionCode::Lzma,
|
||||||
CompressionCode::Lzma,
|
))
|
||||||
)
|
|
||||||
)
|
|
||||||
.unwrap();
|
.unwrap();
|
||||||
thread::sleep(FRAME_PACING);
|
thread::sleep(FRAME_PACING);
|
||||||
}
|
}
|
|
@ -17,7 +17,6 @@ struct Cli {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
env_logger::init();
|
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
|
|
||||||
let connection = Connection::open(cli.destination).unwrap();
|
let connection = Connection::open(cli.destination).unwrap();
|
||||||
|
@ -55,9 +54,7 @@ fn main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
connection
|
connection.send(CharBrightness(origin, luma)).unwrap();
|
||||||
.send(CharBrightness(origin, luma))
|
|
||||||
.unwrap();
|
|
||||||
std::thread::sleep(wait_duration);
|
std::thread::sleep(wait_duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,7 +14,6 @@ struct Cli {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
env_logger::init();
|
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
|
|
||||||
let sleep_duration = Duration::max(
|
let sleep_duration = Duration::max(
|
||||||
|
@ -37,9 +36,7 @@ fn main() {
|
||||||
let bit_vec = BitVec::from(&*pixel_data);
|
let bit_vec = BitVec::from(&*pixel_data);
|
||||||
|
|
||||||
connection
|
connection
|
||||||
.send(
|
.send(Command::BitmapLinearAnd(0, bit_vec, CompressionCode::Lzma))
|
||||||
Command::BitmapLinearAnd(0, bit_vec, CompressionCode::Lzma)
|
|
||||||
)
|
|
||||||
.unwrap();
|
.unwrap();
|
||||||
thread::sleep(sleep_duration);
|
thread::sleep(sleep_duration);
|
||||||
}
|
}
|
|
@ -11,4 +11,4 @@ test = false
|
||||||
cc = "1.0"
|
cc = "1.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
servicepoint_binding_c = { path = "../../crates/servicepoint_binding_c" }
|
servicepoint_binding_c = { path = "../.." }
|
1
crates/servicepoint_binding_c/examples/lang_c/src/lib.rs
Normal file
1
crates/servicepoint_binding_c/examples/lang_c/src/lib.rs
Normal file
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "announce"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2021"
|
|
||||||
publish = false
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
servicepoint = { path = "../../crates/servicepoint" }
|
|
||||||
clap = { version = "4.5", features = ["derive"] }
|
|
||||||
env_logger = "0.11"
|
|
|
@ -1,12 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "game_of_life"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2021"
|
|
||||||
publish = false
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
servicepoint = { path = "../../crates/servicepoint" }
|
|
||||||
clap = { version = "4.5", features = ["derive"] }
|
|
||||||
env_logger = "0.11"
|
|
||||||
|
|
||||||
rand = "0.8.5"
|
|
|
@ -1,10 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "moving_line"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2021"
|
|
||||||
publish = false
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
servicepoint = { path = "../../crates/servicepoint" }
|
|
||||||
clap = { version = "4.5", features = ["derive"] }
|
|
||||||
env_logger = "0.11"
|
|
|
@ -1,12 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "random_brightness"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2021"
|
|
||||||
publish = false
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
servicepoint = { path = "../../crates/servicepoint" }
|
|
||||||
clap = { version = "4.5", features = ["derive"] }
|
|
||||||
env_logger = "0.11"
|
|
||||||
|
|
||||||
rand = "0.8"
|
|
|
@ -1,10 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "wiping_clear"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2021"
|
|
||||||
publish = false
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
servicepoint = { path = "../../crates/servicepoint" }
|
|
||||||
clap = { version = "4.5", features = ["derive"] }
|
|
||||||
env_logger = "0.11"
|
|
Loading…
Reference in a new issue