Skip to content

Commit

Permalink
adc lowpass first reading initialisation
Browse files Browse the repository at this point in the history
  • Loading branch information
p3p committed Nov 11, 2019
1 parent f76552d commit 91b9f7c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"name": "framework-arduino-lpc176x",
"description": "Arduino Wiring-based Framework (LPC176x CMSIS 5)",
"url": "https://www.arduino.cc/en/Main/Software",
"version": "0.2.1"
"version": "0.2.2"
}
4 changes: 2 additions & 2 deletions system/lpc176x/adc.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,9 @@ struct ADC {
};

struct LowpassFilter {
uint32_t data_delay = 0x7FFF << ADC_LOWPASS_K_VALUE;
uint32_t data_delay = 0xFFFFFFFF;
[[gnu::always_inline]] inline uint16_t update(uint16_t value) {
data_delay = data_delay - (data_delay >> ADC_LOWPASS_K_VALUE) + value;
data_delay = data_delay == 0xFFFFFFFF ? value << ADC_LOWPASS_K_VALUE : data_delay - (data_delay >> ADC_LOWPASS_K_VALUE) + value;
return (uint16_t)(data_delay >> ADC_LOWPASS_K_VALUE);
}
};
Expand Down

0 comments on commit 91b9f7c

Please sign in to comment.