0.2.8 BoolArray

This commit is contained in:
Rob Tillaart 2023-10-18 16:27:05 +02:00
parent 089daf0ac9
commit f4f862146e
7 changed files with 34 additions and 17 deletions

View File

@ -1,7 +1,8 @@
//
// FILE: BoolArray.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.2.7
// VERSION: 0.2.8
// DATE: 2015-12-06
// PURPOSE: BoolArray library for Arduino
// URL: https://github.com/RobTillaart/BoolArray
// http://forum.arduino.cc/index.php?topic=361167
@ -26,14 +27,17 @@ BoolArray::~BoolArray()
uint8_t BoolArray::begin(const uint16_t size)
{
if (size > BOOLARRAY_MAXSIZE) return BOOLARRAY_SIZE_ERROR;
// if (_size == size) no need to reallocate...
_size = size;
_bytes = (_size + 7) / 8;
if (_array)
// do we need to re-allocate?
if (_size != size)
{
free(_array);
_size = size;
_bytes = (_size + 7) / 8;
if (_array)
{
free(_array);
}
_array = (uint8_t *) malloc(_bytes);
}
_array = (uint8_t *) malloc(_bytes);
return BOOLARRAY_OK;
}

View File

@ -2,7 +2,8 @@
//
// FILE: BoolArray.h
// AUTHOR: Rob Tillaart
// VERSION: 0.2.7
// VERSION: 0.2.8
// DATE: 2015-12-06
// PURPOSE: BoolArray library for Arduino
// URL: https://github.com/RobTillaart/BoolArray.git
@ -14,7 +15,7 @@
#include "Arduino.h"
#define BOOLARRAY_LIB_VERSION (F("0.2.7"))
#define BOOLARRAY_LIB_VERSION (F("0.2.8"))
#define BOOLARRAY_MAXSIZE (250 * 8) // 2000

View File

@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.2.8] - 2023-02-08
- update readme.md
- optimize begin - test for need to reallocate.
## [0.2.7] - 2023-02-08
- update readme.md
- update GitHub actions
@ -13,7 +18,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- move code to .cpp
- improved measurement of performance - boolArrayDemo2.ino
## [0.2.6] - 2022-10-29
- add RP2040 to build-CI
- add changelog.md

View File

@ -2,8 +2,11 @@
[![Arduino CI](https://github.com/RobTillaart/BoolArray/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
[![Arduino-lint](https://github.com/RobTillaart/BoolArray/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/BoolArray/actions/workflows/arduino-lint.yml)
[![JSON check](https://github.com/RobTillaart/BoolArray/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/BoolArray/actions/workflows/jsoncheck.yml)
[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/BoolArray.svg)](https://github.com/RobTillaart/BoolArray/issues)
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/BoolArray/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/RobTillaart/BoolArray.svg?maxAge=3600)](https://github.com/RobTillaart/BoolArray/releases)
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/BoolArray.svg)](https://registry.platformio.org/libraries/robtillaart/BoolArray)
# BoolArray
@ -70,7 +73,6 @@ So one need to check these carefully.
- **uint8_t toggle(uint16_t index)** Toggles element at index. Returns **BOOLARRAY_OK** on success.
## Future
#### Must
@ -85,12 +87,9 @@ So one need to check these carefully.
- performance intern 16 bit iso 8 bit. (0.3.0)
- faster on UNO
- does allocation work as it should?
#### Could
- **begin()**
- if (_size == size) no need to reallocate...
- update examples.
- boolArray32() class
- begin(uint32_t size);
@ -98,4 +97,11 @@ So one need to check these carefully.
#### Wont
## Support
If you appreciate my libraries, you can support the development and maintenance.
Improve the quality of the libraries by providing issues and Pull Requests, or
donate through PayPal or GitHub sponsors.
Thank you,

View File

@ -18,7 +18,9 @@ toggle KEYWORD2
# Constants (LITERAL1)
BOOLARRAY_LIB_VERSION LITERAL1
BOOLARRAY_MAXSIZE LITERAL1
BOOLARRAY_OK LITERAL1
BOOLARRAY_ERROR LITERAL1
BOOLARRAY_SIZE_ERROR LITERAL1

View File

@ -15,9 +15,9 @@
"type": "git",
"url": "https://github.com/RobTillaart/BoolArray.git"
},
"version": "0.2.7",
"version": "0.2.8",
"license": "MIT",
"frameworks": "arduino",
"frameworks": "*",
"platforms": "*",
"headers": "BoolArray.h"
}

View File

@ -1,5 +1,5 @@
name=BoolArray
version=0.2.7
version=0.2.8
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for compact array of booleans of max size 2000 (UNO).