3642BS driver for embedded devices
Makes displaying stuff on the 3642BS easy.
Documentation
Allows you to display dec and hex numbers as well as the time and your own custom characters with a single line of code.
display.clear.unwrap;
display.number.unwrap;
display.hex.unwrap;
display.time.unwrap; // ===A===
// ‖ ‖
// Make your own custom characters: // F B
let letter_c = SEG_A | SEG_F | SEG_E | SEG_D; // ‖ ‖
let letter_o = SEG_G | SEG_E | SEG_C | SEG_D; // ===G===
let letter_l = SEG_F | SEG_E | SEG_D; // ‖ ‖
let text_cool = ; // E C
// ‖ ‖
display.custom.unwrap; // ===D===
How to use
Include the library on your cargo.toml
= "0.3.2"
Define which pins are going to be used:
let mut display = new;
Since the display has to be multiplexed, delays can't be used on the same core the library is on, or the display will freeze on a single digit. For this reason I recommend using alarms or timers. You can also use async tasks with Embassy.
Example using Alarm0 (On the rpi pico):
// Other code like defining the pins and importing libraries.
// You'll need to import fugit::ExtU32
let mut timer = new;
// Other code like defining the Display struct
let alarm = timer.alarm_1.unwrap;
loop
Example using Timer (on the rpi pico):
// Other code like defining the pins and importing libraries
let mut timer = new;
let mut count_down = timer.count_down;
// Other code like defining the Display struct
let mut prev_time = timer.get_counter;
loop
Example using the Real Time Clock (on the pi pico):
let mut watchdog = new;
let clocks = init_clocks_and_plls.ok.unwrap;
let initial_date = DateTime ;
let real_time_clock = new.unwrap;
let mut prev_time = real_time_clock.now.unwrap.second;
loop