#ifndef SEESAW_DEVICE_CONFIG_H
#define SEESAW_DEVICE_CONFIG_H

#define PRODUCT_CODE 3957

//override default activity led pin
#define PIN_ACTIVITY_LED (32 + 22) //PB22

//don't use address pins
#define CONFIG_NO_ADDR

//don't use eeprom
#define CONFIG_NO_EEPROM

#define USB_UART_DMA

#define CONFIG_USB_UART_DMA_CHANNEL_TX 1
#define CONFIG_USB_UART_DMA_CHANNEL_RX 0

#define CONFIG_USB_UART_DMA_TRIGGER_RX SERCOM5_DMAC_ID_RX
#define CONFIG_USB_UART_DMA_TRIGGER_TX SERCOM5_DMAC_ID_TX

#define CONFIG_USB_UART_SERCOM SERCOM5

//* ============== POOL SIZES =================== *//
#define EVT_SIZE_SMALL 32
#define EVT_SIZE_MEDIUM 64
#define EVT_SIZE_LARGE 256
#define EVT_COUNT_SMALL 128
#define EVT_COUNT_MEDIUM 32
#define EVT_COUNT_LARGE 16

//* ============== ADC =================== *//
#define CONFIG_ADC 1

//we will override some of the default ADC pins for this board
#define CONFIG_ADC_INPUT_0 1

#define CONFIG_ADC_INPUT_1 1

#define CONFIG_ADC_INPUT_2 1
#define CONFIG_ADC_INPUT_2_PIN (32 + 8) //PB08

#define CONFIG_ADC_INPUT_3 1
#define CONFIG_ADC_INPUT_3_PIN (32 + 9) //PB09

#define CONFIG_ADC_INPUT_4 1

#define CONFIG_ADC_INPUT_5 1

#define CONFIG_ADC_INPUT_6 1

#define CONFIG_ADC_INPUT_7 1

//* ============== DAC =================== *//
#define CONFIG_DAC 0

//* ============== TOUCH =================== *//
#define CONFIG_TOUCH 1

#ifndef ENABLE_LOGGING
#define CONFIG_TOUCH0 1 //this is the UART log pin
#endif
#define CONFIG_TOUCH1 1
#define CONFIG_TOUCH2 1
#define CONFIG_TOUCH3 1

//* ============== TIMER =================== *//
#define CONFIG_TIMER 1

#define CONFIG_TIMER_PWM_OUT0 1
#define CONFIG_TIMER_PWM_OUT0_IS_TCC
#define CONFIG_TIMER_PWM_OUT0_TC NOT_ON_TC
#define CONFIG_TIMER_PWM_OUT0_TCC TCC0
#define CONFIG_TIMER_PWM_OUT0_WO 0
#define CONFIG_TIMER_PWM_OUT0_PIN 14

#define CONFIG_TIMER_PWM_OUT1 1
#define CONFIG_TIMER_PWM_OUT1_IS_TCC
#define CONFIG_TIMER_PWM_OUT1_TC NOT_ON_TC
#define CONFIG_TIMER_PWM_OUT1_TCC TCC0
#define CONFIG_TIMER_PWM_OUT1_WO 1
#define CONFIG_TIMER_PWM_OUT1_PIN 15

#define CONFIG_TIMER_PWM_OUT2 1
#define CONFIG_TIMER_PWM_OUT2_IS_TCC
#define CONFIG_TIMER_PWM_OUT2_TC NOT_ON_TC
#define CONFIG_TIMER_PWM_OUT2_TCC TCC0
#define CONFIG_TIMER_PWM_OUT2_WO 2
#define CONFIG_TIMER_PWM_OUT2_PIN 16

#define CONFIG_TIMER_PWM_OUT3 1
#define CONFIG_TIMER_PWM_OUT3_IS_TCC
#define CONFIG_TIMER_PWM_OUT3_TC NOT_ON_TC
#define CONFIG_TIMER_PWM_OUT3_TCC TCC0
#define CONFIG_TIMER_PWM_OUT3_WO 3
#define CONFIG_TIMER_PWM_OUT3_PIN 17

#define CONFIG_TIMER_PWM_OUT4 1
#define CONFIG_TIMER_PWM_OUT4_TC TC3
#define CONFIG_TIMER_PWM_OUT4_TCC NOT_ON_TCC
#define CONFIG_TIMER_PWM_OUT4_WO 0
#define CONFIG_TIMER_PWM_OUT4_PIN 18

#define CONFIG_TIMER_PWM_OUT5 1
#define CONFIG_TIMER_PWM_OUT5_TC TC3
#define CONFIG_TIMER_PWM_OUT5_TCC NOT_ON_TCC
#define CONFIG_TIMER_PWM_OUT5_WO 1
#define CONFIG_TIMER_PWM_OUT5_PIN 19

