Pervasive Displays Library Suite - Basic edition 8.0.1
Library for Pervasive Displays e-paper screens and EXT3 extension board
Loading...
Searching...
No Matches
hV_Utilities_Common.h File Reference

Utilities for highView Library Suite. More...

Include dependency graph for hV_Utilities_Common.h:
This graph shows which files directly or indirectly include this file:

Macros

#define hV_UTILITIES_RELEASE   801
 Library release number.
 
#define min(a, b)   ((a) < (b) ? (a) : (b))
 
#define max(a, b)   ((a) > (b) ? (a) : (b))
 
Orientation constants
#define ORIENTATION_PORTRAIT   6
 portrait or vertical, higher than large
 
#define ORIENTATION_LANDSCAPE   7
 landscape or horizontal, larger than high
 

Functions

Utilities
void delay_ms (uint32_t ms)
 Blocking delay.
 
int32_t cos32x100 (int32_t degreesX100)
 Cosinus.
 
int32_t sin32x100 (int32_t degreesX100)
 Sinus.
 
String utf2iso (String s)
 UTF-8 to ISO-8859-1 Converter.
 
String formatString (const char *format,...)
 Format string.
 
String trimString (String text)
 Remove leading and ending characters.
 
Range

Utilities to check range, set min and max

uint16_t checkRange (uint16_t value, uint16_t valueMin, uint16_t valueMax)
 Check value in range.
 
void setMinMax (uint16_t value, uint16_t &valueMin, uint16_t &valueMax)
 Update min and max values.
 
uint32_t roundUp (uint32_t value, uint16_t modulo)
 Round-up.
 
void swap (int16_t &a, int16_t &b)
 Swap number, int16_t.
 
void swap (uint16_t &a, uint16_t &b)
 Swap number, uint16_t.
 
void swap (uint8_t &a, uint8_t &b)
 Swap number, uint8_t.
 

Detailed Description

Utilities for highView Library Suite.

Project Pervasive Displays Library Suite
Based on highView technology

Author
Rei Vilo
Date
21 Mar 2024
Version
801
  • 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()

uint16_t checkRange ( uint16_t value,
uint16_t valueMin,
uint16_t valueMax )

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

◆ cos32x100()

int32_t cos32x100 ( int32_t degreesX100)

Cosinus.

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

◆ delay_ms()

void delay_ms ( uint32_t ms)

Blocking delay.

Parameters
msduration in ms
Note
delay_ms() is blocking, as it doesn't use delay()

◆ formatString()

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

Format string.

Based on vsprint

Parameters
formatformat with standard codes
...list of values
Returns
string with values formatted
See also
http://www.cplusplus.com/reference/cstdio/printf/?kw=printf for codes

◆ 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;

◆ setMinMax()

void setMinMax ( uint16_t value,
uint16_t & valueMin,
uint16_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

◆ sin32x100()

int32_t sin32x100 ( int32_t degreesX100)

Sinus.

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

◆ swap() [1/3]

void swap ( int16_t & a,
int16_t & b )

Swap number, int16_t.

Parameters
afirst number
bsecond number

◆ swap() [2/3]

void swap ( uint16_t & a,
uint16_t & b )

Swap number, uint16_t.

Parameters
afirst number
bsecond number

◆ swap() [3/3]

void swap ( uint8_t & a,
uint8_t & b )

Swap number, uint8_t.

Parameters
afirst number
bsecond number

◆ trimString()

String trimString ( String text)

Remove leading and ending characters.

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

◆ utf2iso()

String utf2iso ( String 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/