Commit Graph

34 Commits

Author SHA1 Message Date
Matthew Kennedy e3bf80b9d7 convert gpiochips to c++ (#2761)
* core

* basic header

* tests are happy

* tle6240

* tle8888

* 33972

* 33810

* tle8888_req_init

* unused warning

* warning

* unsigned

* 8888 debug

* fix

* don't qualify

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-06-10 04:11:01 -04:00
Matthew Kennedy 4b69e7d441 compile gpiochips as cpp (#2702)
* rename

* core

* structing

* more

* makefile

* structing

* 6240 compiles

* explicit cast instead of implicit narrowing

* 8888

* no extern C

* fix tests build

* extern "C"

* 33810

* 8860

* 33810

* linker

* unbreak master

* don't need that if compiling as C++

* bump config

* fix test

* tests

* unit tests bad merge

* build

* move subaru logic to cpp file

* cpp goodness

* hpp include

* this is probably the right thing to do

* simulator
2021-05-17 08:42:56 +03:00
rusefillc d824f3d12a let's build for h7 2021-02-05 21:37:33 -05:00
Andrey G f962a7bd64 Gpio cleanup #2 (#1530)
* pin repository: PIN_USED size in now equal to brain_pin_e enum size

expect special values...

* smart gpios: register gpio chip to given base (no auto-allocation)

* drivers: gpio: core: add gpiochip_unregister()

* drivers: gpio: MC33810 intergation

* smart_gpio.cpp: cleanup ifdef mess, minor cleanups

* gpio: core: additional check for gpio ranges overlaps

* unit test: gpio chip: fixed and extended
2021-01-06 18:29:47 -05:00
Andrey G 2f891cc23a Tle8888 stepper (#1936)
* TLE8888: enable PP mode for OUT21..24 in case of useTLE8888_stepper

* Lada Kalina is a test mule for stepper idle
2020-11-10 14:16:46 -05:00
Andrey G e14fa4b189 Tle8888 small update (#1908)
* TLE8888: add support MR switching from SW

Main Relay has limitation - it is always active while KEY=1. When
KEY=0 MR can be switched on from SW.

* TLE8888: support reading of KEY and WAKE inputs

* Rusefi enums: add new TLE8888 pins
2020-11-01 22:19:55 -05:00
Andrey G 88e830d635 Tle8888 big update 1 (#1892)
* smart gpio: fix tle8888 direct pin mapping for MRE

* MRE: use TLE8888 pins instead of MCU gpios that drives TLE8888

* TLE8888: cleanup

* TLE8888: do not reset driver private data on WD/undervoltage reset

* TLE8888: diagnostic updates

* TLE8888 driver: BIG driver rework

* TLE8888: check SPI answers for abnormal states

Reply with other than requested register can be a sign of:
-Power-On-Reset, then OpStat0 will be replyed
-WatchDog reset, then FWDStat1 will be replyed
-Invalid communication frame, then Diag0 will be replyed

Keep tracking last accessed register and check with the next reply.

* TLE8888: debug clean-up

* TLE8888: implement spi array write

This reduce CS inactive state time between two consequent accesses
from 8.8 uS to 1.4 uS

* TLE8888: fix PP outputs in OD mode

* TLE8888: cleanup register definitions

* TLE8888: run separate driver thread for each chip instance

Calculating poll interval for few chips become more complex, avoid
this running thread for each device.

* TLE8888: fix cypress and kinetic compilation

Both platforms define its own MAX and cause redifination error if
common.h is included in driver.

* MRE: update mapping.yaml and fix direct pin mapping for TLE8888

* TLE8888: diagnnostic: disable switch off in case of overcurrent

For all output, use current limiting instead

* TLE8888: check for overvoltage on OUT8..OUT13

* TLE8888: add TODO note about how to recover from failure condition

Currently TLE8888 automaticly recovers only from overcurrent and
(may be) overtemperature conditions.
Short to bat cause output disable (bit in OECONFIG is reset) and
needs driver/host intervention.

* TLE8888: save few bytes of RAM

* TLE8888: Lada Kalina is test mule for IDLE stepper on TLE8888

Don't forget to enable PP mode for TLE8888 outputs 21..24:
uncomment line 1087 in tle8888.c

* TLE8888: reorder code, cleanup

* TLE8888: mode all debug/statisctic to per-chip struct

* TLE8888: rework poll interval calculation

* MRE: use TLE8888 pins instead of MCU gpios that drives TLE8888 #2
2020-10-23 12:25:30 -04:00
dron0gus 3fd4d9ffc3 tle8888: on MRE 0.5.0 we can drive ING_EN and INJ_EN from STM (#1407)
Do it!
2020-05-08 17:47:41 -04:00
rusefi 95d1771bc5 steps towards tle8888 2020-05-06 19:20:12 -04:00
rusefi b607400984 TLE8888 mode flexibility 2020-04-23 16:57:37 -04:00
rusefi 58e711d683 and fixing build now! 2020-02-12 17:23:22 -05:00
rusefi c78ea7da6c tle8888 refactoring already - extracting method 2020-02-12 17:19:58 -05:00
rusEfi 0c2d00b455 TLE8888 watchdog #917
still no luck. responses 0x85c and 0xa5c
2020-02-11 00:54:15 -05:00
rusEfi fdb9e97fd3 TLE8888 watchdog #917 2020-02-10 14:37:52 -05:00
rusEfi ce54ae9497 TLE8888 watchdog #917
window watchdog progress
2020-02-10 13:24:09 -05:00
rusefi 223fe8ab70 TLE8888 watchdog #917
first steps
2020-02-10 11:11:00 -05:00
rusefi bc118ecede code style 2020-02-10 09:29:11 -05:00
rusefi 63e3e84e08 happy new year 2020-01-08 00:02:40 -05:00
Matthew Kennedy df57b24e3f Shrink output channels, now with passing CI (#1077)
* reorder fields

* temporary tle8888 fix

* comment, simplify

* hand tweak generated

* oops, those are reciprocal

* fix engineLoadAccelExtra

* aggressive priority order

* fix output size

* comments

* reorder fields, no sizes yet

* should've been signed

* simplify constructor mess, hook up scaling

* notes

* typo

* if -> switch

* rev signature

* correct map offset

* handle unsigned properly

* RPM is unsigned

* vss isn't scaled

* extract magic

* required generated for build

* de-scale rpm

* field type cases
2019-12-22 08:12:45 -05:00
rusefi 9ffda831a7 Revert "DRAFT Shrink output channels, again (#1074)"
This reverts commit ad7a383d
2019-12-21 15:02:49 -05:00
Matthew Kennedy ad7a383d74 DRAFT Shrink output channels, again (#1074)
* reorder fields

* temporary tle8888 fix

* comment, simplify

* hand tweak generated

* oops, those are reciprocal

* fix engineLoadAccelExtra

* aggressive priority order

* fix output size

* comments

* reorder fields, no sizes yet

* should've been signed

* simplify constructor mess, hook up scaling

* notes

* typo

* if -> switch
2019-12-21 08:55:19 -05:00
rusefi 7dc6057ac7 Revert "Shrink output channels, use scaling (#1069)"
This reverts commit 1e0f1a26
2019-12-19 22:35:06 -05:00
Matthew Kennedy 1e0f1a2628 Shrink output channels, use scaling (#1069)
* reorder fields

* temporary tle8888 fix

* comment, simplify

* hand tweak generated

* oops, those are reciprocal

* fix engineLoadAccelExtra

* aggressive priority order
2019-12-19 20:37:42 -05:00
andreika-git ef23be6893 Kinetis & TLE8888 compatibility & fixes... (#991)
* TLE8888: More compatibility & postTunerStudioState

* activeConfiguration & EFI_ACTIVE_CONFIGURATION_IN_FLASH fix

* Kinetis: jump_to_bootloader() impl.

* Kinetis: UART baudrate safety check

* Kinetis: OMG!..
2019-10-31 16:06:34 -04:00
rusefi 12d9bc50b3 tle8888 reinit command 2019-09-05 10:30:27 -04:00
rusefi df18a37788 Hall mode for TLE88888 - VRSConfig1 VRSM #915 2019-09-04 00:27:19 -04:00
dron0gus e0796d673b Smart gpios fixes - now without cleanup of smart_gpio.cpp (#758)
* smart_gpio.cpp: check _add return values

And occupy gpiochip's pin range if disabled of failed. So base will
align with enum.

* TLE8888: cleanup, move high level code to smart_gpio.cpp

* smart_gpio.cpp: fix compilation when BOARD_EXT_GPIOCHIPS == 0

* board-subaru: fix compilation after latest smart_gpio updates

* tle8888: now we have all 28 pins supported
2019-04-16 09:23:24 -04:00
rusefi d67f3dc6e1 we need TLE8888 driver #714 2019-04-14 08:20:25 -04:00
rusEfi 45df0b0eba reducing risks 2019-04-13 18:26:29 -04:00
rusefi 50c481924e steps towards smarter gpio 2019-04-13 10:58:52 -04:00
dron0gus 3c0d91e94b gpio-chips: TLE8888 add initial support of spi-driven outputs (#750) 2019-04-13 01:22:16 +02:00
rusefi b23f9e9cf4 we need TLE8888 driver #714 2019-04-04 19:56:03 -04:00
dron0gus fde76155f2 TLE8888: initial support (#733) 2019-04-04 15:55:18 +02:00
rusefi 11e60e35bf we need TLE8888 driver #714 2019-03-25 15:08:32 -04:00