-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutilities.h
More file actions
30 lines (25 loc) · 788 Bytes
/
utilities.h
File metadata and controls
30 lines (25 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef UTILITIES_H
#define UTILITIES_H
#pragma once
#define DEBUG // If enable, debugging routines will be compiled
#define DEBUG
#ifdef __AVR__
#include "../lib_uart/uart.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <string.h>
#define OPPOSITE_BIT(i) (i == 0) ? 1 : 0
#ifdef __AVR__
int freeRam(); // Returns the memory available
#else
char bin_to_ascii(uint8_t bin);
uint8_t ascii_to_bin(char bin);
#endif
#ifdef DEBUG
void print_var_bits(uint16_t var, uint8_t n);
void error(char* str); // Exit the program with the error code EXIT_FAILED
#endif
uint16_t int_pow(uint16_t a, uint16_t b); // Computes a^b
#endif // UTILITIES_H