Contiki-NG
Loading...
Searching...
No Matches
Bit Reversal Library

Files

file  bitrev.c
 Bit reversal library implementation.
 
file  bitrev.h
 Bit reversal library header.
 

Functions

uint8_t bitrev_byte (uint8_t byte)
 Reverse the bits in a single byte.
 
void bitrev_array (uint8_t *data, size_t len)
 Reverse bits in all bytes of an array (in-place)
 
void bitrev_array_copy (const uint8_t *input, uint8_t *output, size_t len)
 Reverse bits in all bytes of an array (copy to output)
 

Detailed Description

This library provides functions for reversing bits in bytes and byte arrays. It's commonly used by radio drivers for protocol compliance (e.g., 802.15.4g).

Function Documentation

◆ bitrev_array()

void bitrev_array ( uint8_t * data,
size_t len )

Reverse bits in all bytes of an array (in-place)

Parameters
dataPointer to the data array
lenLength of the array in bytes

This function modifies the input array in-place, reversing the bit order within each byte. Commonly used for protocol compliance.

Definition at line 72 of file bitrev.c.

Referenced by read().

◆ bitrev_array_copy()

void bitrev_array_copy ( const uint8_t * input,
uint8_t * output,
size_t len )

Reverse bits in all bytes of an array (copy to output)

Parameters
inputPointer to the input data array
outputPointer to the output data array
lenLength of the arrays in bytes

This function copies data from input to output while reversing the bit order within each byte. Input and output arrays must not overlap.

Definition at line 81 of file bitrev.c.

References input().

◆ bitrev_byte()

uint8_t bitrev_byte ( uint8_t byte)

Reverse the bits in a single byte.

Parameters
byteThe input byte
Returns
The byte with bits reversed

Example: bitrev_byte(0xF0) returns 0x0F

Definition at line 66 of file bitrev.c.