Chameleon-Mini
Map.h
1 /*
2  * Map.h
3  *
4  * Created on: 07.12.2014
5  * Author: sk
6  */
7 
8 #ifndef MAP_H_
9 #define MAP_H_
10 
11 #include <stdint.h>
12 #include <stdbool.h>
13 #include <avr/pgmspace.h>
14 
15 #define MAP_TEXT_BUF_SIZE 32
16 #define MAP_MAX_TEXT_SIZE (MAP_TEXT_BUF_SIZE - 1)
17 
18 typedef uint8_t MapIdType;
19 typedef const char *MapTextPtrType;
20 
21 const typedef struct {
22  MapIdType Id;
23  const char Text[MAP_TEXT_BUF_SIZE];
24 } MapEntryType;
25 
26 bool MapIdToText(const MapEntryType *MapPtr, uint8_t MapSize, MapIdType Id, char *Text, uint16_t MaxBufferSize);
27 bool MapTextToId(const MapEntryType *MapPtr, uint8_t MapSize, MapTextPtrType Text, MapIdType *IdPtr);
28 void MapToString(const MapEntryType *MapPtr, uint8_t MapSize, char *String, uint16_t MaxBufferSize);
29 
30 #endif /* MAP_H_ */