PAL-out the sleep
This commit is contained in:
parent
2f0dfd70b1
commit
17ba85c6e2
|
@ -97,4 +97,7 @@ protected:
|
||||||
|
|
||||||
// Print out an error message
|
// Print out an error message
|
||||||
virtual void onError(const char* why) = 0;
|
virtual void onError(const char* why) = 0;
|
||||||
|
|
||||||
|
// Sleep for some number of milliseconds
|
||||||
|
virtual void sleepMs(size_t ms) = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
|
|
||||||
#include <PT2001_LoadData.h>
|
#include <PT2001_LoadData.h>
|
||||||
|
|
||||||
#include <ch.h>
|
|
||||||
|
|
||||||
const int MC_CK = 6; // PLL x24 / CLK_DIV 4 = 6Mhz
|
const int MC_CK = 6; // PLL x24 / CLK_DIV 4 = 6Mhz
|
||||||
|
|
||||||
const int MAX_SPI_MODE_A_TRANSFER_SIZE = 31; //max size for register config transfer
|
const int MAX_SPI_MODE_A_TRANSFER_SIZE = 31; //max size for register config transfer
|
||||||
|
@ -426,9 +424,9 @@ bool Pt2001Base::restart() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for chip to reset, then release reset and wait again
|
// Wait for chip to reset, then release reset and wait again
|
||||||
chThdSleepMilliseconds(1);
|
sleepMs(1);
|
||||||
setResetB(true);
|
setResetB(true);
|
||||||
chThdSleepMilliseconds(1);
|
sleepMs(1);
|
||||||
|
|
||||||
// Flag0 should be floating - pulldown means it should read low
|
// Flag0 should be floating - pulldown means it should read low
|
||||||
flag0before = readFlag0();
|
flag0before = readFlag0();
|
||||||
|
@ -474,7 +472,7 @@ bool Pt2001Base::restart() {
|
||||||
enableFlash();
|
enableFlash();
|
||||||
|
|
||||||
// give it a moment to take effect
|
// give it a moment to take effect
|
||||||
chThdSleepMilliseconds(10);
|
sleepMs(10);
|
||||||
|
|
||||||
if (!checkFlash()) {
|
if (!checkFlash()) {
|
||||||
onError("MC33 no flash");
|
onError("MC33 no flash");
|
||||||
|
@ -491,7 +489,7 @@ bool Pt2001Base::restart() {
|
||||||
|
|
||||||
// Drive High Voltage
|
// Drive High Voltage
|
||||||
setDriveEN(true); // driven = HV
|
setDriveEN(true); // driven = HV
|
||||||
chThdSleepMilliseconds(10); // Give it a moment
|
sleepMs(10); // Give it a moment
|
||||||
status = readDriverStatus();
|
status = readDriverStatus();
|
||||||
if (!checkDrivenEnabled(status)) {
|
if (!checkDrivenEnabled(status)) {
|
||||||
onError("MC33 Driven did not stick!");
|
onError("MC33 Driven did not stick!");
|
||||||
|
|
Loading…
Reference in New Issue