forked from RobTillaart/Arduino
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoolArray.h
More file actions
47 lines (41 loc) · 1.04 KB
/
BoolArray.h
File metadata and controls
47 lines (41 loc) · 1.04 KB
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
38
39
40
41
42
43
44
45
46
47
#ifndef BoolArray_H
#define BoolArray_H
//
// FILE: BoolArray.h
// AUTHOR: Rob dot Tillaart at gmail dot com
// VERSION: 0.1.3
// PURPOSE: BoolArray library for Arduino
// HISTORY: See BoolArray.cpp
//
// Released to the public domain
//
// BoolArray implement a compact array of booleans of max size 2000.
// For larger arrays one need to modify the code, or use BitArray.
//
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#define BOOLARRAY_LIB_VERSION "0.1.3"
#define BOOLARRAY_MAXSIZE (250*8)
#define BOOLARRAY_OK 0x00
#define BOOLARRAY_ERROR 0xFF
#define BOOLARRAY_SIZE_ERROR 0xFE
#define BOOLARRAY_INIT_ERROR 0xFD
class BoolArray
{
public:
BoolArray();
~BoolArray();
uint8_t begin(const uint16_t size);
uint8_t clear();
uint8_t setAll(const uint8_t value);
uint8_t get(const uint16_t idx);
uint8_t set(const uint16_t idx, const uint8_t value);
uint8_t toggle(const uint16_t idx);
private:
uint8_t * _ar;
uint16_t _size;
};
#endif