Added ethernet module to local hardware instance, since we have to hack it a bit in order to move it to alternative SPI port

Removed Wire and SAMD_AnalogCorrection libraries from HW section, as we didn't change anything in those, so let's keep it to the standard ones

Modified SPI library, initializing extra SPI ports, also HW mux changes in the setup of individual SPI ports to match the GW setup

Added MyHWSAMD files so they are included in the core headers (MyConfig.h / MySensors.h)
This commit is contained in:
Thomas Mørch
2015-12-06 23:16:44 +01:00
parent e229e21d0e
commit c62aca4125
52 changed files with 4505 additions and 1043 deletions
+22 -11
View File
@@ -40,34 +40,45 @@ ISR (WDT_vect)
}
*/
static void hwInitConfigBlock( size_t length = 1024)
{
static bool initDone = false;
if (!initDone)
{
initDone = true;
}
void i2c_eeprom_write_byte(unsigned int eeaddress, byte data ) {
int rdata = data;
Wire.beginTransmission(I2C_EEP_ADDRESS);
Wire.write((int)(eeaddress >> 8)); // MSB
Wire.write((int)(eeaddress & 0xFF)); // LSB
Wire.write(rdata);
Wire.endTransmission();
}
byte i2c_eeprom_read_byte(unsigned int eeaddress ) {
byte rdata = 0xFF;
Wire.beginTransmission(I2C_EEP_ADDRESS);
Wire.write((int)(eeaddress >> 8)); // MSB
Wire.write((int)(eeaddress & 0xFF)); // LSB
Wire.endTransmission();
Wire.requestFrom(I2C_EEP_ADDRESS,1);
if (Wire.available()) rdata = Wire.read();
return rdata;
}
void hwReadConfigBlock(void* buf, void* adr, size_t length)
{
hwInitConfigBlock();
uint8_t* dst = static_cast<uint8_t*>(buf);
int offs = reinterpret_cast<int>(adr);
while (length-- > 0)
{
*dst++ = configBlock[offs++];
*dst++ = i2c_eeprom_read_byte(offs++);
}
}
void hwWriteConfigBlock(void* buf, void* adr, size_t length)
{
hwInitConfigBlock();
uint8_t* src = static_cast<uint8_t*>(buf);
int offs = reinterpret_cast<int>(adr);
while (length-- > 0)
{
configBlock[offs++] = *src++;
i2c_eeprom_write_byte(offs++, *src++);
}
}
+2 -3
View File
@@ -23,7 +23,7 @@
#include "MyConfig.h"
#include "MyMessage.h"
#include <Wire.h>
#ifdef __cplusplus
#include <Arduino.h>
@@ -31,6 +31,7 @@
#endif
#include <avr/dtostrf.h>
#define I2C_EEP_ADDRESS 55
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
@@ -59,6 +60,4 @@ uint8_t hwReadConfig(int adr);
#define hwWriteConfig(__adr, __value) ( __value = __value)
#define hwReadConfig(__adr) (0)
*/
SPIClass _SPI( &sercom1, PIN_SPI_MISO, PIN_SPI_SCK, PIN_SPI_MOSI );
#define USBCON
#endif // #ifdef ARDUINO_ARCH_SAMD