| SX126x-Arduino 2.0.1

utilities.h
Go to the documentation of this file.
1 /*
2 / _____) _ | |
3 ( (____ _____ ____ _| |_ _____ ____| |__
4 \____ \| ___ | (_ _) ___ |/ ___) _ \
5 _____) ) ____| | | || |_| ____( (___| | | |
6 (______/|_____)_|_|_| \__)_____)\____)_| |_|
7 (C)2013 Semtech
8
9 Description: Helper functions implementation
10
11 License: Revised BSD License, see LICENSE.TXT file include in the project
12
13 Maintainer: Miguel Luis and Gregory Cristian
14 */
15 #ifndef __UTILITIES_H__
16 #define __UTILITIES_H__
17
18 #include <Arduino.h>
19
20 extern "C"
21 {
28 #define POW2(n) (1 << n)
29
35 void srand1(uint32_t seed);
36
44 int32_t randr(int32_t min, int32_t max);
45
55 void memcpy1(uint8_t *dst, const uint8_t *src, uint16_t size);
56
64 void memcpyr(uint8_t *dst, const uint8_t *src, uint16_t size);
65
75 void memset1(uint8_t *dst, uint8_t value, uint16_t size);
76
83 int8_t Nibble2HexChar(uint8_t a);
84
86 /*lint -emacro(506, MIN) */ /* Suppress "Constant value Boolean */
87 #define MIN(a, b) ((a) < (b) ? (a) : (b))
88
89 /*lint -emacro(506, MAX) */ /* Suppress "Constant value Boolean */
90 #define MAX(a, b) ((a) < (b) ? (b) : (a))
91 };
92 #endif // __UTILITIES_H__
randr
int32_t randr(int32_t min, int32_t max)
Computes a random number between min and max.
Definition: utilities.cpp:44
srand1
void srand1(uint32_t seed)
Initializes the pseudo random generator initial value.
Definition: utilities.cpp:38
Nibble2HexChar
int8_t Nibble2HexChar(uint8_t a)
Converts a nibble to an hexadecimal character.
Definition: utilities.cpp:74
memset1
void memset1(uint8_t *dst, uint8_t value, uint16_t size)
Set size elements of dst array with value.
Definition: utilities.cpp:66
memcpyr
void memcpyr(uint8_t *dst, const uint8_t *src, uint16_t size)
Copies size elements of src array to dst array reversing the byte order.
Definition: utilities.cpp:57
memcpy1
void memcpy1(uint8_t *dst, const uint8_t *src, uint16_t size)
Copies size elements of src array to dst array.
Definition: utilities.cpp:49