Files
T2-start-2025/C/t-oer-prc2-cbdb-main-Assignments-Adidas/Adidas/shared/encode.h
Rens Pastoor 11b391b8a1 sync
2025-05-27 22:41:46 +02:00

33 lines
1.1 KiB
C

#ifndef ENCODE_H_
#define ENCODE_H_
#include <stdbool.h>
#include <stdint.h>
/*!
* Split a byte 'value' into two nibbles (4-bits) named 'low' and 'high'.
* See assignment for more details.
*
* @param value: A byte that will be encoded.
* @param low: The address to which the 4 least-significant-bits
* of 'value' will be written.
* @param high: The address to which the 4 most-significant-bits
* of 'value' will be written.
*/
void encode_get_nibbles(uint8_t value, uint8_t* high, uint8_t* low);
/*!
* Encodes a the byte 'value' into two bytes named 'low' and 'high'.
* The encoded bytes contain the parity bits. See assignment for more details.
*
* @param value: A byte that will be encoded.
* @param low: The address to which the encoded value of the
* 4 least-significant-bits of 'value' will be written.
* @param high: The address to which the encoded value of the
* 4 most-significant-bits of 'value' will be written.
*/
void encode_value(uint8_t input, uint8_t* high, uint8_t* low);
#endif