24 #include "Adafruit_I2CDevice.h" 31 #define SEESAW_ADDRESS (0x49) 42 SEESAW_STATUS_BASE = 0x00,
43 SEESAW_GPIO_BASE = 0x01,
44 SEESAW_SERCOM0_BASE = 0x02,
46 SEESAW_TIMER_BASE = 0x08,
47 SEESAW_ADC_BASE = 0x09,
48 SEESAW_DAC_BASE = 0x0A,
49 SEESAW_INTERRUPT_BASE = 0x0B,
50 SEESAW_DAP_BASE = 0x0C,
51 SEESAW_EEPROM_BASE = 0x0D,
52 SEESAW_NEOPIXEL_BASE = 0x0E,
53 SEESAW_TOUCH_BASE = 0x0F,
54 SEESAW_KEYPAD_BASE = 0x10,
55 SEESAW_ENCODER_BASE = 0x11,
56 SEESAW_SPECTRUM_BASE = 0x12,
62 SEESAW_GPIO_DIRSET_BULK = 0x02,
63 SEESAW_GPIO_DIRCLR_BULK = 0x03,
64 SEESAW_GPIO_BULK = 0x04,
65 SEESAW_GPIO_BULK_SET = 0x05,
66 SEESAW_GPIO_BULK_CLR = 0x06,
67 SEESAW_GPIO_BULK_TOGGLE = 0x07,
68 SEESAW_GPIO_INTENSET = 0x08,
69 SEESAW_GPIO_INTENCLR = 0x09,
70 SEESAW_GPIO_INTFLAG = 0x0A,
71 SEESAW_GPIO_PULLENSET = 0x0B,
72 SEESAW_GPIO_PULLENCLR = 0x0C,
78 SEESAW_STATUS_HW_ID = 0x01,
79 SEESAW_STATUS_VERSION = 0x02,
80 SEESAW_STATUS_OPTIONS = 0x03,
81 SEESAW_STATUS_TEMP = 0x04,
82 SEESAW_STATUS_SWRST = 0x7F,
88 SEESAW_TIMER_STATUS = 0x00,
89 SEESAW_TIMER_PWM = 0x01,
90 SEESAW_TIMER_FREQ = 0x02,
96 SEESAW_ADC_STATUS = 0x00,
97 SEESAW_ADC_INTEN = 0x02,
98 SEESAW_ADC_INTENCLR = 0x03,
99 SEESAW_ADC_WINMODE = 0x04,
100 SEESAW_ADC_WINTHRESH = 0x05,
101 SEESAW_ADC_CHANNEL_OFFSET = 0x07,
107 SEESAW_SERCOM_STATUS = 0x00,
108 SEESAW_SERCOM_INTEN = 0x02,
109 SEESAW_SERCOM_INTENCLR = 0x03,
110 SEESAW_SERCOM_BAUD = 0x04,
111 SEESAW_SERCOM_DATA = 0x05,
117 SEESAW_NEOPIXEL_STATUS = 0x00,
118 SEESAW_NEOPIXEL_PIN = 0x01,
119 SEESAW_NEOPIXEL_SPEED = 0x02,
120 SEESAW_NEOPIXEL_BUF_LENGTH = 0x03,
121 SEESAW_NEOPIXEL_BUF = 0x04,
122 SEESAW_NEOPIXEL_SHOW = 0x05,
128 SEESAW_TOUCH_CHANNEL_OFFSET = 0x10,
134 SEESAW_KEYPAD_STATUS = 0x00,
135 SEESAW_KEYPAD_EVENT = 0x01,
136 SEESAW_KEYPAD_INTENSET = 0x02,
137 SEESAW_KEYPAD_INTENCLR = 0x03,
138 SEESAW_KEYPAD_COUNT = 0x04,
139 SEESAW_KEYPAD_FIFO = 0x10,
145 SEESAW_KEYPAD_EDGE_HIGH = 0,
146 SEESAW_KEYPAD_EDGE_LOW,
147 SEESAW_KEYPAD_EDGE_FALLING,
148 SEESAW_KEYPAD_EDGE_RISING,
154 SEESAW_ENCODER_STATUS = 0x00,
155 SEESAW_ENCODER_INTENSET = 0x10,
156 SEESAW_ENCODER_INTENCLR = 0x20,
157 SEESAW_ENCODER_POSITION = 0x30,
158 SEESAW_ENCODER_DELTA = 0x40,
164 SEESAW_SPECTRUM_RESULTS_LOWER = 0x00,
165 SEESAW_SPECTRUM_RESULTS_UPPER = 0x01,
170 SEESAW_SPECTRUM_CHANNEL = 0xFD,
171 SEESAW_SPECTRUM_RATE = 0xFE,
172 SEESAW_SPECTRUM_STATUS = 0xFF,
175 #define ADC_INPUT_0_PIN 2 176 #define ADC_INPUT_1_PIN 3 177 #define ADC_INPUT_2_PIN 4 178 #define ADC_INPUT_3_PIN 5 185 #ifndef INPUT_PULLDOWN 186 #define INPUT_PULLDOWN \ 193 #define SEESAW_HW_ID_CODE_SAMD09 0x55 194 #define SEESAW_HW_ID_CODE_TINY806 0x84 195 #define SEESAW_HW_ID_CODE_TINY807 0x85 196 #define SEESAW_HW_ID_CODE_TINY816 0x86 197 #define SEESAW_HW_ID_CODE_TINY817 0x87 198 #define SEESAW_HW_ID_CODE_TINY1616 0x88 199 #define SEESAW_HW_ID_CODE_TINY1617 0x89 243 uint32_t getOptions();
244 uint32_t getVersion();
245 bool getProdDatecode(uint16_t *pid, uint8_t *year, uint8_t *mon,
250 void pinMode(uint8_t pin, uint8_t mode);
251 void pinModeBulk(uint32_t pins, uint8_t mode);
252 void pinModeBulk(uint32_t pinsa, uint32_t pinsb, uint8_t mode);
253 virtual void analogWrite(uint8_t pin, uint16_t value, uint8_t width = 8);
254 void digitalWrite(uint8_t pin, uint8_t value);
255 void digitalWriteBulk(uint32_t port_values);
256 void digitalWriteBulk(uint32_t pins, uint8_t value);
257 void digitalWriteBulk(uint32_t pinsa, uint32_t pinsb, uint8_t value);
259 bool digitalRead(uint8_t pin);
260 uint32_t digitalReadBulk(uint32_t pins);
261 uint32_t digitalReadBulkB(uint32_t pins);
263 void setGPIOInterrupts(uint32_t pins,
bool enabled);
265 virtual uint16_t analogRead(uint8_t pin);
267 uint16_t touchRead(uint8_t pin);
269 virtual void setPWMFreq(uint8_t pin, uint16_t freq);
271 void enableSercomDataRdyInterrupt(uint8_t sercom = 0);
272 void disableSercomDataRdyInterrupt(uint8_t sercom = 0);
274 char readSercomData(uint8_t sercom = 0);
276 void EEPROMWrite8(uint8_t addr, uint8_t val);
277 void EEPROMWrite(uint8_t addr, uint8_t *buf, uint8_t size);
278 uint8_t EEPROMRead8(uint8_t addr);
280 void setI2CAddr(uint8_t addr);
281 uint8_t getI2CAddr();
283 void UARTSetBaud(uint32_t baud);
285 void setKeypadEvent(uint8_t key, uint8_t edge,
bool enable =
true);
286 void enableKeypadInterrupt();
287 void disableKeypadInterrupt();
288 uint8_t getKeypadCount();
293 int32_t getEncoderPosition(uint8_t encoder = 0);
294 int32_t getEncoderDelta(uint8_t encoder = 0);
295 bool enableEncoderInterrupt(uint8_t encoder = 0);
296 bool disableEncoderInterrupt(uint8_t encoder = 0);
297 void setEncoderPosition(int32_t pos, uint8_t encoder = 0);
299 virtual size_t write(uint8_t);
300 virtual size_t write(
const char *str);
304 Adafruit_I2CDevice *_i2c_dev = NULL;
308 uint8_t _hardwaretype = 0;
309 uint8_t getI2CaddrEEPROMloc();
311 bool write8(byte regHigh, byte regLow, byte value);
312 uint8_t read8(byte regHigh, byte regLow, uint16_t delay = 250);
314 bool read(uint8_t regHigh, uint8_t regLow, uint8_t *buf, uint8_t num,
315 uint16_t delay = 250);
316 bool write(uint8_t regHigh, uint8_t regLow, uint8_t *buf, uint8_t num);
Definition: Adafruit_seesaw.h:221
uint8_t DATA_RDY
this bit is set when data becomes available
Definition: Adafruit_seesaw.h:326
int8_t _flow
Definition: Adafruit_seesaw.h:306
Definition: Adafruit_seesaw.h:324
struct keyEventRaw::@12 bit
bitfield format
uint8_t NUM
the event number
Definition: Adafruit_seesaw.h:206
uint8_t reg
register format
Definition: Adafruit_seesaw.h:208
uint8_t ACTIVE
the registered events for that key
Definition: Adafruit_seesaw.h:224
uint8_t STATE
the current state of the key
Definition: Adafruit_seesaw.h:223
uint16_t NUM
the event number
Definition: Adafruit_seesaw.h:215
Class that stores state and functions for interacting with seesaw helper IC.
Definition: Adafruit_seesaw.h:235
uint16_t reg
register format
Definition: Adafruit_seesaw.h:217
uint8_t EDGE
the edge that was triggered
Definition: Adafruit_seesaw.h:205
uint8_t reg
full register
Definition: Adafruit_seesaw.h:328
#define SEESAW_ADDRESS
Default Seesaw I2C address.
Definition: Adafruit_seesaw.h:31
TwoWire * _i2cbus
Definition: Adafruit_seesaw.h:303
Definition: Adafruit_seesaw.h:212
uint8_t EDGE
the edge that was triggered
Definition: Adafruit_seesaw.h:214
Definition: Adafruit_seesaw.h:203
uint8_t reg
register format
Definition: Adafruit_seesaw.h:226
sercom_inten _sercom_inten
sercom interrupt enable register instance
Definition: Adafruit_seesaw.h:330