SX126x-Arduino
Macros | Functions | Variables
utilities.cpp File Reference
#include <stdlib.h>
#include <stdio.h>
#include "boards/mcu/board.h"
#include "utilities.h"

Macros

#define RAND_LOCAL_MAX   2147483647L
 

Functions

int32_t rand1 (void)
 
void srand1 (uint32_t seed)
 Initializes the pseudo random generator initial value. More...
 
int32_t randr (int32_t min, int32_t max)
 Computes a random number between min and max. More...
 
void memcpy1 (uint8_t *dst, const uint8_t *src, uint16_t size)
 Copies size elements of src array to dst array. More...
 
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. More...
 
void memset1 (uint8_t *dst, uint8_t value, uint16_t size)
 Set size elements of dst array with value. More...
 
int8_t Nibble2HexChar (uint8_t a)
 Converts a nibble to an hexadecimal character. More...
 

Variables

static uint32_t next = 1
 

Macro Definition Documentation

◆ RAND_LOCAL_MAX

#define RAND_LOCAL_MAX   2147483647L

Redefinition of rand() and srand() standard C functions. These functions are redefined in order to get the same behavior across different compiler toolchains implementations.

Function Documentation

◆ rand1()

int32_t rand1 ( void  )

◆ srand1()

void srand1 ( uint32_t  seed)

Initializes the pseudo random generator initial value.

Parameters
[IN]seed Pseudo random generator initial value

◆ randr()

int32_t randr ( int32_t  min,
int32_t  max 
)

Computes a random number between min and max.

Parameters
[IN]min range minimum value
[IN]max range maximum value
Return values
randomrandom value in range min..max

◆ memcpy1()

void memcpy1 ( uint8_t *  dst,
const uint8_t *  src,
uint16_t  size 
)

Copies size elements of src array to dst array.

Remarks
STM32 Standard memcpy function only works on pointers that are aligned
Parameters
[OUT]dst Destination array
[IN]src Source array
[IN]size Number of bytes to be copied

◆ 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.

Parameters
[OUT]dst Destination array
[IN]src Source array
[IN]size Number of bytes to be copied

◆ memset1()

void memset1 ( uint8_t *  dst,
uint8_t  value,
uint16_t  size 
)

Set size elements of dst array with value.

Remarks
STM32 Standard memset function only works on pointers that are aligned
Parameters
[OUT]dst Destination array
[IN]value Default value
[IN]size Number of bytes to be copied

◆ Nibble2HexChar()

int8_t Nibble2HexChar ( uint8_t  a)

Converts a nibble to an hexadecimal character.

Parameters
[IN]a Nibble to be converted
Return values
hexCharConverted hexadecimal character

Variable Documentation

◆ next

uint32_t next = 1
static