os/services/testbed/dcube/sky/dcube-sky.c
void
eeprom_write(uint8_t* src_buf)
{
  watchdog_stop();

  // raise gpio pin to indicate write operation
  P2OUT |= BV(EVENT_PIN);

  //start i2c communication
  my2c_start();
  //write address on the bus
  my2c_write(0x50 << 1);
  //write memory address (2 bytes)
  my2c_write(dc_cfg.patterns[tb_pattern_id].msg_offsetH);
  my2c_write(dc_cfg.patterns[tb_pattern_id].msg_offsetL);

  uint8_t i;
  //write messages up to the length in the struct
  for(i = 0; i < dc_cfg.patterns[tb_pattern_id].msg_length; i++) {
    my2c_write(src_buf[i]);
  }
  //stop i2c communication
  my2c_stop();

  //lower gpio pin to indicate finished write
  P2OUT &= ~BV(EVENT_PIN);

  watchdog_start();
}
/*---------------------------------------------------------------------------*/
// using the msg len from the configuration struct
using the msg len from the configuration struct
using the msg len from the configuration struct
void
eeprom_write(uint8_t* src_buf)
{
  watchdog_stop();
  P2OUT |= BV(EVENT_PIN);
  my2c_start();
  my2c_write(0x50 << 1);
  my2c_write(dc_cfg.patterns[tb_pattern_id].msg_offsetH);
  my2c_write(dc_cfg.patterns[tb_pattern_id].msg_offsetL);
  uint8_t i;
  for(i = 0; i < dc_cfg.patterns[tb_pattern_id].msg_length; i++) {
    my2c_write(src_buf[i]);
  }
  my2c_stop();
  P2OUT &= ~BV(EVENT_PIN);
  watchdog_start();
}
void eeprom_write ( uint8_t * src_buf ) { watchdog_stop ( ) ; P2OUT |= BV ( EVENT_PIN ) ; my2c_start ( ) ; my2c_write ( 0x50 << 1 ) ; my2c_write ( dc_cfg . patterns [ tb_pattern_id ] . msg_offsetH ) ; my2c_write ( dc_cfg . patterns [ tb_pattern_id ] . msg_offsetL ) ; uint8_t i ; for ( i = 0 ; i < dc_cfg . patterns [ tb_pattern_id ] . msg_length ; i ++ ) { my2c_write ( src_buf [ i ] ) ; } my2c_stop ( ) ; P2OUT &= ~ BV ( EVENT_PIN ) ; watchdog_start ( ) ; }
using the msg len from the configuration struct
using the msg len from the configuration struct
// raise gpio pin to indicate write operation //start i2c communication //write address on the bus //write memory address (2 bytes) //write messages up to the length in the struct //stop i2c communication //lower gpio pin to indicate finished write