Skip to content

Commit

Permalink
readDriverStatus2 shame
Browse files Browse the repository at this point in the history
  • Loading branch information
rusefillc committed Jun 12, 2023
1 parent e2f4f44 commit 45ccd8e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions pt2001/include/rusefi/pt2001.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class Pt2001Base {

McFault fault = McFault::None;
uint16_t status = 0;
uint16_t status2 = 0;

private:
// SPI tx/rx helpers
Expand All @@ -71,6 +72,7 @@ class Pt2001Base {
uint16_t readDram(MC33816Mem addr);
void writeDram(MC33816Mem addr, uint16_t data);
uint16_t readDriverStatus();
uint16_t readDriverStatus2();
void clearDriverStatus();

protected:
Expand Down
15 changes: 12 additions & 3 deletions pt2001/src/pt2001.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,21 @@ void Pt2001Base::clearDriverStatus(){
deselect();
}

uint16_t Pt2001Base::readDriverStatus(){
uint16_t driverStatus;
uint16_t Pt2001Base::readDriverStatus() {
setupSpi(); // ensure on common page?
select();
send((0x8000 | 0x1D2 << 5) + 1);
driverStatus = recv();
uint16_t driverStatus = recv();
deselect();
return driverStatus;
}

uint16_t Pt2001Base::readDriverStatus2() {
// todo: shame on me extract method!
setupSpi(); // ensure on common page?
select();
send((0x8000 | 0x1A5 << 5) + 1);
uint16_t driverStatus = recv();
deselect();
return driverStatus;
}
Expand Down

0 comments on commit 45ccd8e

Please sign in to comment.