finished adidas v1.0

This commit is contained in:
Rens Pastoor
2025-06-05 15:19:10 +02:00
parent 8e5cfa974b
commit 34ebc83b3e
6 changed files with 81 additions and 37 deletions

View File

@@ -1,10 +1,16 @@
#include "channel.h"
#include <time.h>
// add here your implementation
void channel_init(){
#include <stdlib.h>
void channel_init(){
srand((unsigned int)time(NULL));
}
uint8_t channel_change_one_random_bit(uint8_t value){
// Generate random bit position (0-7)
uint8_t bit_position = rand() % 8;
uint8_t bit_mask = 1 << bit_position;
// XOR with the mask to flip the bit
// 01101010 with mask 00000100 becomes 01101110
return value ^ bit_mask;
}

View File

@@ -5,9 +5,9 @@ uint8_t decode_combine_nibbles(uint8_t high, uint8_t low){
uint8_t byte;
uint8_t high_nibble;
uint8_t low_nibble;
decode_byte(high,high_nibble);
decode_byte(low,low_nibble);
combine_nibles_to_byte(high_nibble, low_nibble, byte);
decode_byte(high,&high_nibble);
decode_byte(low,&low_nibble);
combine_nibles_to_byte(high_nibble, low_nibble, &byte);
return byte;
}