Light hardware abstraction layer for peripherals.
More...
#include <Arduino.h>
#include <SPI.h>
#include <Wire.h>
#include <stdint.h>
#include <stdio.h>
#include <stdarg.h>
|
| #define | hV_HAL_PERIPHERALS_RELEASE 1001 |
| | Release.
|
| #define | hV_HAL_Serial Serial |
| | SDK library.
|
|
#define | mySerial hV_HAL_Serial |
| | Serial port, synonym.
|
|
|
#define | LOG_TEXT_LENGTH 128 |
| | Buffer size for log messages @detail Recommended 256 for Viewer, 128 otherwise.
|
| #define | LEVEL_CRITICAL 0x0001 |
| | Log level messages.
|
|
#define | LEVEL_INFO 0x0008 |
| | . Information
|
|
#define | LEVEL_DEBUG 0x0010 |
| | - Debug
|
|
#define | LEVEL_SYSTEM 0x0020 |
| | = System
|
|
| void | hV_HAL_log (uint16_t level, const char *format,...) |
| | Send debug message to console.
|
| void | hV_HAL_begin () |
| | General initialisation.
|
| void | hV_HAL_exit (uint8_t code=0) |
| | General exit.
|
Formatted output to hV_HAL_Serial
- Note
- Console already initialised at 115200 by hV_HAL_begin() (6.0.7)
|
| void | hV_HAL_Serial_printf (const char *format,...) |
| | Format and send to console.
|
|
void | hV_HAL_Serial_crlf (void) |
| | Print carriage-return line-feed.
|
- Warning
- SPI.begin()
- Arduino: no parameters
- ESP32: required parameters for SCK, MOSI and MISO
|
| 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_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.
|
| void | hV_HAL_Wire_begin () |
| | Configure and start Wire bus.
|
| void | hV_HAL_Wire_end () |
| | End Wire bus.
|
| uint8_t | hV_HAL_Wire_transfer (uint8_t address, uint8_t *dataWrite, size_t sizeWrite, uint8_t *dataRead=0, size_t sizeRead=0, uint32_t us=0) |
| | Combined write and read with optional delay.
|
|
| #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.
|
| 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.
Based on highView technology
- Date
- 21 Dec 2025
- Version
- 1001
- Copyright
- (c) Pervasive Displays Inc., 2021-2026
-
(c) Etigues, 2010-2026
-
All rights reserved
-
For exclusive use with Pervasive Displays screens
- 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
◆ hV_HAL_GPIO_clear
| #define hV_HAL_GPIO_clear |
( |
| X | ) |
|
Value:
Undefine GPIO.
- Parameters
-
| pin | pin number or pin name according to SDK |
◆ hV_HAL_GPIO_define
| #define hV_HAL_GPIO_define |
( |
| X, |
|
|
| Y ) |
Value:
Undefine GPIO.
- Parameters
-
| pin | pin number or pin name according to SDK |
◆ hV_HAL_GPIO_get
| #define hV_HAL_GPIO_get |
( |
| X | ) |
|
Value:
Undefine GPIO.
- Parameters
-
| pin | pin number or pin name according to SDK |
◆ hV_HAL_GPIO_read
| #define hV_HAL_GPIO_read |
( |
| X | ) |
|
Value:
Undefine GPIO.
- Parameters
-
| pin | pin number or pin name according to SDK |
◆ hV_HAL_GPIO_set
| #define hV_HAL_GPIO_set |
( |
| X | ) |
|
Value:
Undefine GPIO.
- Parameters
-
| pin | pin number or pin name according to SDK |
◆ hV_HAL_GPIO_write
| #define hV_HAL_GPIO_write |
( |
| X, |
|
|
| Y ) |
Value:
Undefine GPIO.
- Parameters
-
| pin | pin number or pin name according to SDK |
◆ hV_HAL_max
| #define hV_HAL_max |
( |
| a, |
|
|
| b ) |
Value:
Maximum of two numbers.
- Parameters
-
| a | first number |
| b | second number |
- Returns
- maximum of a and b
- Note
- Macro more robust than bugged implementation on some platforms
◆ hV_HAL_min
| #define hV_HAL_min |
( |
| a, |
|
|
| b ) |
Value:
Minimum of two numbers.
- Parameters
-
| a | first number |
| b | second number |
- Returns
- minimum of a and b
- Note
- Macro more robust than bugged implementation on some platforms
◆ hV_HAL_PERIPHERALS_RELEASE
| #define hV_HAL_PERIPHERALS_RELEASE 1001 |
Release.
- Deprecated
- Removed synonyms for GPIO (7.0.0)
- Deprecated
- Removed synonyms for Time (7.0.0)
- hV_HAL_delay() is removed. Use hV_HAL_delayMilliseconds() instead (7.0.0)
- Deprecated
- Removed synonyms for Serial (7.0.0)
- Deprecated
- Removed synonyms for SPI (7.0.0)
- Deprecated
- Removed synonyms for Wire (7.0.0)
- Deprecated
- Removed hV_HAL_Serial_print() and hV_HAL_Serial_println() (10.0.0)
◆ hV_HAL_Serial
| #define hV_HAL_Serial Serial |
SDK library.
- See also
- References
SDK other libraries
Other libraries
Serial port
Serial or Serial1
◆ hV_HAL_swap
| #define hV_HAL_swap |
( |
| x, |
|
|
| y ) |
Value:do { __typeof__(x) WORK = x; x = y; y = WORK; } while (0)
Swap numbers.
- Parameters
-
| [out] | x | first number |
| [out] | y | second number |
- Note
- Macro more robust than template for some platforms
template <typename T> T
{
T w = x;
x = y;
y = w;
}
#define hV_HAL_swap(x, y)
Swap numbers.
Definition hV_HAL_Peripherals.h:405
- Note
- __typeof__ recommended over typeof
◆ LEVEL_CRITICAL
| #define LEVEL_CRITICAL 0x0001 |
Log level messages.
* Non-handled error, stop or exit
◆ hV_HAL_begin()
General initialisation.
hV_HAL_Serial initialised at hV_HAL_Serial_Speed
◆ hV_HAL_exit()
| void hV_HAL_exit |
( |
uint8_t | code = 0 | ) |
|
General exit.
- Parameters
-
| code | default = 0 = success, otherwise error |
- Note
- Only used on Linux
◆ hV_HAL_GPIO_begin()
| void hV_HAL_GPIO_begin |
( |
void | | ) |
|
Undefine GPIO.
- Parameters
-
| pin | pin number or pin name according to SDK |
◆ hV_HAL_GPIO_undefine()
| void hV_HAL_GPIO_undefine |
( |
uint8_t | pin | ) |
|
Undefine GPIO.
- Parameters
-
| pin | pin number or pin name according to SDK |
◆ hV_HAL_GPIO_waitFor()
| void hV_HAL_GPIO_waitFor |
( |
uint8_t | pin, |
|
|
uint8_t | state ) |
Wait for GPIO.
- Parameters
-
| pin | pin number or pin name according to SDK |
| state | HIGH or LOW |
◆ hV_HAL_log()
| void hV_HAL_log |
( |
uint16_t | level, |
|
|
const char * | format, |
|
|
| ... ) |
Send debug message to console.
- Parameters
-
- Note
- With final CR-LF
◆ hV_HAL_map()
| long hV_HAL_map |
( |
long | x, |
|
|
long | in_min, |
|
|
long | in_max, |
|
|
long | out_min, |
|
|
long | out_max ) |
Rescale a value.
- Parameters
-
| x | input value |
| in_min | minimal input value |
| in_max | maximum input value |
| out_min | minimum output value |
| out_max | maximum output value |
- Returns
- long output value
- Note
- Formula is
(x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
◆ hV_HAL_Serial_printf()
| void hV_HAL_Serial_printf |
( |
const char * | format, |
|
|
| ... ) |
Format and send to console.
- Parameters
-
◆ hV_HAL_SPI3_begin()
| void hV_HAL_SPI3_begin |
( |
| ) |
|
Configure 3-wire SPI.
- Note
- Select default SCK as clock and MOSI as data (SDIO)
◆ hV_HAL_SPI3_define()
| void hV_HAL_SPI3_define |
( |
uint8_t | pinClock = SCK, |
|
|
uint8_t | pinData = MOSI ) |
Set the 3-wire SPI pins.
- Parameters
-
| pinClock | clock, default = SCK |
| pinData | combined data, default = MOSI |
- Note
- For manual configuration only
- Warning
- SCK and MOSI provided by Arduino SDK
- Some boards require manual configuration
◆ hV_HAL_SPI3_end()
End 3-wire SPI.
- Warning
- Some platforms require freeing the GPIOs used by 3-wire SPI before starting SPI.
◆ hV_HAL_SPI3_read()
| uint8_t hV_HAL_SPI3_read |
( |
| ) |
|
Read a single byte.
- Returns
- read byte
- Note
- Configure the clock pin as output and data pin as input.
- Warning
- /CS to be managed externally.
◆ hV_HAL_SPI3_write()
| void hV_HAL_SPI3_write |
( |
uint8_t | value | ) |
|
Write a single byte.
- Parameters
-
- Note
- Configure the clock and data pins as output.
- Warning
- /CS to be managed externally.
◆ hV_HAL_SPI_begin()
| void hV_HAL_SPI_begin |
( |
uint32_t | speed = 8000000 | ) |
|
Configure and start SPI.
- Parameters
-
| speed | SPI speed in Hz, 8000000 = default |
- Note
- Other parameters are
- Bit order: MSBFIRST
- Data mode: SPI_MODE0
-
With check for unique initialisation
◆ hV_HAL_SPI_end()
End SPI.
- Note
- With check for unique deinitialisation
◆ hV_HAL_SPI_transfer()
| uint8_t hV_HAL_SPI_transfer |
( |
uint8_t | data | ) |
|
Combined write and read of a single byte.
- Parameters
-
- Returns
- read byte
- Warning
- No check for previous initialisation
◆ hV_HAL_Wire_begin()
| void hV_HAL_Wire_begin |
( |
| ) |
|
Configure and start Wire bus.
- Note
- Master mode only
-
With check for unique initialisation
◆ hV_HAL_Wire_end()
End Wire bus.
- Note
- With check for unique deinitialisation
◆ hV_HAL_Wire_transfer()
| uint8_t hV_HAL_Wire_transfer |
( |
uint8_t | address, |
|
|
uint8_t * | dataWrite, |
|
|
size_t | sizeWrite, |
|
|
uint8_t * | dataRead = 0, |
|
|
size_t | sizeRead = 0, |
|
|
uint32_t | us = 0 ) |
Combined write and read with optional delay.
- Parameters
-
| [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 |
| [in] | us | delay in microseconds, default = 0 = no delay |
- Returns
- uint8_t transmission status, RESULT_SUCCESS = 0 or RESULT_ERROR = 1
- Note
- If sizeRead = 0, no read performed
- Warning
- No check for previous initialisation