Show Posts
Pages: [1]
1  Products / Arduino Due / Re: Dual I2C on Arduino DUE on: January 18, 2013, 07:33:28 pm
Hello,

Wire and Wire1 for I2C and I2C1 receptivity.  


See Wire.h for details...

Code:
#if WIRE_INTERFACES_COUNT > 0
extern TwoWire Wire;
#endif
#if WIRE_INTERFACES_COUNT > 1
extern TwoWire Wire1;
#endif


Cheers,


2  Products / Arduino Due / Re: Due compatible Time library? on: January 17, 2013, 07:57:46 pm
Hello Paul Stoffregen,

I have tested your version of Time and it's remotely to be ported for Due. Actually I already did the time_t variable name change, but that is not the only thing that need to be modified (I did it as bperrybap suggest thought).

Code:
#include <machine/types.h>

#ifndef __time_t_defined
//typedef unsigned long time_t; // original library typedef.
typedef _TIME_T_ time_t;
#define __time_t_defined
#endif


After that I have been through several compiling errors I would like to bring them here.
First with setTime function, it seems that overloading that function bothers the compiler
previous declaration 'void setTime(atime_t)' here

I decide to remove (comment out) the version with more arguments as you can use the makeTime to have time_t from individual values.
I also have to remove from Time Folder the file DateStrings.cpp.

After all that I make a simple test file like this

Code:
#include <Wire.h>  
#include <Time.h>  

void setup()  {
  Wire.begin();
  Serial.begin(9600);
  Serial.println("setup RTC test");

  tmElements_t t;
  t.Second = 0;
  t.Minute = 30;
  t.Hour = 19;
  t.Wday = 3;
  t.Day = 16;
  t.Month = 1;
  t.Year = y2kYearToTm(13);
  Serial.println("setup makeTime");
  makeTime(t);
//  setTime(makeTime(t));
  Serial.println("how come  ");

  
}
void loop()
{
   digitalClockDisplay();  
   delay(1000);
}



void digitalClockDisplay(){
  // digital clock display of the time
  time_t t = now();
  Serial.print(hour(t));
  printDigits(minute(t));
  printDigits(second(t));
  Serial.print(" ");
  Serial.print(day(t));
  Serial.print(" ");
  Serial.print(month(t));
  Serial.print(" ");
  Serial.print(year(t));
  Serial.println();
}

void printDigits(int digits){
  // utility function for digital clock display: prints preceding colon and leading 0
  Serial.print(":");
  if(digits < 10)
    Serial.print('0');
  Serial.print(digits);
}


the good thing is that it compiles but the bad is that a warning appears

test_time.cpp.o: In function `setup':
C:\...\arduino-1.5.1r2/test_time.ino:24: warning: undefined reference to `makeTime(tmElements_t&)'
Binary sketch size: 25,856 bytes (of a 524,288 byte maximum)


I recently discover that if you put the Time.h include at the beginning of the import section it produces the above error and the Due hangs before it can print "how come".

If you put any other import before Time.h it compiles cleanly and run without problems.

Maybe it have to do with

Quote
Then the STUPID IDE also has an issue that rears it ugly head again that breaks this.
The IDE inserts its prologue which includes
Code:
#include "Arduino.h"
in the middle of the sketch .cpp file so it ends up after the
Code:
#include <Time.h>
So the system version of time_t doesn't get typed before the library Time.h looks at the define.
You have to insert some dummy code to coerce the silly IDE to put the prologue at the top of the .cpp file
I added this to the example sketch:
Code:
int dummy = 0;
right at the top of the sketch.

I found another issue, in file Time.h the line
Code:
typedef time_t(*getExternalTime)();

should be

Code:
typedef time_t(*getExternalTime)(void);

Best,
3  Products / Arduino Due / Time Library on: January 16, 2013, 10:32:24 pm
Hello to all,

I am trying to adapt the Time library for Due board. After getting rid of some problems with types and Progmem i finnaly make it to compile but with some warnings.

Every time I invoke a function from Time library, the compiler complains for example

 warning: undefined reference to `makeTime(tmElements_t&)'

I am attaching my library and .ino test file if someone can take a look. I will be very appreciated.

Thanks for reading,

P.S. i have ported this Time Library to chipKit Max32 whitout problems but Due is giving me a hard time.
Pages: [1]