TimerOne and Wire Library


i've been scratching head on hour or , nailed down it's interrupt issue.

basically i'm needed timer every 25 microseconds update led matrix, , i'm using wire library read in wii nunchuk data.

if disable timerone, no issues, need 25us clock cycle leds.

code: [select]
void setup()
{
 
 serial.begin(57600);
 serial.println("booting up.....");
 

 is_connected = 0;
 nunchuck_pre_init();

 timer1.initialize( 25 );              // initialize timer1, 25 microseconds refresh rate.
 // adjust please. slow makes leds flicker.
 // fast , interrupt may chew processing speed!

 timer1.attachinterrupt( shipled ) ;  // attaches routine drive leds
}



in loop() i'm pretty polling nunchuk data looks like:

code: [select]

static void nunchuck_get_data()
{
 
 send_zero (3); // send request next bytes
 cnt = 0;

 wire.requestfrom (wii_nunchuck_twi_adr, wii_telegram_len);      // request data nunchuck

 while (wire.available ())
   {
     outbuf[cnt] = nunchuk_decode_byte (wire.receive ());      // receive byte integer
     cnt++;
   }
 
  if (cnt >= 5)
   {
     nunchuck_save ();
   }

 cnt = 0;
 cleartwiinputbuffer();
}



is there way around this? thanks!

chris



Arduino Forum > Forum 2005-2010 (read only) > Software > Development > TimerOne and Wire Library


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