Skip to content

Commit f6a6909

Browse files
author
mito
committed
漢字フォントの実装
スクロールなし
1 parent cd94aac commit f6a6909

File tree

4 files changed

+27
-20
lines changed

4 files changed

+27
-20
lines changed

Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ panic-halt = "0.2.0"
2828
version = "0.10.0"
2929
features = ["stm32f401", "rt"]
3030

31+
[dependencies.misakifont]
32+
path = "../misakifont/misakifont"
33+
3134
# this lets you use `cargo fix`!
3235
[[bin]]
3336
name = "matrixled"

conveuc.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
iconv -t EUCJP | od -An -tx1 --endian=big | awk '{c="0x"$1;for(i=2;i<NF;i++) c=c",0x"$i; print c}'

core

15.4 MB
Binary file not shown.

src/main.rs

+21-20
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ extern crate panic_halt; // you can put a breakpoint on `rust_begin_unwind` to c
1010
//use cortex_m::asm;
1111
use cortex_m_rt::entry;
1212
use stm32f4::stm32f401;
13-
use cortex_m_semihosting::dbg;
13+
//use cortex_m_semihosting::dbg;
14+
15+
use misakifont::font88::FONT88;
1416

1517
#[entry]
1618
fn main() -> ! {
@@ -25,25 +27,24 @@ fn main() -> ! {
2527
device.GPIOA.bsrr.write(|w| w.bs10().set());
2628
//device.GPIOA.bsrr.write(|w| w.bs11().set());
2729

28-
send_oneline_mat_led(&device, 0, 0b00111000_01100000_00000000_00000010);
29-
send_oneline_mat_led(&device, 1, 0b01000100_10010000_00000000_00010101);
30-
send_oneline_mat_led(&device, 2, 0b10000011_00001000_00000000_00101010);
31-
send_oneline_mat_led(&device, 3, 0b01000000_00010000_00000000_00010000);
32-
send_oneline_mat_led(&device, 4, 0b00100000_00100000_01000101_00010000);
33-
send_oneline_mat_led(&device, 5, 0b00010000_01000000_01000101_00010000);
34-
send_oneline_mat_led(&device, 6, 0b00001000_10000000_00101000_10100000);
35-
send_oneline_mat_led(&device, 7, 0b00000111_00000000_00010000_01000000);
36-
/*
37-
send_oneline_mat_led(&device, 0, 0x5555AAAA);
38-
send_oneline_mat_led(&device, 1, 0xAAAA5555);
39-
send_oneline_mat_led(&device, 2, 0x5555AAAA);
40-
send_oneline_mat_led(&device, 3, 0xAAAA5555);
41-
send_oneline_mat_led(&device, 4, 0x5555AAAA);
42-
send_oneline_mat_led(&device, 5, 0xAAAA5555);
43-
send_oneline_mat_led(&device, 6, 0x5555AAAA);
44-
send_oneline_mat_led(&device, 7, 0xAAAA5555);
30+
let mut video = [0u32; 8];
31+
//let font = FONT48.get_char(0x52);
32+
let chars=[0xc3,0xdd,0xb2,0xd6,0xcd,0xa5,0xbb,0xd2];
33+
let mut x = 24;
34+
for c in 0..4 {
35+
let font = FONT88.get_char(chars[c*2],chars[c*2+1]);
36+
for i in 0..8 {
37+
video[i] |= ( font[i] as u32) << x ;
38+
}
39+
x -= 8;
40+
}
41+
for i in 0..8 {
42+
send_oneline_mat_led(&device, i, video[i as usize]);
43+
}
44+
45+
46+
4547
device.GPIOA.bsrr.write(|w| w.bs11().set());
46-
*/
4748

4849
loop {
4950
// your code goes here
@@ -74,7 +75,7 @@ fn send_oneline_mat_led(device: &stm32f401::Peripherals, line_num: u32, pat: u32
7475
fn init_mat_led(device: &stm32f401::Peripherals) {
7576
const INIT_PAT: [u16; 5] = [0x0F00, // テストモード解除
7677
0x0900, // BCDデコードバイパス
77-
0x0A08, // 輝度制御 下位4bit MAX:F
78+
0x0A03, // 輝度制御 下位4bit MAX:F
7879
0x0B07, // スキャン桁指定 下位4bit MAX:7
7980
0x0C01, // シャットダウンモード 解除
8081
];

0 commit comments

Comments
 (0)