-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.h
37 lines (30 loc) · 1.05 KB
/
data.h
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
31
32
33
34
35
36
37
#ifndef DATA_H
#define DATA_H
#pragma once
#define DEBUG
#ifdef DEBUG
#ifdef __AVR__
#include "../lib_uart/uart.h"
#endif
#endif
#include "../lib_utilities/utilities.h"
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
struct Data
{
uint16_t data_number; // Number of data contained in "data_array"
uint8_t* data_array; // Array of uint8_t containing data
};
// Data generation/free
struct Data* data_generate(uint16_t data_number);
// Data operations
uint8_t data_get(uint16_t n, struct Data* d); // Returns the n-th data stored. Starting from 0.
void data_set(uint16_t n, uint8_t data, struct Data* d); // Sets the n-th block of d to data={0,1}
void data_delete(uint16_t n, struct Data* d); // Delete the n-th block of d
void data_free(struct Data* d);
#ifdef DEBUG
// Prints out a data structure. Not adapted to AVR.
void data_show(struct Data* d);
#endif
#endif // DATA_H