Wire.h override


good day people,

i'm writing in ask question. i've been working on i2c eeprom flasher using arduino (for sake of being able it). , i've stumbled upon size of databuffer being used in wire library. ideally, need able write page page (64 bytes @ time), where-as wire.h library support 30 bytes @ time because buffer declared 32-byte buffer , 2 bytes end being used addressing.

what i've tried following, in copy of wire.h, i've made this:
code: [select]

#define buffer_length 32

#ifdef twi_b_override
#undef buffer_length
#define buffer_length twi_b_override
#endif


so when in arduino sketch #define twi_b_override 66, take value , roll it.. however, @ runtime, i'm not seeing bigger buffer being used , instead writes 30 bytes did before.

the following @ top of arduino sketch btw.
code: [select]
#define twi_b_override 66
#include <wire.h>


any , appreciated :) in advance.

quote
my copy of wire.h


did change wire.h in arduino distribution or did make own copy , put somewhere else?

what version of arduino using?

hold 'shift' key down , click 'verify' button in arduino.  it tells "include" directories being used , output files stored.  does "-i" stuff show directory in wire.h located?

quote
top of arduino sketch


look @ output file named "yoursketchname.cpp" in indicated directory.

the first lines should like
code: [select]

#define twi_b_override 64
#include <wire.h>
//
// maybe other stuff included in sketch
//
#include "wprogram.h"
void setup();
void loop();
.
.
.


bottom line: made indicated changes in arduino-0021/hardware/arduino/cores/arduino/wire.h , ran following sketch:
code: [select]
#define twi_b_override 64
#include <wire.h>

void setup()
{
   serial.begin(9600);
}
void loop()
{
   serial.print("twi_b_override = ");
   serial.println(twi_b_override);
   serial.print("buffer_length  = ");
   serial.println(buffer_length);
   delay(10000);
}



here's output arduino duemilanove:


twi_b_override = 64
buffer_length  = 64




regards,

dave


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Wire.h override


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums