Skip to content

Commit

Permalink
signed numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
pilotak committed Jan 4, 2018
1 parent 0b577d1 commit 073a532
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Hysteresis.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void Hysteresis<T>::set(T step) {
template <class T>
T Hysteresis<T>::add(T value) {
T res = _prev;
uint32_t value_scaled = ((value << 8) / _step);
int32_t value_scaled = ((value << 8) / _step);
uint8_t bits = ((value_scaled) >> 6) & 0b11;

if (value > _prev) {
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Fixed point hysteresis filter for Mbed

**_Type_** type can be:
- `uint8_t`
- `uint16_t`
- `uint32_t` but only up to 24 bits
- `uint8_t` or `int8_t`
- `uint16_t` or `int16_t`
- `uint32_t` or `int32_t` but only up to 23 bits

# Example
```cpp
Expand Down

0 comments on commit 073a532

Please sign in to comment.