2019-03-13 05:03:22 -07:00
|
|
|
/*
|
|
|
|
* tle6240.h
|
|
|
|
*
|
|
|
|
* TLE6240GP Smart 16-Channel Low-Side Switch
|
|
|
|
*
|
|
|
|
* @date Dec 29, 2018
|
2020-01-13 18:57:43 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
2019-03-13 05:03:22 -07:00
|
|
|
*/
|
|
|
|
|
2020-02-10 06:29:11 -08:00
|
|
|
#pragma once
|
2019-03-13 05:03:22 -07:00
|
|
|
|
2019-04-13 07:58:52 -07:00
|
|
|
#include "efifeatures.h"
|
2019-03-13 05:03:22 -07:00
|
|
|
#include <hal.h>
|
|
|
|
|
|
|
|
#define TLE6240_OUTPUTS 16
|
|
|
|
#define TLE6240_DIRECT_OUTPUTS 8
|
|
|
|
|
2023-11-22 18:19:14 -08:00
|
|
|
/* TODO: add irq support */
|
2019-03-13 05:03:22 -07:00
|
|
|
#define TLE6240_POLL_INTERVAL_MS 100
|
|
|
|
|
|
|
|
struct tle6240_config {
|
2021-02-05 18:37:33 -08:00
|
|
|
#if HAL_USE_SPI
|
2019-03-13 05:03:22 -07:00
|
|
|
SPIDriver *spi_bus;
|
2019-04-20 20:39:06 -07:00
|
|
|
SPIConfig spi_config;
|
2021-02-05 18:37:33 -08:00
|
|
|
#endif
|
2019-03-13 05:03:22 -07:00
|
|
|
struct {
|
|
|
|
ioportid_t port;
|
|
|
|
uint_fast8_t pad;
|
|
|
|
} direct_io[TLE6240_DIRECT_OUTPUTS];
|
|
|
|
struct {
|
|
|
|
ioportid_t port;
|
|
|
|
uint_fast8_t pad;
|
|
|
|
} reset;
|
|
|
|
};
|
|
|
|
|
2021-01-06 15:29:47 -08:00
|
|
|
int tle6240_add(brain_pin_e base, unsigned int index, const struct tle6240_config *cfg);
|