mirror of
git://projects.qi-hardware.com/antorcha.git
synced 2024-12-22 18:34:14 +02:00
tornado/fw/txt: xbm2tornado to create #include-able tornado binary; -g for t
This commit is contained in:
parent
a5694eba05
commit
2161eec066
@ -1,2 +1,9 @@
|
||||
#!/bin/sh
|
||||
./txt2xbm TEST | ./stretch 6 | ./xbm2gp "$@" | ./plot
|
||||
T="TEST"
|
||||
F=6
|
||||
if [ "$1" = -g ]; then
|
||||
shift
|
||||
./txt2xbm "$T" | ./stretch $F | ./xbm2gp "$@" | ./plot
|
||||
else
|
||||
./txt2xbm "$T" | ./stretch $F | ./xbm2tornado
|
||||
fi
|
||||
|
37
tornado/fw/txt/xbm2tornado
Executable file
37
tornado/fw/txt/xbm2tornado
Executable file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
sub pick
|
||||
{
|
||||
local ($x, $y) = @_;
|
||||
|
||||
my $i = $x+$y*$X;
|
||||
return ((hex $p[$i >> 3]) >> ($i & 7)) & 1;
|
||||
}
|
||||
|
||||
|
||||
while (<>) {
|
||||
chop;
|
||||
if (/#define\s+\S+_width\s+(\d+)/) {
|
||||
$X = $1;
|
||||
next;
|
||||
}
|
||||
if (/#define\s+\S+_height\s+(\d+)/) {
|
||||
$Y = $1;
|
||||
next;
|
||||
}
|
||||
next unless /\s*0x/;
|
||||
s/^\s*//;
|
||||
s/(,|};)$//;
|
||||
push(@p, split /,/);
|
||||
}
|
||||
|
||||
for ($x = 0; $x != $X; $x++) {
|
||||
for ($y = 0; $y != $Y; $y += 8) {
|
||||
$v = 0;
|
||||
for ($i = 0; $i != 8; $i++) {
|
||||
$v |= 1 << $i if &pick($x, $y+$i);
|
||||
}
|
||||
print sprintf("0x%02x, ", $v);
|
||||
}
|
||||
}
|
||||
print "\n";
|
Loading…
Reference in New Issue
Block a user