Skip to content

Commit

Permalink
https://github.com/rusefi/rusefi/issues/6781
Browse files Browse the repository at this point in the history
revive MC33816 driver, also support bus sharing #6781

simpler method name
  • Loading branch information
rusefillc committed Aug 27, 2024
1 parent e75187f commit 4eefbc9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions pt2001/include/rusefi/pt2001.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ class Pt2001Base {

protected:
// The consuming app must implement these functions!
virtual void spiAcquireBus() = 0;
virtual void acquireBus() = 0;
virtual void select() = 0;
virtual void deselect() = 0;
virtual void spiReleaseBus() = 0;
virtual void releaseBus() = 0;
virtual uint16_t sendRecv(uint16_t tx) = 0;
// Send `count` number of 16 bit words from `data`
virtual void sendLarge(const uint16_t* data, size_t count) = 0;
Expand Down
18 changes: 9 additions & 9 deletions pt2001/src/pt2001.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,23 +459,23 @@ bool Pt2001Base::restart() {
// Flag0 should be floating - pulldown means it should read low
flag0before = readFlag0();

spiAcquireBus();
acquireBus();
setupSpi();

clearDriverStatus(); // Initial clear necessary
status = readDriverStatus();
if (checkUndervoltV5(status)) {
onError(McFault::UnderVoltage5);
shutdown();
spiReleaseBus();
releaseBus();
return false;
}

uint16_t chipId = readId();
if (!validateChipId(chipId)) {
onError(McFault::NoComm);
shutdown();
spiReleaseBus();
releaseBus();
return false;
}

Expand All @@ -490,7 +490,7 @@ bool Pt2001Base::restart() {
if (errorOnUnexpectedFlag()) {
onError(McFault::flag0);
shutdown();
spiReleaseBus();
releaseBus();
return false;
}
}
Expand All @@ -511,7 +511,7 @@ bool Pt2001Base::restart() {
if (!checkFlash()) {
onError(McFault::NoFlash);
shutdown();
spiReleaseBus();
releaseBus();
return false;
}

Expand All @@ -526,7 +526,7 @@ bool Pt2001Base::restart() {
if (checkUndervoltVccP(status)) {
onError(McFault::UnderVoltage7);
shutdown();
spiReleaseBus();
releaseBus();
return false;
}

Expand All @@ -537,18 +537,18 @@ bool Pt2001Base::restart() {
if (!checkDrivenEnabled(status)) {
onError(McFault::Driven);
shutdown();
spiReleaseBus();
releaseBus();
return false;
}

status = readDriverStatus();
if (checkUndervoltVccP(status)) {
onError(McFault::UnderVoltageAfter); // Likely DC-DC LS7 is dead!
shutdown();
spiReleaseBus();
releaseBus();
return false;
}

spiReleaseBus();
releaseBus();
return true;
}

0 comments on commit 4eefbc9

Please sign in to comment.