/*
 * testo.h: test-o hardware configuration
 *
 * file creation: 20231015 0021
 */

#ifndef _INC_TESTO_H
#define _INC_TESTO_H


#include "py32f0xx_conf.h"



#define CONF_SET1_PORT      GPIOA
#define CONF_SET1_PIN       0			// analog-input
#define CONF_SET1_AN		ADC_CHSELR_CHSEL0

#define VREF_IN_PORT		GPIOA
#define VREF_IN_PIN			0			// anlog-input
#define VREF_IN_AN			ADC_CHSELR_CHSEL0

#define PROBE_PORT			GPIOA
#define PROBE_PIN			1			// analog-input
#define PROBE_AN			ADC_CHSELR_CHSEL1

#define I2C_PORT			GPIOA
#define I2C_DEV				I2C1
#define I2C_AF				LL_GPIO_AF12_I2C
#define I2C_IRQn			I2C1_IRQn
#define I2C_SDA_PIN			2			// alt-func
#define I2C_SCL_PIN			3			// alt-func

#define RGB_PORT			GPIOA
#define RGB_B_PIN			4			// alt-func
#define RGB_G_PIN			5			// alt-func
#define RGB_R_PIN			6			// alt-func
#define TIM_RGB				TIM3
#define TIM_RGB_B_CH		LL_TIM_CHANNEL_CH3
#define TIM_RGB_G_CH		LL_TIM_CHANNEL_CH2
#define TIM_RGB_R_CH		LL_TIM_CHANNEL_CH1
#define PWM_RGB_B			TIM_RGB->CCR3
#define PWM_RGB_G			TIM_RGB->CCR2
#define PWM_RGB_R			TIM_RGB->CCR1

#define CONF_MODE_PORT		GPIOA
#define CONF_MODE_PIN		7			// analog-input
#define CONF_MODE_AN		ADC_CHSELR_CHSEL7

#define RGBSEL0_PORT		GPIOA
#define RGBSEL0_PIN			12			// output, default high

#define UART_PORT			GPIOA
#define UART_DEV			USART1
#define UART_IRQN			USART1_IRQn
#define UART_RX_PIN			13			// alt-func (if used)
#define UART_RX_AF			LL_GPIO_AF8_USART1
#define UART_TX_PIN			14			// alt-func (if used)
#define UART_TX_AF			LL_GPIO_AF1_USART1


#define CONF_SET0_PORT		GPIOB
#define CONF_SET0_PIN		0			// analog-input
#define CONF_SET0_AN		ADC_CHSELR_CHSEL8

#define RGBSEL1_PORT		GPIOB
#define RGBSEL1_PIN			1			// output, default high


#define PROBESEL_PORT		GPIOF
#define PROBESEL_PIN		2			// output, default high


#define ADC_SET0			3
#define ADC_SET1			0
#define ADC_SET_MODE		2

#define ADC_PROBE			1

#define ADC_VREF_INT		4
#define ADC_VREF_EXT		0
// #define ADC_THERM		4



#endif /* _INC_TESTO_H */