Skip to content

Commit

Permalink
Due: settings stored in RTC module now (EEPROM)
Browse files Browse the repository at this point in the history
  • Loading branch information
greymfm committed Jul 23, 2017
1 parent bf5fd05 commit e0e6c1c
Show file tree
Hide file tree
Showing 12 changed files with 63 additions and 1,451 deletions.
1 change: 0 additions & 1 deletion code/ardumower/ardumower.ino
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include <EEPROM.h>
#elif __SAM3X8E__
// Arduino Due
#include "due.h"
#else
#error "Wrong Arduino board - Choose Arduino Mega or Arduino Due in Arduino IDE"
#endif
Expand Down
57 changes: 36 additions & 21 deletions code/ardumower/drivers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,42 @@ boolean setDS1307(datetime_t &dt){
}


//bb add to read byte into the Tiny RTC memory
byte readAT24C32(unsigned int address) {
byte b = 0;
int r = 0;
//unsigned int address = 1021;
Wire.beginTransmission(AT24C32_ADDRESS);
if (Wire.endTransmission() == 0) {
Wire.beginTransmission(AT24C32_ADDRESS);
Wire.write(address >> 8);
Wire.write(address & 0xFF);
if (Wire.endTransmission() == 0) {
Wire.requestFrom(AT24C32_ADDRESS, 1);
while (Wire.available() > 0 && r < 1) {
b = (byte)Wire.read();
r++;
}
}
}
return b;
}
//bb add to write byte into the Tiny RTC memory
//bb1
byte writeAT24C32(unsigned int address,byte data) {
//unsigned int address = 1021;
Wire.beginTransmission(AT24C32_ADDRESS);
if (Wire.endTransmission() == 0) {
Wire.beginTransmission(AT24C32_ADDRESS);
Wire.write(address >> 8);
Wire.write(address & 0xFF);
Wire.write(data);
Wire.endTransmission();
delay(20);
}
}


// measure lawn sensor capacity
int measureLawnCapacity(int pinSend, int pinReceive){
int t=0;
Expand Down Expand Up @@ -300,24 +336,3 @@ int getDayOfWeek(int month, int day, int year, int CalendarSystem)
+ CalendarSystem
) % 7;
}

/*
// --- eereadwrite -------------------------------------------------
int eereadwriteString(boolean readflag, int &ee, String& value)
{
unsigned int i;
if (readflag) {
value = "";
char ch = EEPROM.read(ee++);
while (ch) {
value += ch;
ch = EEPROM.read(ee++);
}
} else {
for(i=0; i<value.length(); i++) {
EEPROM.write(ee++, value.charAt(i));
}
EEPROM.write(ee++, 0);
}
}
*/
4 changes: 2 additions & 2 deletions code/ardumower/drivers.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <EEPROM.h>
#else
// Arduino Due
#include "due.h"
#endif


Expand Down Expand Up @@ -125,7 +124,8 @@ int measureLawnCapacity(int pinSend, int pinReceive);
// real time drivers
boolean readDS1307(datetime_t &dt);
boolean setDS1307(datetime_t &dt);

byte readAT24C32(unsigned int address);
byte writeAT24C32(unsigned int address,byte data);

// Returns the day of week (0=Sunday, 6=Saturday) for a given date
int getDayOfWeek(int month, int day, int year, int CalendarSystem);
Expand Down
188 changes: 0 additions & 188 deletions code/ardumower/due.cpp

This file was deleted.

61 changes: 0 additions & 61 deletions code/ardumower/due.h

This file was deleted.

Loading

0 comments on commit e0e6c1c

Please sign in to comment.