Merge branch 'master' of https://git.pupes.org/PoliEcho/sint-gauntlet
This commit is contained in:
commit
3a24cb235b
14
mux.c
14
mux.c
@ -1,4 +1,7 @@
|
|||||||
#include "const.h"
|
#include "const.h"
|
||||||
|
#include "state.h"
|
||||||
|
#include <hardware/adc.h>
|
||||||
|
#include <pico/time.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <hardware/gpio.h>
|
#include <hardware/gpio.h>
|
||||||
|
|
||||||
@ -8,12 +11,15 @@ void set_mux_addr(uint8_t addr) {
|
|||||||
gpio_put(MUX_S2, (addr >> 2) & 1);
|
gpio_put(MUX_S2, (addr >> 2) & 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
float read_value_from_mux() {
|
|
||||||
return 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
void update_inputs() {
|
void update_inputs() {
|
||||||
for(uint8_t i = 0; i < 2; i++) {
|
for(uint8_t i = 0; i < 2; i++) {
|
||||||
|
adc_select_input(i);
|
||||||
|
for(uint8_t j = 0; j < 8;j++) {
|
||||||
|
set_mux_addr(j);
|
||||||
|
sleep_ms(1); // let multiplexor multiplex
|
||||||
|
state.array[(i+1)*j]= adc_read();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user