Pervasive Displays Library Suite - Reference Manual 9.0.3
Library for Pervasive Displays e-paper screens, extension boards and development kits
Loading...
Searching...
No Matches
hV_Fonts_Manager.ino File Reference

Main sketch. More...

#include "PDLS_Common.h"
#include "hV_Utilities.h"
#include "hV_Font.h"
#include "hV_Font_Header.h"
#include "EPD_FLASH.h"
Include dependency graph for hV_Fonts_Manager.ino:

Classes

struct  fontFlash_s
 Structure for font, 8 bytes. More...
 

Macros

#define MAX_FONT_NUMBER   64
 Maximum number of fonts.
 
#define USE_RED_GREEN_LED   0
 Use red and green LEDs.
 
Select font families for DejaVu release 1 or 2
#define FONT_MONO   0x40
 Fixed Monotype family.
 
#define FONT_SANS   0x20
 Proportional Sans Serif family.
 
#define FONT_SERIF   0x10
 Proportional Serif family.
 
#define FONT_RELEASE   (FONT_MONO | FONT_SANS | FONT_SERIF)
 selected families
 
Tasks to perform
#define WRITE_FLASH_SECTOR_0   0
 Write or update sector 0.
 
#define WRITE_FLASH_FONTS   0
 Write fonts to Flash.
 
#define SIMULATE_FLASH_SECTOR_0   1
 Simulate sector 0.
 
#define READ_FLASH_SECTOR_0   1
 Read sector 0.
 
#define READ_FLASH_FONTS   1
 Read fonts from Flash.
 
#define GENERATE_FONTS_ENUMERATION   1
 Generate code of header file with fonts enumeration.
 
Options
#define OPTION_ADD_FONTS   0
 Add fonts to existing ones.
 
#define OPTION_FLASH_DEBUG   0
 Debug flash operations.
 
Other SPI CS to keep high

Example for CC1352

#define INACTIVE_CS_1 26
#define INACTIVE_CS_2 37
#define INACTIVE_CS_3 36

Functions

void wait (uint8_t second)
 Wait with countdown.
 
uint8_t loadFont (font_s fontName)
 Load font.
 
void selectFont (uint8_t font)
 Select the font.
 
void printFont (fontFlash_s _font, uint8_t number)
 Print the details of a font.
 
void enumerateFont (fontFlash_s _font)
 Print a summary of a font.
 
uint16_t listFonts ()
 Read sector 0 from Flash and list fonts.
 
uint16_t enumerateFonts ()
 Read sector 0 from Flash and generate fonts enumeration.
 
void flash_program (uint16_t sector, const void *buffer, uint32_t length)
 Write to Flash.
 
void debugSector (uint16_t sector, uint16_t length=512, uint8_t line=32, uint8_t mark=8)
 Debug sector.
 
void debugMemory (const char *text, uint8_t *memory, uint16_t length=512, uint8_t line=32, uint8_t mark=8)
 Debug memory.
 
void setup ()
 Setup.
 
void loop ()
 Loop.
 

Detailed Description

Main sketch.

Fonts manager for hV_screen Library Suite

  • Write fonts from header files into SPI Flash
  • List available fonts from SPI Flash

General organisation

  • Sector 0 contains the file allocation table, with a fontFlash_s record for each font.
  • Subsequent sectors contain the fonts.
  • A font always starts at a new sector.
Author
Rei Vilo
emCode
Date
20 Oct 2024
Version
810
See also
ReadMe.txt for references

Fonts for hV_screen Library Suite

Author
Rei Vilo
emCode
Date
20 Sep 2024
Version
810
See also
ReadMe.txt for references

Macro Definition Documentation

◆ MAX_FONT_NUMBER

#define MAX_FONT_NUMBER   64

Maximum number of fonts.

In theory, sector 0= 4096 bytes / 8 bytes/font= 512 fonts

◆ USE_RED_GREEN_LED

#define USE_RED_GREEN_LED   0

Use red and green LEDs.

If available,

  • red = write
  • green = read

Function Documentation

◆ debugMemory()

void debugMemory ( const char * text,
uint8_t * memory,
uint16_t length = 512,
uint8_t line = 32,
uint8_t mark = 8 )

Debug memory.

Parameters
textmessage
memoryaddress pointer
lengthdefault=512 bytes to read
linedefault=32 bytes per line
markdisplay : every default=8 bytes

◆ debugSector()

void debugSector ( uint16_t sector,
uint16_t length = 512,
uint8_t line = 32,
uint8_t mark = 8 )

Debug sector.

Parameters
sector0..255 for 1 MB, sector = 4 kB
lengthdefault=512 bytes to read
linedefault=32 bytes per line
markdisplay : every default=8 bytes

◆ enumerateFont()

void enumerateFont ( fontFlash_s _font)

Print a summary of a font.

Parameters
_fontfont

◆ enumerateFonts()

uint16_t enumerateFonts ( )

Read sector 0 from Flash and generate fonts enumeration.

Returns
number of fonts from Flash
Note
fontFlash[] updated

◆ flash_program()

void flash_program ( uint16_t sector,
const void * buffer,
uint32_t length )

Write to Flash.

Parameters
sectorsector number
buffercontent to write
lengthnumber of bytes

◆ listFonts()

uint16_t listFonts ( )

Read sector 0 from Flash and list fonts.

Returns
number of fonts from Flash
Note
fontFlash[] updated

◆ loadFont()

uint8_t loadFont ( font_s fontName)

Load font.

Load the font into the fonts table

Parameters
fontNamefont name
Returns
number of fonts

◆ loop()

void loop ( )

Loop.

Empty

◆ printFont()

void printFont ( fontFlash_s _font,
uint8_t number )

Print the details of a font.

Parameters
_fontfont
numbernumber to displayed

◆ selectFont()

void selectFont ( uint8_t font)

Select the font.

Parameters
fontfont number

◆ wait()

void wait ( uint8_t second)

Wait with countdown.

Parameters
secondduration, s