2022-03-25 23:41:44 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "pico/stdlib.h"
|
|
|
|
#include "common/pimoroni_common.hpp"
|
|
|
|
|
|
|
|
namespace pimoroni {
|
|
|
|
|
|
|
|
class AnalogMux {
|
|
|
|
public:
|
|
|
|
AnalogMux(uint addr0_pin, uint addr1_pin = PIN_UNUSED, uint addr2_pin = PIN_UNUSED,
|
|
|
|
uint en_pin = PIN_UNUSED, uint muxed_pin = PIN_UNUSED);
|
|
|
|
|
|
|
|
void select(uint8_t address);
|
|
|
|
void disable();
|
|
|
|
void configure_pulls(uint8_t address, bool pullup, bool pulldown);
|
2022-04-26 23:15:13 +01:00
|
|
|
bool read();
|
2022-03-25 23:41:44 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
uint addr0_pin;
|
|
|
|
uint addr1_pin;
|
|
|
|
uint addr2_pin;
|
|
|
|
uint en_pin;
|
|
|
|
uint muxed_pin;
|
|
|
|
uint max_address;
|
|
|
|
uint8_t pull_ups;
|
|
|
|
uint8_t pull_downs;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|