Pervasive Displays Library Suite - Reference Manual 9.0.3
Library for Pervasive Displays e-paper screens, extension boards and development kits
|
Light hardware abstraction layer for peripherals. More...
#include "hV_SDK_Peripherals.h"
Macros | |
#define | hV_HAL_PERIPHERALS_RELEASE 902 |
Release. | |
SDK to HAL equivalences | |
SDK library | |
#define | hV_HAL_SPI hV_SDK_SPI |
SPI bus. | |
#define | hV_HAL_SPI_SPEED hV_SDK_SPI_SPEED |
SPI speed. | |
#define | hV_HAL_Wire hV_SDK_Wire |
Wire I²C bus. | |
#define | hV_HAL_Serial hV_SDK_Serial |
Serial bus. | |
#define | hV_HAL_Serial_Speed hV_SDK_Serial_Speed |
Serial speed. | |
#define | mySerial hV_HAL_Serial |
Synonym for serial bus. | |
Log system | |
#define | LEVEL_CRITICAL 0x0001 |
Log level messages. | |
#define | LEVEL_ERROR 0x0002 |
+ Handled error, continue | |
#define | LEVEL_WARNING 0x0004 |
! Warning | |
#define | LEVEL_INFO 0x0008 |
. Information | |
#define | LEVEL_DEBUG 0x0010 |
- Debug | |
#define | LEVEL_SYSTEM 0x0020 |
= System | |
#define | LEVEL_USER 0x0040 |
> User | |
#define | FILTER_ALL 0x00ff |
Allow all log levels. | |
#define | FILTER_NONE 0x0000 |
Deny all log levels. | |
#define | WITH_COMMENT 0x0100 |
= Option with leading // | |
#define | WITH_NO_CRLF 0x0200 |
Option with no CR-LF. | |
#define | WITH_NO_LEVEL 0x0400 |
Option with no level. | |
#define | WITH_CHRONO 0x0800 |
Option with chronometer in s.ms. | |
Functions | |
void | hV_HAL_log (uint16_t level, const char *format,...) |
Send debug message to console. | |
void | hV_HAL_setFilter (uint8_t filter=0x00ff) |
Set filter to allow log levels. | |
void | hV_HAL_setOption (uint16_t option=0x0100) |
Set option for log messages. | |
General | |
void | hV_HAL_begin () |
General initialisation. | |
void | hV_HAL_end () |
General end. | |
void | hV_HAL_exit (uint8_t code=0) |
General exit. | |
GPIO | |
| |
void | hV_HAL_GPIO_begin (void) |
GPIO initialisation. | |
void | hV_HAL_GPIO_define (uint8_t pin, uint8_t mode) |
Define GPIO mode. | |
void | hV_HAL_GPIO_set (uint8_t pin) |
Set GPIO. | |
void | hV_HAL_GPIO_clear (uint8_t pin) |
Clear GPIO. | |
uint8_t | hV_HAL_GPIO_get (uint8_t pin) |
Get GPIO. | |
void | hV_HAL_GPIO_write (uint8_t pin, uint8_t value) |
Write GPIO. | |
uint8_t | hV_HAL_GPIO_read (uint8_t pin) |
Read GPIO. | |
void | hV_HAL_GPIO_waitFor (uint8_t pin, uint8_t state) |
Wait for GPIO state. | |
Time | |
void | hV_HAL_delayMicroseconds (uint32_t us) |
Microsecond non-blocking delay. | |
void | hV_HAL_delayMilliseconds (uint32_t ms) |
Millisecond non-blocking delay. | |
uint32_t | hV_HAL_getMilliseconds (void) |
Get milliseconds since start-up. | |
Serial console | |
Formatted output to hV_HAL_Serial | |
void | hV_HAL_Serial_begin (uint32_t speed=115200) |
Initialise console. | |
void | hV_HAL_Serial_printf (const char *format,...) |
Format and send to console. | |
void | hV_HAL_Serial_crlf (void) |
Print carriage-return line-feed. | |
template<typename T> | |
void | hV_HAL_Serial_print (T text) |
Print to serial console. | |
template<typename T> | |
void | hV_HAL_Serial_println (T text) |
Print to serial console with cr-lf at the end. | |
SPI bus | |
| |
void | hV_HAL_SPI_begin (uint32_t speed=8000000) |
Configure and start SPI. | |
void | hV_HAL_SPI_end () |
End SPI. | |
uint8_t | hV_HAL_SPI_transfer (uint8_t data) |
Combined write and read of a single byte. | |
void | hV_HAL_SPI_transfer (uint8_t *data, size_t size) |
Combined write and read. | |
3-wire SPI bus | |
| |
void | hV_HAL_SPI3_begin () |
Configure 3-wire SPI. | |
void | hV_HAL_SPI3_end () |
End 3-wire SPI. | |
void | hV_HAL_SPI3_define (uint8_t pinClock=SCK, uint8_t pinData=MOSI) |
Set the 3-wire SPI pins. | |
uint8_t | hV_HAL_SPI3_read () |
Read a single byte. | |
void | hV_HAL_SPI3_write (uint8_t value) |
Write a single byte. | |
Wire bus | |
void | hV_HAL_Wire_begin () |
Configure and start Wire bus. | |
void | hV_HAL_Wire_end () |
End Wire bus. | |
void | hV_HAL_Wire_transfer (uint8_t address, uint8_t *dataWrite, size_t sizeWrite, uint8_t *dataRead=0, size_t sizeRead=0) |
Combined write and read. | |
Miscellaneous | |
Patches for implementations on some platforms | |
#define | hV_HAL_min(a, b) |
Minimum of two numbers. | |
#define | hV_HAL_max(a, b) |
Maximum of two numbers. | |
#define | hV_HAL_swap(x, y) |
Swap numbers. | |
uint32_t | hV_HAL_random (uint32_t maxNumber) |
Pseudo-random number. | |
long | hV_HAL_map (long x, long in_min, long in_max, long out_min, long out_max) |
Rescale a value. | |
Light hardware abstraction layer for peripherals.
Project Pervasive Displays Library Suite
Based on highView technology
#define hV_HAL_max | ( | a, | |
b ) |
Maximum of two numbers.
a | first number |
b | second number |
#define hV_HAL_min | ( | a, | |
b ) |
Minimum of two numbers.
a | first number |
b | second number |
#define hV_HAL_PERIPHERALS_RELEASE 902 |
Release.
#define hV_HAL_swap | ( | x, | |
y ) |
Swap numbers.
[out] | x | first number |
[out] | y | second number |
__typeof__
recommended over typeof
#define LEVEL_CRITICAL 0x0001 |
Log level messages.
*
Non-handled error, stop or exit
void hV_HAL_begin | ( | ) |
General initialisation.
hV_HAL_Serial initialised at hV_HAL_Serial_Speed
void hV_HAL_delayMicroseconds | ( | uint32_t | us | ) |
Microsecond non-blocking delay.
us | delay, us |
void hV_HAL_delayMilliseconds | ( | uint32_t | ms | ) |
Millisecond non-blocking delay.
ms | delay, ms |
void hV_HAL_end | ( | ) |
General end.
void hV_HAL_exit | ( | uint8_t | code = 0 | ) |
General exit.
code | default = 0 = success, otherwise error |
uint32_t hV_HAL_getMilliseconds | ( | void | ) |
Get milliseconds since start-up.
void hV_HAL_GPIO_begin | ( | void | ) |
GPIO initialisation.
Required for GPIO expander
void hV_HAL_GPIO_clear | ( | uint8_t | pin | ) |
Clear GPIO.
pin | pin number or pin name according to SDK |
void hV_HAL_GPIO_define | ( | uint8_t | pin, |
uint8_t | mode ) |
Define GPIO mode.
pin | pin number or pin name according to SDK |
mode | OUTPUT or INPUT |
uint8_t hV_HAL_GPIO_get | ( | uint8_t | pin | ) |
Get GPIO.
pin | pin number or pin name according to SDK |
uint8_t hV_HAL_GPIO_read | ( | uint8_t | pin | ) |
Read GPIO.
pin | pin number or pin name according to SDK |
void hV_HAL_GPIO_set | ( | uint8_t | pin | ) |
Set GPIO.
pin | pin number or pin name according to SDK |
void hV_HAL_GPIO_waitFor | ( | uint8_t | pin, |
uint8_t | state ) |
Wait for GPIO state.
pin | pin number or pin name according to SDK |
state | state to wait for, HIGH or LOW |
void hV_HAL_GPIO_write | ( | uint8_t | pin, |
uint8_t | value ) |
Write GPIO.
pin | pin number or pin name according to SDK |
value | HIGH = true or LOW = false |
void hV_HAL_log | ( | uint16_t | level, |
const char * | format, | ||
... ) |
Send debug message to console.
level | Debug level message |
format | see https://www.cplusplus.com/reference/cstdio/printf/ for tokens |
long hV_HAL_map | ( | long | x, |
long | in_min, | ||
long | in_max, | ||
long | out_min, | ||
long | out_max ) |
Rescale a value.
x | input value |
in_min | minimal input value |
in_max | maximum input value |
out_min | minimum output value |
out_max | maximum output value |
uint32_t hV_HAL_random | ( | uint32_t | maxNumber | ) |
Pseudo-random number.
maxNumber | maximum random number |
void hV_HAL_Serial_begin | ( | uint32_t | speed = 115200 | ) |
Initialise console.
speed | in bps, eg. 115200 |
void hV_HAL_Serial_print | ( | T | text | ) |
Print to serial console.
T | type of the element, [u]int{8|16|32}_t float String char* |
text | element to print |
void hV_HAL_Serial_printf | ( | const char * | format, |
... ) |
Format and send to console.
format | see https://www.cplusplus.com/reference/cstdio/printf/ for tokens |
void hV_HAL_Serial_println | ( | T | text | ) |
Print to serial console with cr-lf at the end.
T | type of the element: [u]int{8|16|32}_t float String char* |
text | element to print |
void hV_HAL_setFilter | ( | uint8_t | filter = 0x00ff | ) |
Set filter to allow log levels.
filter | default = FILTER_ALL |
void hV_HAL_setOption | ( | uint16_t | option = 0x0100 | ) |
Set option for log messages.
option | WITH_COMMENT = default, WITH_NO_CRLF, WITH_NO_LEVEL |
void hV_HAL_SPI3_begin | ( | ) |
Configure 3-wire SPI.
void hV_HAL_SPI3_define | ( | uint8_t | pinClock = SCK, |
uint8_t | pinData = MOSI ) |
Set the 3-wire SPI pins.
pinClock | clock, default = SCK |
pinData | combined data, default = MOSI |
uint8_t hV_HAL_SPI3_read | ( | ) |
Read a single byte.
void hV_HAL_SPI3_write | ( | uint8_t | value | ) |
Write a single byte.
data | byte |
void hV_HAL_SPI_begin | ( | uint32_t | speed = 8000000 | ) |
Configure and start SPI.
speed | SPI speed in Hz, hV_HAL_SPI_SPEED = default Other values are SPI_SPEED_4_MHz, SPI_SPEED_8_MHz, SPI_SPEED_16_MHz |
void hV_HAL_SPI_end | ( | ) |
End SPI.
void hV_HAL_SPI_transfer | ( | uint8_t * | data, |
size_t | size ) |
Combined write and read.
data | array of uint8_t to send |
size | length |
uint8_t hV_HAL_SPI_transfer | ( | uint8_t | data | ) |
Combined write and read of a single byte.
data | byte |
void hV_HAL_Wire_begin | ( | ) |
Configure and start Wire bus.
void hV_HAL_Wire_end | ( | ) |
End Wire bus.
void hV_HAL_Wire_transfer | ( | uint8_t | address, |
uint8_t * | dataWrite, | ||
size_t | sizeWrite, | ||
uint8_t * | dataRead = 0, | ||
size_t | sizeRead = 0 ) |
Combined write and read.
[in] | address | I2C device address |
[in] | dataWrite | buffer to write |
[in] | sizeWrite | number of bytes |
[out] | dataRead | buffer to read |
[in] | sizeRead | number of bytes |