0.1.2 rotaryDecoder

This commit is contained in:
rob tillaart 2021-12-27 21:02:58 +01:00
parent 871eb7d0a9
commit a2e542f56f
12 changed files with 26 additions and 26 deletions

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021-2021 Rob Tillaart
Copyright (c) 2021-2022 Rob Tillaart
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -8,7 +8,7 @@
# rotaryDecoder
Arduino library for a PCF8574 based rotary decoder - supports 4 RE.
Arduino library for a PCF8574 based rotary decoder - supports 4 rotary encoders.
## Description

View File

@ -2,9 +2,8 @@
// FILE: rotaryDecoder_demo_interrupt.ino
// AUTHOR: Rob Tillaart
// DATE: 2021-05-08
//
// PUPROSE: demo interrupt controlled rotary decoder
//
// connect up to 4 rotary encoders to 1 PCF8574.
//
// RotaryEncoder PCF8574 UNO
@ -72,3 +71,4 @@ void loop()
// -- END OF FILE --

View File

@ -2,9 +2,8 @@
// FILE: rotaryDecoder_demo_polling.ino
// AUTHOR: Rob Tillaart
// DATE: 2021-05-08
//
// PUPROSE: demo
//
// connect up to 4 rotary encoders to 1 PCF8574.
//
// RotaryEncoder PCF8574 UNO
@ -38,7 +37,6 @@ void setup()
}
void loop()
{
if (decoder.checkChange())

View File

@ -2,9 +2,8 @@
// FILE: rotaryDecoder_demo_simple.ino
// AUTHOR: Rob Tillaart
// DATE: 2021-05-08
//
// PUPROSE: demo
//
// connect up to 4 rotary encoders to 1 PCF8574.
//
// RotaryEncoder PCF8574 UNO

View File

@ -2,12 +2,11 @@
// FILE: rotaryDecoder_demo_single.ino
// AUTHOR: Rob Tillaart
// DATE: 2021-05-08
//
// PUPROSE: demo single direction rotary decoder.
//
// note this is used for e.g. RPM counters that are unidirectional.
// all moves are interpreted as same direction.
//
// connect up to 4 rotary encoders to 1 PCF8574.
//
// RotaryEncoder PCF8574 UNO

View File

@ -2,9 +2,8 @@
// FILE: rotaryDecoder_performance.ino
// AUTHOR: Rob Tillaart
// DATE: 2021-05-08
//
// PUPROSE: demo
//
// connect up to 4 rotary encoders to 1 PCF8574.
//
// RotaryEncoder PCF8574 UNO
@ -59,3 +58,4 @@ void loop()
// -- END OF FILE --

View File

@ -1,6 +1,6 @@
{
"name": "rotaryDecoder",
"keywords": "rotary encoder PCF8574",
"keywords": "rotary,encoder,PCF8574",
"description": "Arduino library to rotary decoder with a PCF8574\nSupports up to 4 RE's",
"authors":
[
@ -15,8 +15,9 @@
"type": "git",
"url": "https://github.com/RobTillaart/rotaryDecoder.git"
},
"version": "0.1.1",
"version": "0.1.2",
"license": "MIT",
"frameworks": "arduino",
"platforms": "*"
"platforms": "*",
"headers": "rotaryDecoder.h"
}

View File

@ -1,5 +1,5 @@
name=rotaryDecoder
version=0.1.1
version=0.1.2
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library to rotary decoder with a PCF8574

View File

@ -10,7 +10,7 @@
// 0.1.0 2021-05-08 initial version
// 0.1.1 2021-11-15 update build-CI, readme.md
// improve readability of code
//
// 0.1.2 2021-12-27 update library.json, license, minor edits
#include "rotaryDecoder.h"
@ -158,3 +158,4 @@ uint8_t rotaryDecoder::_read8()
// -- END OF FILE --

View File

@ -2,7 +2,7 @@
//
// FILE: rotaryDecoder.h
// AUTHOR: Rob Tillaart
// VERSION: 0.1.1
// VERSION: 0.1.2
// DATE: 2021-05-08
// PURPOSE: rotary decoder library for Arduino
// URL: https://github.com/RobTillaart/rotaryDecoder
@ -11,7 +11,7 @@
#include "Arduino.h"
#include "Wire.h"
#define ROTARY_DECODER_LIB_VERSION (F("0.1.1"))
#define ROTARY_DECODER_LIB_VERSION (F("0.1.2"))
class rotaryDecoder
@ -28,14 +28,14 @@ public:
void readInitialState();
// for polling version,
// for polling version,
// checkChange is bit faster than a call to update
// so useful if there are only a few updates
// so useful if there are only a few updates
bool checkChange();
// read and update the counters
bool update(); // assumes two directions => +1 and -1
bool updateSingle(); // assumes single direction => + ++ +++
bool updateSingle(); // assumes single direction => + ++ +++
// re = rotary encoder
int32_t getValue(uint8_t re) { return _encoder[re]; };
@ -44,6 +44,7 @@ public:
// DEBUG
uint8_t getLastPosition(uint8_t re) { return _lastPos[re]; };
private:
uint8_t _count = 0;
uint8_t _lastValue = 0;
@ -55,4 +56,6 @@ private:
TwoWire * _wire;
};
// -- END OF FILE --

View File

@ -38,6 +38,7 @@
unittest_setup()
{
fprintf(stderr, "ROTARY_DECODER_LIB_VERSION: %s\n", (char *) ROTARY_DECODER_LIB_VERSION);
}
unittest_teardown()
@ -47,8 +48,6 @@ unittest_teardown()
unittest(test_constructor)
{
fprintf(stderr, "ROTARY_DECODER_LIB_VERSION: %s\n", (char *) ROTARY_DECODER_LIB_VERSION);
rotaryDecoder(0x20);
fprintf(stderr, "no tests yet");