Hello Konnekting folks,
I have been messing around with Konnekting for a while now.
Always with an Arduino Leonardo or Micro Pro.
But I ran into memory issues because of all the things I wanted to do on one board.
I read that the SAMD21G18 chip would suit me better (got myself an Adafruit Feather M0).
I quickly learned that the SAMD21G18 doesn't have EEPROM so I got myself a EEPROM chip (PFC8582).
And it seems to be working with some small writing and reading.
But what are the steps to get it working with Konnekting? What code needs to be added or changed?
Is it enough to add the following?
Within SETUP
And seperate ...
I have been messing around with Konnekting for a while now.
Always with an Arduino Leonardo or Micro Pro.
But I ran into memory issues because of all the things I wanted to do on one board.
I read that the SAMD21G18 chip would suit me better (got myself an Adafruit Feather M0).
I quickly learned that the SAMD21G18 doesn't have EEPROM so I got myself a EEPROM chip (PFC8582).
And it seems to be working with some small writing and reading.
But what are the steps to get it working with Konnekting? What code needs to be added or changed?
Is it enough to add the following?
Within SETUP
Code:
#ifdef __SAMD21G18A__ Wire.begin(); Konnekting.setMemoryReadFunc(&readMemory); Konnekting.setMemoryWriteFunc(&writeMemory); Konnekting.setMemoryUpdateFunc(&updateMemory); Konnekting.setMemoryCommitFunc(&commitMemory); #endif
And seperate ...
Code:
// Arduino Zero has no "real" internal EEPROM, // so we can use an external I2C EEPROM. // For that we need to include Arduino's Wire.h #ifdef __SAMD21G18A__ #include <Wire.h> // Example for 24AA02E64 I2C EEPROM int readMemory(int index) { byte rdata = 0xFF; Wire.beginTransmission(0x50); Wire.write((int) (index)); Wire.endTransmission(); Wire.requestFrom(0x50, 1); if (Wire.available()) { rdata = Wire.read(); } return rdata; } void writeMemory(int index, int val) { Wire.beginTransmission(0x50); Wire.write((int) (index)); Wire.write(val); Wire.endTransmission(); delay(5); //is it needed?! } void updateMemory(int index, int val) { if (readMemory(index) != val) { writeMemory(index, val); } } void commitMemory() { // this is useful if using flash memory to reduce write cycles // EEPROM needs no commit, so this function is intentionally left blank } #endif
Kommentar