fix rebase module05
This commit is contained in:
@@ -12,6 +12,11 @@
|
||||
#include "usart.h"
|
||||
#include "adc.h"
|
||||
|
||||
//
|
||||
// GLOBAL
|
||||
//
|
||||
extern volatile uint8_t adc_channel;
|
||||
|
||||
//
|
||||
// PROTOTYPES
|
||||
//
|
||||
|
||||
@@ -26,4 +26,4 @@ int main() {
|
||||
timer_1B_init();
|
||||
|
||||
while(1);
|
||||
}
|
||||
}
|
||||
9
module05/ex01/math.c
Normal file
9
module05/ex01/math.c
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "header.h"
|
||||
|
||||
void int_to_hex_string(uint64_t value, char *out, uint8_t num_digits) { // num_digits : number of digit of the output, ex 2 for 3FF (1023) -> FF
|
||||
for (uint8_t i = 0; i < num_digits; ++i) {
|
||||
uint8_t shift = (num_digits - 1 - i) * 4;
|
||||
out[i] = INT_TO_HEX_CHAR((value >> shift) & 0x0F);
|
||||
}
|
||||
out[num_digits] = '\0';
|
||||
}
|
||||
Reference in New Issue
Block a user