I’m working on creating a lightweight managed driver for monochrome LCD’s on a Panda II. I’d like to keep it 100% managed for now (don’t RLP flame me please :))
To put a font on the screen you basically need to bang out some bytes from a predefined “contant byte array” to the display.
On a traditional C platform such an array looks like this:
const Terminal6x8 as byte[672] = (
$04, $00, $00, $00, $00, $00, $00, ' Code for char
$05, $00, $00, $06, $5F, $06, $00, ' Code for char !
$06, $00, $07, $03, $00, $07, $03, ' Code for char "
$06, $00, $24, $7E, $24, $7E, $24, ' Code for char #
$05, $00, $24, $2B, $6A, $12, $00, ' Code for char $
$06, $00, $63, $13, $08, $64, $63, ' Code for char %
$06, $00, $36, $49, $56, $20, $50, ' Code for char &
$04, $00, $00, $07, $03, $00, $00, ' Code for char '
$04, $00, $00, $3E, $41, $00, $00, ' Code for char (
$04, $00, $00, $41, $3E, $00, $00, ' Code for char )
$06, $00, $08, $3E, $1C, $3E, $08, ' Code for char *
$06, $00, $08, $08, $3E, $08, $08, ' Code for char +
$04, $00, $00, $E0, $60, $00, $00, ' Code for char ,
$06, $00, $08, $08, $08, $08, $08, ' Code for char -
$04, $00, $00, $60, $60, $00, $00, ' Code for char .
$06, $00, $20, $10, $08, $04, $02, ' Code for char /
$06, $00, $3E, $51, $49, $45, $3E, ' Code for char 0
$05, $00, $00, $42, $7F, $40, $00, ' Code for char 1
$06, $00, $62, $51, $49, $49, $46, ' Code for char 2
$06, $00, $22, $49, $49, $49, $36, ' Code for char 3
$06, $00, $18, $14, $12, $7F, $10, ' Code for char 4
$06, $00, $2F, $49, $49, $49, $31, ' Code for char 5
$06, $00, $3C, $4A, $49, $49, $30, ' Code for char 6
$06, $00, $01, $71, $09, $05, $03, ' Code for char 7
$06, $00, $36, $49, $49, $49, $36, ' Code for char 8
$06, $00, $06, $49, $49, $29, $1E, ' Code for char 9
)
This is very handy because 1. it can move very fast from the array to the display and 2. the font definitions are stored in the program flash - and not precious RAM on the device.
Is there something similar I can do in C#? The example above is not supported in C#.
I am now considering storing the byte arrays as raw binary objects as a Resource.
Can I read individual bytes out of a resource file without first putting them into an array in memory? In other words, can I transfer straight from resource file to the display?
I see on the devices that support the Bitmap object, you can use Tiny Fonts. This is unfortunately not available on the Panda. Does anyone know if the binary format of these Tiny Fonts are available anywhere so I can implement a parser myself?