Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues on M0 #66

Closed
kadrim opened this issue Jul 9, 2018 · 5 comments
Closed

Issues on M0 #66

kadrim opened this issue Jul 9, 2018 · 5 comments

Comments

@kadrim
Copy link
Contributor

kadrim commented Jul 9, 2018

Hi there,

i tried your code on adafruit m0 and it needs adjustmends, because the M0 does not have an EEPROM.

In platform_node.h:

#ifdef ARDUINO_AVR_FEATHER32U4 #include <EEPROM.h> #endif

In platform_node.cpp:
`
void PlatformNode::seed(void) {
uint8_t val;
#ifdef ARDUINO_AVR_FEATHER32U4
val = EEPROM.read(EEPROM_ADDRESS_BIND_KEY_SEEDED);

if (val != 0xf1) {
    EEPROM.write(EEPROM_ADDRESS_BIND_0, random(1, 255)); //Yes, from 1 to 254
    EEPROM.write(EEPROM_ADDRESS_BIND_1, random(1, 255)); //Yes, from 1 to 254
    EEPROM.write(EEPROM_ADDRESS_BIND_2, random(1, 255)); //Yes, from 1 to 254
    EEPROM.write(EEPROM_ADDRESS_BIND_3, random(1, 255)); //Yes, from 1 to 254
    EEPROM.write(EEPROM_ADDRESS_BIND_KEY_SEEDED, 0xf1);
} 

#endif
}

void PlatformNode::loadBindKey(uint8_t key[]) {
#ifdef ARDUINO_AVR_FEATHER32U4
key[0] = EEPROM.read(EEPROM_ADDRESS_BIND_0);
key[1] = EEPROM.read(EEPROM_ADDRESS_BIND_1);
key[2] = EEPROM.read(EEPROM_ADDRESS_BIND_2);
key[3] = EEPROM.read(EEPROM_ADDRESS_BIND_3);
#endif
}

void PlatformNode::saveBindKey(uint8_t key[]) {
#ifdef ARDUINO_AVR_FEATHER32U4
EEPROM.write(EEPROM_ADDRESS_BIND_0, key[0]);
EEPROM.write(EEPROM_ADDRESS_BIND_1, key[1]);
EEPROM.write(EEPROM_ADDRESS_BIND_2, key[2]);
EEPROM.write(EEPROM_ADDRESS_BIND_3, key[3]);
EEPROM.write(EEPROM_ADDRESS_BIND_KEY_SEEDED, 0xf1);
#endif
}
`

Best regards,
David

@DzikuVx
Copy link
Owner

DzikuVx commented Jul 10, 2018

Hi,

Unfortunately, EEPROM or some way to store configuration is currently required. I do not have M0 so if noone will find a solution on M0, I will have to drop support for it

@kadrim
Copy link
Contributor Author

kadrim commented Jul 10, 2018

I have some M0 lying around - i will fiddle around with them and try to provide a solution, i.e. using Flash-Memory

@DzikuVx
Copy link
Owner

DzikuVx commented Jul 10, 2018

Yes, that would be the best

@kadrim
Copy link
Contributor Author

kadrim commented Jul 10, 2018

I created a pull request for this issue: #67

Best regards
David

@kadrim
Copy link
Contributor Author

kadrim commented Jul 10, 2018

Resolved

@kadrim kadrim closed this as completed Jul 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants