FIX PID demo after ChibiOS ADC callback rework

f20ecc7817 (diff-e42edbbb9a343d9d1b70e68f524cbc22)
This commit is contained in:
Romain Reignier 2019-10-21 20:14:23 +02:00
parent 4a70bf56c8
commit b73ec1f107
1 changed files with 5 additions and 6 deletions

View File

@ -30,17 +30,16 @@ static adcsample_t samples[ADC_GRP1_NUM_CHANNELS * ADC_GRP1_BUF_DEPTH];
/*
* ADC streaming callback.
*/
static void adccallback(ADCDriver *adcp, adcsample_t *buffer, size_t n) {
static void adccallback(ADCDriver *adcp) {
(void)adcp;
(void)n;
uint32_t i, tmp = 0;
if (samples == buffer) {
if (adcIsBufferComplete(adcp)) {
for (i = 0; i < n; i++) {
tmp += buffer[i];
for (i = 0; i < (adcp)->depth; i++) {
tmp += (adcp)->samples[i];
}
input = tmp / n;
input = tmp / (adcp)->depth;
if (input <= target) {
palClearLine(LINE_LED7_GREEN);