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 810 |
| Release.
|
|
#define | mySerial Serial |
| SDK library.
|
|
|
Patches for implementations on some platforms
|
#define | hV_HAL_min(a, b) ((a) < (b) ? (a) : (b)) |
| Minimum of two numbers.
|
|
#define | hV_HAL_max(a, b) ((a) > (b) ? (a) : (b)) |
| Maximum of two numbers.
|
|
#define | hV_HAL_swap(x, y) do { __typeof__(x) WORK = x; x = y; y = WORK; } while (0) |
| Swap numbers.
|
|
Light hardware abstraction layer for peripherals.
Project Pervasive Displays Library Suite
Based on highView technology
- Author
- Rei Vilo
- Date
- 21 Nov 2024
- Version
- 810
- Copyright
- (c) Rei Vilo, 2010-2024
-
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_max
#define hV_HAL_max |
( |
| a, |
|
|
| b ) ((a) > (b) ? (a) : (b)) |
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 ) ((a) < (b) ? (a) : (b)) |
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_swap
#define hV_HAL_swap |
( |
| x, |
|
|
| y ) 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:230
- Note
__typeof__
recommended over typeof
◆ mySerial
SDK library.
- See also
- References
SDK other libraries
Other libraries
◆ 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_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()
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.
- 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 |
- Note
- If sizeRead = 0, no read performed
- Warning
- No check for previous initialisation
◆ waitFor()
void waitFor |
( |
uint8_t | pin, |
|
|
uint8_t | state = HIGH ) |
Wait for.
- Parameters
-
pin | pin number |
state | state to reach, default = HIGH |