we need TLE8888 driver #714
This commit is contained in:
parent
5b11926fea
commit
334af50f3f
|
@ -38,7 +38,7 @@ endif
|
||||||
# C++ specific options here (added to USE_OPT).
|
# C++ specific options here (added to USE_OPT).
|
||||||
ifeq ($(USE_CPPOPT),)
|
ifeq ($(USE_CPPOPT),)
|
||||||
# constexpr float expf_taylor_impl probably needs just c++14 but why not go with 17?
|
# constexpr float expf_taylor_impl probably needs just c++14 but why not go with 17?
|
||||||
USE_CPPOPT = -std=c++17 -Wno-register -fno-rtti -fno-exceptions -fno-use-cxa-atexit -Werror=write-strings -Werror=type-limits
|
USE_CPPOPT = -std=c++17 -Wno-register -fno-rtti -fno-threadsafe-statics -fno-exceptions -fno-use-cxa-atexit -Werror=write-strings -Werror=type-limits
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Enable this if you want the linker to remove unused code and data
|
# Enable this if you want the linker to remove unused code and data
|
||||||
|
|
|
@ -21,6 +21,7 @@ void turnAllPinsOff(void);
|
||||||
#define turnAllPinsOff() {}
|
#define turnAllPinsOff() {}
|
||||||
#endif /* EFI_GPIO_HARDWARE */
|
#endif /* EFI_GPIO_HARDWARE */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
/**
|
/**
|
||||||
* @brief Single output pin reference and state
|
* @brief Single output pin reference and state
|
||||||
*/
|
*/
|
||||||
|
@ -143,6 +144,8 @@ public:
|
||||||
NamedOutputPin auxValve[AUX_DIGITAL_VALVE_COUNT];
|
NamedOutputPin auxValve[AUX_DIGITAL_VALVE_COUNT];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* it's a macro to be sure that stack is not used
|
* it's a macro to be sure that stack is not used
|
||||||
* @return 0 for OM_DEFAULT and OM_OPENDRAIN
|
* @return 0 for OM_DEFAULT and OM_OPENDRAIN
|
||||||
|
@ -161,8 +164,8 @@ public:
|
||||||
|
|
||||||
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
||||||
|
|
||||||
ioportmask_t getHwPin(const char *msg, brain_pin_e brainPin);
|
EXTERNC ioportmask_t getHwPin(const char *msg, brain_pin_e brainPin);
|
||||||
ioportid_t getHwPort(const char *msg, brain_pin_e brainPin);
|
EXTERNC ioportid_t getHwPort(const char *msg, brain_pin_e brainPin);
|
||||||
const char *portname(ioportid_t GPIOx);
|
const char *portname(ioportid_t GPIOx);
|
||||||
|
|
||||||
#endif /* EFI_GPIO_HARDWARE */
|
#endif /* EFI_GPIO_HARDWARE */
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
EXTERN_CONFIG;
|
EXTERN_CONFIG;
|
||||||
|
|
||||||
#include "hardware.h"
|
#include "hardware.h"
|
||||||
|
#include "efi_gpio.h"
|
||||||
#include "gpio/gpio_ext.h"
|
#include "gpio/gpio_ext.h"
|
||||||
#include "gpio/tle8888.h"
|
#include "gpio/tle8888.h"
|
||||||
#include "pin_repository.h"
|
#include "pin_repository.h"
|
||||||
|
@ -261,7 +262,7 @@ int tle8888_add(unsigned int index, const struct tle8888_config *cfg)
|
||||||
|
|
||||||
/* this should be in board file */
|
/* this should be in board file */
|
||||||
static struct tle8888_config tle8888_cfg = {
|
static struct tle8888_config tle8888_cfg = {
|
||||||
.spi_bus = NULL/*&SPID4*/,
|
.spi_bus = NULL,
|
||||||
.spi_config = {
|
.spi_config = {
|
||||||
.circular = false,
|
.circular = false,
|
||||||
.end_cb = NULL,
|
.end_cb = NULL,
|
||||||
|
@ -291,7 +292,19 @@ static struct tle8888_config tle8888_cfg = {
|
||||||
|
|
||||||
void initTle8888(DECLARE_ENGINE_PARAMETER_SIGNATURE)
|
void initTle8888(DECLARE_ENGINE_PARAMETER_SIGNATURE)
|
||||||
{
|
{
|
||||||
|
if (engineConfiguration->tle8888_cs == GPIO_UNASSIGNED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// todo: reuse initSpiCs method?
|
||||||
|
tle8888_cfg.spi_config.ssport = getHwPort("tle8888", engineConfiguration->tle8888_cs);
|
||||||
|
tle8888_cfg.spi_config.sspad = getHwPin("tle8888", engineConfiguration->tle8888_cs);
|
||||||
|
|
||||||
tle8888_cfg.spi_bus = getSpiDevice(engineConfiguration->tle8888spiDevice);
|
tle8888_cfg.spi_bus = getSpiDevice(engineConfiguration->tle8888spiDevice);
|
||||||
|
if (tle8888_cfg.spi_bus == NULL) {
|
||||||
|
// error already reported
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
tle8888_add(0, &tle8888_cfg);
|
tle8888_add(0, &tle8888_cfg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
/* note that spi transfer should be LSB first */
|
/* note that spi transfer should be LSB first */
|
||||||
struct tle8888_config {
|
struct tle8888_config {
|
||||||
SPIDriver *spi_bus;
|
SPIDriver *spi_bus;
|
||||||
const SPIConfig spi_config;
|
SPIConfig spi_config;
|
||||||
/* bidirectional, check DS */
|
/* bidirectional, check DS */
|
||||||
struct {
|
struct {
|
||||||
ioportid_t port;
|
ioportid_t port;
|
||||||
|
|
|
@ -159,6 +159,8 @@ void initI2Cmodule(void) {
|
||||||
//static char txbuf[1];
|
//static char txbuf[1];
|
||||||
|
|
||||||
static void sendI2Cbyte(int addr, int data) {
|
static void sendI2Cbyte(int addr, int data) {
|
||||||
|
(void)addr;
|
||||||
|
(void)data;
|
||||||
// i2cAcquireBus(&I2CD1);
|
// i2cAcquireBus(&I2CD1);
|
||||||
// txbuf[0] = data;
|
// txbuf[0] = data;
|
||||||
// i2cMasterTransmit(&I2CD1, addr, txbuf, 1, NULL, 0);
|
// i2cMasterTransmit(&I2CD1, addr, txbuf, 1, NULL, 0);
|
||||||
|
@ -458,6 +460,13 @@ void initHardware(Logging *l) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFI_TLE8888
|
#if EFI_TLE8888
|
||||||
|
if (engineConfiguration->tle8888_cs != GPIO_UNASSIGNED) {
|
||||||
|
static OutputPin tle8888Cs;
|
||||||
|
// // SPI pins are enabled in initSpiModules()
|
||||||
|
tle8888Cs.initPin("tle8888 CS", engineConfiguration->tle8888_cs,
|
||||||
|
&engineConfiguration->tle8888_csPinMode);
|
||||||
|
}
|
||||||
|
|
||||||
initTle8888(PASS_ENGINE_PARAMETER_SIGNATURE);
|
initTle8888(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue