10个版本
使用旧版Rust 2015
0.4.2 | 2023年12月13日 |
---|---|
0.4.0 | 2023年4月4日 |
0.3.1 | 2021年5月9日 |
0.3.0 | 2020年7月25日 |
0.1.2 | 2019年6月17日 |
#198 在 嵌入式开发
每月129次下载
用于 2 crates
26KB
467 行
max7219
适用于MAX7219(LED显示器驱动器)的通用平台驱动程序
功能
- 打开/关闭MAX芯片的电源
- 设置LED开关的基本命令。
- 链式支持(最多8个设备)
- 硬件SPI支持(带或不带CS引脚)
变更日志
示例
示例项目在 此仓库
以下是一个使用hifive-revb设备与e310x_hal的简单示例
#![no_std]
#![no_main]
extern crate panic_halt;
use riscv_rt::entry;
use hifive1::hal::prelude::*;
use hifive1::hal::DeviceResources;
use hifive1::pin;
use max7219::*;
#[entry]
fn main() -> ! {
let dr = DeviceResources::take().unwrap();
let p = dr.peripherals;
let gpio = dr.pins;
// Configure clocks
hifive1::clock::configure(p.PRCI, p.AONCLK, 320.mhz().into());
let data = pin!(gpio, spi0_mosi).into_output();
let sck = pin!(gpio, spi0_sck).into_output();
let cs = pin!(gpio, spi0_ss0).into_output();
let mut display = MAX7219::from_pins(1, data, cs, sck).unwrap();
// make sure to wake the display up
display.power_on().unwrap();
// write given octet of ASCII characters with dots specified by 3rd param bits
display.write_str(0, b"pls help", 0b00100000).unwrap();
// set display intensity lower
display.set_intensity(0, 0x1).unwrap();
loop {}
}
致谢
原始作品由 Maikel Wever 完成。由Ales Katona改进并编写文档。
许可证
MIT许可证 (LICENSE 或 http://opensource.org/licenses/MIT)
依赖
~71KB