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_Utilities.h File Reference

Utilities for Pervasive Displays Library Suite - Advanced edition. More...

#include "hV_HAL_Peripherals.h"
#include "hV_List_Boards.h"
#include "hV_List_Types.h"
#include "hV_List_Constants.h"
Include dependency graph for hV_Utilities.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  touch_t
 Structure for touch. More...
 

Macros

#define hV_UTILITIES_RELEASE   902
 Library release number.
 
Orientation constants
#define ORIENTATION_PORTRAIT   6
 portrait or vertical, higher than large
 
#define ORIENTATION_LANDSCAPE   7
 landscape or horizontal, larger than high
 

Functions

Text format functions

Utilities to format float, 64-bit unsigned integer, hexadecimal and period into string

char * utf2iso (char *s)
 UTF-8 to ISO-8859-1 Converter.
 
char * formatString (const char *format,...)
 Format string or char array.
 
char * trimString (char *text)
 Remove leading and ending characters.
 
Numeric functions

Trigonometric functions, range check and management

Note
Advanced edition only
int32_t cos32x100 (int32_t degreesX100)
 Cosinus.
 
int32_t sin32x100 (int32_t degreesX100)
 Sinus.
 
uint8_t getDecimalPlaces (int32_t unit=1)
 Number of decimal places.
 
Miscellaneous functions

Swap and miscellaneous functions

Check value in range

Parameters
valuevalue to check
valueMinrange minimum
valueMaxrange maximum
Returns
value within range
Note
Assuming valueMin < valueMax
  • if value < valueMin, return valueMin
  • if value > valueMax, return valueMax Otherwise, if valueMin > valueMax, valueMin and valueMax are swapped
template<typename T>
checkRange (T value, T valueMin, T valueMax)
 Update min and max values.
 
template<typename T>
void setMinMax (T value, T &valueMin, T &valueMax)
 Update min and max values.
 
uint32_t roundUp (uint32_t value, uint16_t modulo)
 Round-up.
 
Debug functions

Configuration and OTP

Note
Advanced edition only
void debugConfiguration (pins_t board)
 Print the current configuration.
 
void debugOTP (uint8_t *table, uint8_t size, uint16_t codeCOG=0x0000, uint8_t codeDriver=0x00)
 Print the OTP table.
 

Detailed Description

Utilities for Pervasive Displays Library Suite - Advanced edition.

Project Pervasive Displays Library Suite
Based on highView technology

Author
Rei Vilo
Date
21 Jan 2025
Version
902
  • Basic edition: for hobbyists and for basic usage
    Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
    See also
    https://creativecommons.org/licenses/by-sa/4.0/

    Consider the Evaluation or Commercial editions for professionals or organisations and for commercial usage
  • Evaluation edition: for professionals or organisations, evaluation only, no commercial usage
    All rights reserved
  • Commercial edition: for professionals or organisations, commercial usage
    All rights reserved
  • Viewer edition: for professionals or organisations
    All rights reserved
  • Documentation
    All rights reserved

Function Documentation

◆ checkRange()

template<typename T>
T checkRange ( T value,
T valueMin,
T valueMax )

Update min and max values.

Parameters
valuevalue to consider
valueMinminimum value to update if value < valueMin
valueMaxmaximum value to update if value > valueMax
Note
valueMin < valueMax is assumed
Advanced edition only

◆ cos32x100()

int32_t cos32x100 ( int32_t degreesX100)

Cosinus.

Parameters
degreesX100angle in degrees, x100
Returns
cosinus value, x100
Note
This function uses integers only.
Advanced edition only

◆ debugConfiguration()

void debugConfiguration ( pins_t board)

Print the current configuration.

Steps 2 through 11

◆ debugOTP()

void debugOTP ( uint8_t * table,
uint8_t size,
uint16_t codeCOG = 0x0000,
uint8_t codeDriver = 0x00 )

Print the OTP table.

Parameters
tableOTP table
sizesize
codeOTPCOG variant, example COG_BWRY_SMALL

◆ formatString()

char * formatString ( const char * format,
... )

Format string or char array.

Based on vsprint

Parameters
formatformat with standard codes
...list of values
Returns
string or character array with values formatted
Note
All inputs are const char *, use c_str() on Arduino strings
See also
http://www.cplusplus.com/reference/cstdio/printf/?kw=printf for codes

◆ getDecimalPlaces()

uint8_t getDecimalPlaces ( int32_t unit = 1)

Number of decimal places.

Parameters
unit1 = default, 10, 100, 1000
Returns
uint8_t decimal places 0, 1, 2, 3
Note
Advanced edition only

◆ roundUp()

uint32_t roundUp ( uint32_t value,
uint16_t modulo )

Round-up.

Parameters
valuevalue to round-up
modulomodulo
Returns
rounded-up value / modulo
Note
Examples
  • roundUp(7, 8) = 1;
  • roundUp(8, 8) = 1;
  • roundUp(9, 8) = 2;
Advanced edition only

◆ setMinMax()

template<typename T>
void setMinMax ( T value,
T & valueMin,
T & valueMax )

Update min and max values.

Parameters
valuevalue to consider
valueMinminimum value to update if value < valueMin
valueMaxmaximum value to update if value > valueMax
Note
valueMin < valueMax is assumed
Advanced edition only

◆ sin32x100()

int32_t sin32x100 ( int32_t degreesX100)

Sinus.

Parameters
degreesX100angle in degrees, x100
Returns
sinus value, x100
Note
This function uses integers only.
Advanced edition only

◆ trimString()

char * trimString ( char * text)

Remove leading and ending characters.

Parameters
textinput text
Returns
trimmed text
Note
Removed characters are LF CR TAB SPACE '

◆ utf2iso()

char * utf2iso ( char * s)

UTF-8 to ISO-8859-1 Converter.

Parameters
sUTF-8 string, input
Returns
ISO-8859-1 string, output
See also
The Unicode Consortium. The Unicode Standard, Version 6.2.0, (Mountain View, CA: The Unicode Consortium, 2012. ISBN 978-1-936213-07-8) http://www.unicode.org/versions/Unicode6.2.0/