Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ serde_json = { version = "1.0.140", optional = true }
time = "0.3.41"
toml = { version = "0.9.2", optional = true }
zerocopy = { version = "0.8.26", features = ["derive"] }
u8g2-fonts = { version = "0.7.1", features = ["embedded_graphics_textstyle"] }
17 changes: 9 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@
use std::{fs, path::PathBuf};

use anyhow::{Context, Result};
use badgemagic::{
ble::Device as BleDevice,
protocol::{Mode, PayloadBuffer, Speed, Style},
usb_hid::Device as UsbDevice,
};
use base64::Engine;
use clap::{Parser, ValueEnum};
use embedded_graphics::{
geometry::Point,
image::{Image, ImageRawLE},
mono_font::{iso_8859_1::FONT_6X9, MonoTextStyle},
pixelcolor::BinaryColor,
text::Text,
Drawable, Pixel,
};
use serde::Deserialize;
use u8g2_fonts::{fonts::u8g2_font_lucasfont_alternate_tf, U8g2TextStyle};

use badgemagic::{
ble::Device as BleDevice,
protocol::{Mode, PayloadBuffer, Speed, Style},
usb_hid::Device as UsbDevice,
};

#[derive(Parser)]
/// Upload a configuration with up to 8 messages to an LED badge
Expand Down Expand Up @@ -162,8 +163,8 @@ fn gnerate_payload(args: &mut Args) -> Result<PayloadBuffer> {
Content::Text { text } => {
let text = Text::new(
&text,
Point::new(0, 7),
MonoTextStyle::new(&FONT_6X9, BinaryColor::On),
Point::new(0, 8),
U8g2TextStyle::new(u8g2_font_lucasfont_alternate_tf, BinaryColor::On),
);
payload.add_message_drawable(style, &text);
}
Expand Down