mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.2.5 BitArray
This commit is contained in:
parent
f4128bd493
commit
6115e2c382
@ -1,3 +1,18 @@
|
||||
platforms:
|
||||
rpipico:
|
||||
board: rp2040:rp2040:rpipico
|
||||
package: rp2040:rp2040
|
||||
gcc:
|
||||
features:
|
||||
defines:
|
||||
- ARDUINO_ARCH_RP2040
|
||||
warnings:
|
||||
flags:
|
||||
|
||||
packages:
|
||||
rp2040:rp2040:
|
||||
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
|
||||
|
||||
compile:
|
||||
# Choosing to run compilation tests on 2 different Arduino platforms
|
||||
platforms:
|
||||
@ -7,5 +22,8 @@ compile:
|
||||
# - leonardo
|
||||
- m4
|
||||
- esp32
|
||||
# - esp8266
|
||||
- esp8266
|
||||
# - mega2560
|
||||
- rpipico
|
||||
libraries:
|
||||
- "printHelpers"
|
||||
|
@ -1,27 +1,12 @@
|
||||
//
|
||||
// FILE: BitArray.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.2.4
|
||||
// VERSION: 0.2.5
|
||||
// PURPOSE: BitArray library for Arduino
|
||||
// URL: https://github.com/RobTillaart/BitArray
|
||||
// http://forum.arduino.cc/index.php?topic=361167
|
||||
//
|
||||
// HISTORY
|
||||
// 0.1.00 initial version
|
||||
// 0.1.01 added clear() + fixed set bug
|
||||
// 0.1.02 first stable version (at last)
|
||||
// 0.1.03 refactoring
|
||||
// 0.1.04 improve performance
|
||||
// 0.1.05 added upper limits
|
||||
// 0.1.06 refactored
|
||||
// 0.1.07 private calls inline -> performance & footprint
|
||||
// 0.1.8 added toggle
|
||||
// 0.1.9 fix constructor bug
|
||||
// 0.2.0 2020-03-28 #pragma once, readme, fix Fibonacci demo
|
||||
// 0.2.1 2020-06-05 fix library.json
|
||||
// 0.2.2 2020-12-14 add Arduino-CI + unit test
|
||||
// 0.2.3 2021-10-19 update Arduino-CI + setAll(value)
|
||||
// 0.2.4 2021-12-14 update library.json, license, minor edits
|
||||
// HISTORY: see changelog.md
|
||||
|
||||
|
||||
#include "BitArray.h"
|
||||
@ -181,8 +166,10 @@ void BitArray::setAll(uint32_t value)
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
//
|
||||
// PRIVATE
|
||||
//
|
||||
inline uint8_t BitArray::_bitget(uint16_t pos)
|
||||
{
|
||||
uint8_t se = 0;
|
||||
@ -238,3 +225,4 @@ inline uint8_t BitArray::_bittoggle(const uint16_t pos)
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -1,12 +1,11 @@
|
||||
#pragma once
|
||||
//
|
||||
// FILE: bitArray.h
|
||||
// AUTHOR: Rob dot Tillaart at gmail dot com
|
||||
// VERSION: 0.2.4
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.2.5
|
||||
// PURPOSE: BitArray library for Arduino
|
||||
// URL: https://github.com/RobTillaart/BitArray
|
||||
|
||||
|
||||
// BitArray allows you to make a compact array of objects with a size
|
||||
// expressed in bits. typically 1..10.
|
||||
// The interface uses uint32_t as that will be enough for most purposes.
|
||||
@ -17,12 +16,11 @@
|
||||
//
|
||||
// Originally created to store lot of numbers between 1..6 dice rolls
|
||||
// the storage is also usable to store e.g. raw 10 bit analogRead()'s.
|
||||
//
|
||||
|
||||
|
||||
#include "Arduino.h"
|
||||
|
||||
#define BITARRAY_LIB_VERSION (F("0.2.4"))
|
||||
|
||||
#define BITARRAY_LIB_VERSION (F("0.2.5"))
|
||||
|
||||
|
||||
#define BA_SEGMENT_SIZE 200
|
||||
@ -95,4 +93,6 @@ private:
|
||||
uint8_t _error = BA_NO_MEMORY_ERR;
|
||||
};
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
63
libraries/BitArray/CHANGELOG.md
Normal file
63
libraries/BitArray/CHANGELOG.md
Normal file
@ -0,0 +1,63 @@
|
||||
# Change Log BitArray
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
|
||||
## [0.3.5] - 2022-10-29
|
||||
- add changelog.md
|
||||
- add RP2040 in build-CI
|
||||
|
||||
## [0.2.4] - 2021-12-14
|
||||
- update library.json
|
||||
- update license
|
||||
- minor edits
|
||||
|
||||
## [0.2.3] - 2021-10-19
|
||||
- update Arduino-CI
|
||||
- add setAll(value)
|
||||
|
||||
## [0.2.2] - 2020-12-14
|
||||
- add Arduino-CI + unit test
|
||||
|
||||
## [0.2.1] - 2020-06-05
|
||||
- fix library.json
|
||||
|
||||
## [0.2.0] - 2020-03-28
|
||||
- add #pragma once
|
||||
- update readme
|
||||
- fix Fibonacci demo
|
||||
|
||||
----
|
||||
|
||||
## [0.1.9]
|
||||
- fix constructor bug
|
||||
|
||||
## [0.1.8]
|
||||
- added toggle
|
||||
|
||||
## [0.1.07]
|
||||
- private calls inline -> performance & footprint
|
||||
|
||||
## [0.1.06]
|
||||
- refactored
|
||||
|
||||
## [0.1.05]
|
||||
- added upper limits
|
||||
|
||||
## [0.1.04]
|
||||
- improve performance
|
||||
|
||||
## [0.1.03]
|
||||
- refactoring
|
||||
|
||||
## [0.1.02]
|
||||
- first stable version (at last)
|
||||
|
||||
## [0.1.01]
|
||||
- added clear() + fixed set bug
|
||||
|
||||
## [0.1.00]
|
||||
- initial version
|
@ -63,4 +63,6 @@ The library is tested on AVR architecture only.
|
||||
- testing.
|
||||
- functional examples.
|
||||
- investigate element size of 64 (for doubles) and beyond.
|
||||
- move code to .cpp
|
||||
|
||||
|
||||
|
@ -1,86 +0,0 @@
|
||||
Start C:\Users\Rob\Desktop\WORK\Arduino\libraries\BitArray\examples\bitArrayDemo3\bitArrayDemo3.ino
|
||||
LIB VERSION: 0.1.8
|
||||
CAPACITY: 10000
|
||||
MEMORY: 1250
|
||||
BITS: 1
|
||||
SEGMENTS: 7
|
||||
|
||||
GET:
|
||||
DURATION: 113396
|
||||
DURATION: 222296
|
||||
X: 6792
|
||||
|
||||
SET:
|
||||
DURATION: 84468
|
||||
DURATION: 164444
|
||||
|
||||
CLEAR:
|
||||
DURATION: 548
|
||||
|
||||
TOGGLE:
|
||||
DURATION: 105244
|
||||
DURATION: 205948
|
||||
Done...
|
||||
CAPACITY: 5000
|
||||
MEMORY: 1250
|
||||
BITS: 2
|
||||
SEGMENTS: 7
|
||||
|
||||
GET:
|
||||
DURATION: 89184
|
||||
DURATION: 176084
|
||||
X: 51288
|
||||
|
||||
SET:
|
||||
DURATION: 73152
|
||||
DURATION: 144008
|
||||
|
||||
CLEAR:
|
||||
DURATION: 548
|
||||
|
||||
TOGGLE:
|
||||
DURATION: 86064
|
||||
DURATION: 169796
|
||||
Done...
|
||||
CAPACITY: 3333
|
||||
MEMORY: 1250
|
||||
BITS: 3
|
||||
SEGMENTS: 7
|
||||
|
||||
GET:
|
||||
DURATION: 81104
|
||||
DURATION: 160656
|
||||
X: 120501
|
||||
|
||||
SET:
|
||||
DURATION: 69368
|
||||
DURATION: 137184
|
||||
|
||||
CLEAR:
|
||||
DURATION: 548
|
||||
|
||||
TOGGLE:
|
||||
DURATION: 79660
|
||||
DURATION: 157720
|
||||
Done...
|
||||
CAPACITY: 2500
|
||||
MEMORY: 1250
|
||||
BITS: 4
|
||||
SEGMENTS: 7
|
||||
|
||||
GET:
|
||||
DURATION: 77084
|
||||
DURATION: 152972
|
||||
X: 231717
|
||||
|
||||
SET:
|
||||
DURATION: 67492
|
||||
DURATION: 133792
|
||||
|
||||
CLEAR:
|
||||
DURATION: 552
|
||||
|
||||
TOGGLE:
|
||||
DURATION: 76472
|
||||
DURATION: 151712
|
||||
Done...
|
@ -1,86 +0,0 @@
|
||||
Start C:\Users\Rob\Desktop\WORK\Arduino\libraries\BitArray\examples\bitArrayDemo3\bitArrayDemo3.ino
|
||||
LIB VERSION: 0.1.8
|
||||
CAPACITY: 10000
|
||||
MEMORY: 1250
|
||||
BITS: 1
|
||||
SEGMENTS: 7
|
||||
|
||||
GET:
|
||||
DURATION: 113396
|
||||
DURATION: 222296
|
||||
X: 6792
|
||||
|
||||
SET:
|
||||
DURATION: 84468
|
||||
DURATION: 164444
|
||||
|
||||
CLEAR:
|
||||
DURATION: 548
|
||||
|
||||
TOGGLE:
|
||||
DURATION: 105244
|
||||
DURATION: 205948
|
||||
Done...
|
||||
CAPACITY: 5000
|
||||
MEMORY: 1250
|
||||
BITS: 2
|
||||
SEGMENTS: 7
|
||||
|
||||
GET:
|
||||
DURATION: 89184
|
||||
DURATION: 176084
|
||||
X: 51288
|
||||
|
||||
SET:
|
||||
DURATION: 73152
|
||||
DURATION: 144008
|
||||
|
||||
CLEAR:
|
||||
DURATION: 548
|
||||
|
||||
TOGGLE:
|
||||
DURATION: 86064
|
||||
DURATION: 169796
|
||||
Done...
|
||||
CAPACITY: 3333
|
||||
MEMORY: 1250
|
||||
BITS: 3
|
||||
SEGMENTS: 7
|
||||
|
||||
GET:
|
||||
DURATION: 81104
|
||||
DURATION: 160656
|
||||
X: 120501
|
||||
|
||||
SET:
|
||||
DURATION: 69368
|
||||
DURATION: 137184
|
||||
|
||||
CLEAR:
|
||||
DURATION: 548
|
||||
|
||||
TOGGLE:
|
||||
DURATION: 79660
|
||||
DURATION: 157720
|
||||
Done...
|
||||
CAPACITY: 2500
|
||||
MEMORY: 1250
|
||||
BITS: 4
|
||||
SEGMENTS: 7
|
||||
|
||||
GET:
|
||||
DURATION: 77084
|
||||
DURATION: 152972
|
||||
X: 231717
|
||||
|
||||
SET:
|
||||
DURATION: 67492
|
||||
DURATION: 133792
|
||||
|
||||
CLEAR:
|
||||
DURATION: 552
|
||||
|
||||
TOGGLE:
|
||||
DURATION: 76472
|
||||
DURATION: 151712
|
||||
Done...
|
@ -15,7 +15,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/BitArray.git"
|
||||
},
|
||||
"version": "0.2.4",
|
||||
"version": "0.2.5",
|
||||
"license": "MIT",
|
||||
"frameworks": "arduino",
|
||||
"platforms": "*",
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=BitArray
|
||||
version=0.2.4
|
||||
version=0.2.5
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino library for compact array of objects with a size expressed in bits.
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
unittest_setup()
|
||||
{
|
||||
fprintf(stderr, "BITARRAY_LIB_VERSION: %s\n", (char *) BITARRAY_LIB_VERSION);
|
||||
}
|
||||
|
||||
|
||||
@ -40,8 +41,6 @@ unittest(test_constructor)
|
||||
{
|
||||
BitArray ba;
|
||||
|
||||
fprintf(stderr, "BITARRAY_LIB_VERSION: %s\n", (char *) BITARRAY_LIB_VERSION);
|
||||
|
||||
assertEqual(BA_NO_MEMORY_ERR, ba.getError());
|
||||
|
||||
ba.begin(0, 1000);
|
||||
@ -62,7 +61,6 @@ unittest(test_set_get_toggle)
|
||||
{
|
||||
BitArray ba;
|
||||
|
||||
fprintf(stderr, "BITARRAY_LIB_VERSION: %s\n", (char *) BITARRAY_LIB_VERSION);
|
||||
ba.begin(1, 1000);
|
||||
assertEqual(BA_OK, ba.getError());
|
||||
|
||||
@ -108,7 +106,6 @@ unittest(test_clear)
|
||||
{
|
||||
BitArray ba;
|
||||
|
||||
fprintf(stderr, "BITARRAY_LIB_VERSION: %s\n", (char *) BITARRAY_LIB_VERSION);
|
||||
ba.begin(1, 1000);
|
||||
assertEqual(BA_OK, ba.getError());
|
||||
|
||||
@ -139,7 +136,6 @@ unittest(test_setAll)
|
||||
{
|
||||
BitArray ba;
|
||||
|
||||
fprintf(stderr, "BITARRAY_LIB_VERSION: %s\n", (char *) BITARRAY_LIB_VERSION);
|
||||
ba.begin(5, 200);
|
||||
assertEqual(BA_OK, ba.getError());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user