rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
mc33810.h
Go to the documentation of this file.
1/*
2 * mc33810.h
3 *
4 * Automotive Engine Control IC
5 *
6 * @date Dec 29, 2018
7 * @author Andrey Belomutskiy, (c) 2012-2020
8 *
9 * @date Jan 03, 2020
10 * @author Andrey Gusakov <dron0gus@gmail.com>, (c) 2020
11 */
12
13#pragma once
14
15#include "efifeatures.h"
16#include <hal.h>
17#include "rusefi_types.h"
18
19#define MC33810_INJ_OUTPUTS 4
20#define MC33810_IGN_OUTPUTS 4
21
22#define MC33810_OUTPUTS (MC33810_INJ_OUTPUTS + MC33810_IGN_OUTPUTS)
23#define MC33810_DIRECT_OUTPUTS MC33810_OUTPUTS
24
25/* TODO: add irq support */
26#define MC33810_POLL_INTERVAL_MS 100
27
29#if HAL_USE_SPI
30 SPIDriver *spi_bus;
31 SPIConfig spi_config;
32#endif
33 /* First 4 is injector drivers, then 4 ignition pre-drivers */
34 struct {
36 uint_fast8_t pad;
37 } direct_io[MC33810_DIRECT_OUTPUTS];
38 struct {
40 uint_fast8_t pad;
41 } en;
42 /* See datasheet:
43 * "To avoid any spurious data, it is essential the high-to-low and low-to-high
44 * transitions of the CS signal occur only when SCLK is in a logic low state."
45 * If sck.port != null, driver will wait until SCLK goes low before releasing CS
46 * at the end of each transaction.
47 * STM32 driver/hw is known to affected by this issue */
48 struct {
50 uint_fast8_t pad;
51 } sck;
52
53 /* TODO: fix mix of port+pad vs brain_pin_e */
54 /* Spark duration signal input, active low */
56 /* Nominal ignition coil current flag signal input */
58 /* Maximum ignition coil current flag signal input */
60};
61
62int mc33810_add(brain_pin_e base, unsigned int index, const mc33810_config *cfg);
63
64struct mc33810_state_s;
65const mc33810_state_s* mc33810getLiveData(size_t idx);
66
67/* debug */
68void mc33810_req_init();
GPIO_TypeDef * ioportid_t
Port Identifier.
int getMc33810maxDwellTimer(mc33810maxDwellTimer_e value)
Definition mc33810.cpp:1003
void mc33810_req_init()
Definition mc33810.cpp:993
const mc33810_state_s * mc33810getLiveData(size_t idx)
Definition mc33810.cpp:1021
int mc33810_add(brain_pin_e base, unsigned int index, const mc33810_config *cfg)
MC33810 driver add.
Definition mc33810.cpp:946
mc33810maxDwellTimer_e
struct mc33810_config::@37 en
ioportid_t port
Definition mc33810.h:35
struct mc33810_config::@36 direct_io[MC33810_DIRECT_OUTPUTS]
SPIDriver * spi_bus
Definition mc33810.h:30
struct mc33810_config::@38 sck
brain_pin_e maxi
Definition mc33810.h:59
brain_pin_e spkdur
Definition mc33810.h:55
SPIConfig spi_config
Definition mc33810.h:31
uint_fast8_t pad
Definition mc33810.h:36
brain_pin_e nomi
Definition mc33810.h:57