#include <linux/module.h>
#include <linux/spi/spi.h>
#include <linux/gpio/consumer.h>
#include <linux/list.h>

enum stm32_cmd {
	CMD_SET_LED = 0x50,
	CMD_SET_COLOR_LED = 0x51,
	CMD_DIM_CTRL = 0x52,
	CMD_GPIO_STATE = 0x53,
	CMD_ADC_STATE = 0x54,
	CMD_RESET = 0x55,
	CMD_VERSION = 0x56,
	CMD_GPIO_PRESSED = 0x57,
};

struct stm32 {
	struct spi_device *dev;
	struct gpio_desc *cs_gpio;

	struct list_head leds;
};

extern int stm32_write(struct stm32 *stm32, int cmd, const void *buf, unsigned len);
extern int stm32_read(struct stm32 *stm32, int cmd, void *buf, unsigned len);