Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/Platform.cpp')
-rw-r--r--src/Platform.cpp36
1 files changed, 10 insertions, 26 deletions
diff --git a/src/Platform.cpp b/src/Platform.cpp
index 1edfb007..eb7160bb 100644
--- a/src/Platform.cpp
+++ b/src/Platform.cpp
@@ -35,9 +35,9 @@
#include "SoftTimer.h"
#include "Logger.h"
#include "Tasks.h"
-#include "DmacManager.h"
+#include "Hardware/DmacManager.h"
#include "Math/Isqrt.h"
-#include "Wire.h"
+#include "Hardware/I2C.h"
#ifndef __LPC17xx__
# include "sam/drivers/tc/tc.h"
@@ -166,13 +166,13 @@ extern "C" void UrgentInit()
uint8_t Platform::softwareResetDebugInfo = 0; // extra info for debugging
-Platform::Platform() :
- logger(nullptr), board(DEFAULT_BOARD_TYPE), active(false), errorCodeBits(0),
+Platform::Platform()
+ : logger(nullptr), board(DEFAULT_BOARD_TYPE), active(false), errorCodeBits(0),
#if HAS_SMART_DRIVERS
- nextDriveToPoll(0),
+ nextDriveToPoll(0),
#endif
- lastFanCheckTime(0), auxGCodeReply(nullptr), sysDir(nullptr), tickState(0), debugCode(0),
- lastWarningMillis(0), deliberateError(false), i2cInitialised(false)
+ lastFanCheckTime(0), auxGCodeReply(nullptr), sysDir(nullptr), tickState(0), debugCode(0),
+ lastWarningMillis(0), deliberateError(false)
{
massStorage = new MassStorage(this);
}
@@ -292,7 +292,7 @@ void Platform::Init()
ARRAY_INIT(defaultMacAddress, DefaultMacAddress);
// Motor current setting on Duet 0.6 and 0.8.5
- InitI2c();
+ I2C::Init();
mcpExpansion.setMCP4461Address(0x2E); // not required for mcpDuet, as this uses the default address
ARRAY_INIT(potWipes, POT_WIPES);
senseResistor = SENSE_RESISTOR;
@@ -2356,8 +2356,8 @@ void Platform::Diagnostics(MessageType mtype)
#ifdef I2C_IFACE
const TwoWire::ErrorCounts errs = I2C_IFACE.GetErrorCounts(true);
- MessageF(mtype, "I2C nak errors %" PRIu32 ", send timeouts %" PRIu32 ", receive timeouts %" PRIu32 ", finishTimeouts %" PRIu32 "\n",
- errs.naks, errs.sendTimeouts, errs.recvTimeouts, errs.finishTimeouts);
+ MessageF(mtype, "I2C nak errors %" PRIu32 ", send timeouts %" PRIu32 ", receive timeouts %" PRIu32 ", finishTimeouts %" PRIu32 ", resets %" PRIu32 "\n",
+ errs.naks, errs.sendTimeouts, errs.recvTimeouts, errs.finishTimeouts, errs.resets);
#endif
}
@@ -4782,22 +4782,6 @@ bool Platform::SetDateTime(time_t time)
return ok;
}
-// Initialise the I2C interface, if not already done
-void Platform::InitI2c()
-{
-#if defined(I2C_IFACE)
- if (!i2cInitialised)
- {
- MutexLocker lock(Tasks::GetI2CMutex());
- if (!i2cInitialised) // test it again, now that we own the mutex
- {
- I2C_IFACE.BeginMaster(I2cClockFreq);
- i2cInitialised = true;
- }
- }
-#endif
-}
-
#if SAM4E || SAM4S || SAME70
// Get a pseudo-random number