analog input capability
This commit is contained in:
parent
81f0e80f8c
commit
94443393d0
5 changed files with 68 additions and 19 deletions
|
@ -1,16 +1,21 @@
|
|||
#ifndef ESPMEGA
|
||||
#define ESPMEGA
|
||||
|
||||
#define ANALOG_CARD_ENABLE
|
||||
#include <Arduino.h>
|
||||
#include <Wire.h>
|
||||
#include <Adafruit_PWMServoDriver.h>
|
||||
#include <PCF8574.h>
|
||||
#ifdef ANALOG_CARD_ENABLE
|
||||
#include <Adafruit_ADS1X15.h>
|
||||
#endif
|
||||
|
||||
#define INPUT_BANK_A_ADDRESS 0x21
|
||||
#define INPUT_BANK_B_ADDRESS 0x22
|
||||
#define PWM_BANK_ADDRESS 0x5F
|
||||
#define OUTPUT_BANK_ADDRESS 0x21
|
||||
#define EEPROM_ADDRESS 0x22
|
||||
#define ANALOG_INPUT_BANK_A_ADDRESS 0x60
|
||||
#define ANALOG_INPUT_BANK_B_ADDRESS 0x61
|
||||
|
||||
//#define USE_INTERRUPT
|
||||
#define INPUT_BANK_A_INTERRUPT 36
|
||||
|
@ -59,4 +64,14 @@ void ESPMega_digitalWrite(int id, bool value);
|
|||
void IRAM_ATTR refreshInputBankA();
|
||||
void IRAM_ATTR refreshInputBankB();
|
||||
|
||||
#ifdef ANALOG_CARD_ENABLE
|
||||
/**
|
||||
* Read one of the ESPMega Analog Card's Analog Input pins (A0-A7)
|
||||
*
|
||||
* @param id The number of the pin to be read
|
||||
* @return The value of the pin (0-4095)
|
||||
*/
|
||||
uint16_t ESPMega_analogRead(int id);
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue