Pervasive Displays Library Suite - Basic edition  5.2.4
Library for Pervasive Displays e-paper screens and EXT3 extension board
hV_Utilities.h File Reference

Utilities for highView Library Suite. More...

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

Macros

#define hV_UTILITIES_RELEASE   507
 Library release number.
 
#define min(a, b)   ((a) < (b) ? (a) : (b))
 
#define max(a, b)   ((a) > (b) ? (a) : (b))
 
Orientation 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. More...
 
int32_t cos32x100 (int32_t degreesX100)
 Cosinus. More...
 
int32_t sin32x100 (int32_t degreesX100)
 Sinus. More...
 
String utf2iso (String s)
 UTF-8 to ISO-8859-1 Converter. More...
 
String formatString (const char *format,...)
 Format string. More...
 
String trimString (String text)
 Remove leading and ending characters. More...
 
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. More...
 
void setMinMax (uint16_t value, uint16_t &valueMin, uint16_t &valueMax)
 Update min and max values. More...
 
uint32_t roundUp (uint32_t value, uint16_t modulo)
 Round-up. More...
 
void swap (int16_t &a, int16_t &b)
 Swap number, int16_t. More...
 
void swap (uint16_t &a, uint16_t &b)
 Swap number, uint16_t. More...
 
void swap (uint8_t &a, uint8_t &b)
 Swap number, uint8_t. More...
 

Detailed Description

Utilities for highView Library Suite.

Project Pervasive Displays Library Suite
Based on highView technology

Author
Rei Vilo
Date
02 Nov 2021
Version
521

The highView Library Suite is shared under the Creative Commons licence Attribution-NonCommercial-ShareAlike 4.0 Unported (CC BY-NC-SA 4.0).

  • Basic edition: for hobbyists and for personal usage
    Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported (CC BY-NC-SA 4.0)
See also
https://creativecommons.org/licenses/by-nc-sa/4.0/


Consider the advanced or commercial editions for professionals or organisations and for commercial usage

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/