lpc176x: Implement a median filter on ADC readings

The lpc176x ADC is extremely noisy.  Implement a 5 order median filter
on each ADC read to weed out obviously incorrect readings.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2019-01-12 14:58:53 -05:00
parent cb2ecc68d2
commit d3ec103816
2 changed files with 69 additions and 19 deletions

View File

@@ -22,7 +22,7 @@ void gpio_in_reset(struct gpio_in g, int8_t pull_up);
uint8_t gpio_in_read(struct gpio_in g);
struct gpio_adc {
uint32_t cmd;
uint32_t chan;
};
struct gpio_adc gpio_adc_setup(uint8_t pin);
uint32_t gpio_adc_sample(struct gpio_adc g);