#define CONFIG_TIMER_PWM_OUT6 1
#define CONFIG_TIMER_PWM_OUT6_TC TC4
#define CONFIG_TIMER_PWM_OUT6_TCC NOT_ON_TCC
#define CONFIG_TIMER_PWM_OUT6_WO 0
#define CONFIG_TIMER_PWM_OUT6_PIN 22

#define CONFIG_TIMER_PWM_OUT7 1
#define CONFIG_TIMER_PWM_OUT7_TC TC4
#define CONFIG_TIMER_PWM_OUT7_TCC NOT_ON_TCC
#define CONFIG_TIMER_PWM_OUT7_WO 1
#define CONFIG_TIMER_PWM_OUT7_PIN 23

#define CONFIG_TIMER_PWM_OUT8 1
#define CONFIG_TIMER_PWM_OUT8_TC TC5
#define CONFIG_TIMER_PWM_OUT8_TCC NOT_ON_TCC
#define CONFIG_TIMER_PWM_OUT8_WO 0
#define CONFIG_TIMER_PWM_OUT8_PIN (32 + 10) //PB10

#define CONFIG_TIMER_PWM_OUT9 1
#define CONFIG_TIMER_PWM_OUT9_TC TC5
#define CONFIG_TIMER_PWM_OUT9_TCC NOT_ON_TCC
#define CONFIG_TIMER_PWM_OUT9_WO 1
#define CONFIG_TIMER_PWM_OUT9_PIN (32 + 11) //PB11

#define CONFIG_TIMER_PWM_OUT10 1
#define CONFIG_TIMER_PWM_OUT10_IS_TCC
#define CONFIG_TIMER_PWM_OUT10_TC NOT_ON_TC
#define CONFIG_TIMER_PWM_OUT10_TCC TCC2
#define CONFIG_TIMER_PWM_OUT10_WO 0
#define CONFIG_TIMER_PWM_OUT10_PIN 12

#define CONFIG_TIMER_PWM_OUT11 1
#define CONFIG_TIMER_PWM_OUT11_IS_TCC
#define CONFIG_TIMER_PWM_OUT11_TC NOT_ON_TC
#define CONFIG_TIMER_PWM_OUT11_TCC TCC2
#define CONFIG_TIMER_PWM_OUT11_WO 1
#define CONFIG_TIMER_PWM_OUT11_PIN 13

//* ============== INTERRUPT =================== *//
#define CONFIG_INTERRUPT 0
#define CONFIG_INTERRUPT_PIN 8

//* ============== I2C SLAVE =================== *//
#define CONFIG_I2C_SLAVE 1
//override the default pins
#define CONFIG_I2C_SLAVE_PIN_SDA 0
#define CONFIG_I2C_SLAVE_PIN_SCL 1

//override default mux
#define CONFIG_I2C_SLAVE_MUX 3

#define CONFIG_I2C_SLAVE_FLOW_CONTROL 1

//* ============== SERCOM =================== *//
#define CONFIG_SERCOM0 0
#define CONFIG_SERCOM1 0
#define CONFIG_SERCOM2 0

//These are only available on samd21
#define CONFIG_SERCOM3 0
#define CONFIG_SERCOM4 0
#define CONFIG_SERCOM5 1

#define CONFIG_SERCOM_UART_PIN_RX (32 + 23)
#define CONFIG_SERCOM_UART_PIN_TX (32 + 2)
#define CONFIG_SERCOM_UART_PAD_TX UART_TX_PAD_0
#define CONFIG_SERCOM_UART_PAD_RX SERCOM_RX_PAD_3
#define CONFIG_SERCOM_UART_BAUD_RATE 115200
#define CONFIG_SERCOM_UART_MUX_TX 3
#define CONFIG_SERCOM_UART_MUX_RX 3

//* ============== DAP =================== *//
#define CONFIG_DAP 0

//* =========== NEOPIXEL ================ *//
#define CONFIG_NEOPIXEL 1

#define CONFIG_NEOPIXEL_BUF_MAX 1024

//* =========== POWER SENSE ================ *//
#define CONFIG_POWER_SENSE 1
#define CONFIG_POWER_SENSE_ADC_PIN (32 + 3)
#define CONFIG_POWER_SENSE_ADC_CHANNEL 11
#define CONFIG_POWER_SENSE_NEOPIX_PIN 27
#define CONFIG_POWER_SENSE_HI_THRESH 375
#define CONFIG_POWER_SENSE_LO_THRESH 256

//* =========== USB ================ *//
#define CONFIG_USB 1

#define USB_VID 0x239A
#define USB_PID 0x002E

#define USB_PRODUCT "Crickit Hat"

#endif
