summaryrefslogtreecommitdiff
path: root/project/Core/Src/Homework/endian_converters.c
blob: 724306c7135965ac667bdbc39247b45eae7fe141 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * endian_converters.c
 *
 *  Created on: Sep 22, 2025
 *      Author: sowgro
 */

#include <stdint.h>

uint16_t convert_to_uint16 (uint8_t* p_value) {
	return (p_value[0] << 8) + p_value[1];
}

uint32_t convert_to_uint24(uint8_t* p_value) {
    return (p_value[0] << 16) + (p_value[1] << 8) + p_value[2];
}

uint32_t convert_to_uint32 (uint8_t* p_value) {
	return (p_value[0] << 24) + (p_value[1] << 16) + (p_value[2] << 8) + p_value[3];
}