Function image_to_oled::to_oled_byte_array
source · pub fn to_oled_byte_array(
frame_buffer: &FrameBuffer,
brightness_threshold: u8
) -> FrameExpand description
Converts RGB pixels to a 128x64 SSD1306 OLED byte array.
brightness_threshold is used to determine if a pixel is black or white.
If the brightness of a pixel is above the given threshold the pixel becomes white, else it becomes black.
Example
use image_to_oled::to_oled_byte_array;
let image_buffer: ImageBuffer<Rgb<u8>, Vec<u8>> =
ImageBuffer::from_vec(2, 2, vec![30; 12]).unwrap();
let byte_array = to_oled_byte_array(&image_buffer, 30);