void owchip_geteui(uint8_t* eui) { // >= 6000us uint8_t id[8]; int retry; int crc; uint8_t* byte; uint16_t oldTactl; retry = 5; memset(eui,0,8); // store current value of TACTL oldTactl = TACTL; // start timer in continuous mode at 1MHz TACTL = TASSEL_2 | ID_2 | MC_2; owpin_init(); while (retry-- > 0) { crc = 0; if(ow_reset()) { ow_write_byte(0x33); //read rom for(byte=id+7; byte>=id; byte--) { crc = crc8_byte( crc, *byte=ow_read_byte() ); } if(crc==0) { // CRC valid memcpy(eui,id,8); } } } // restore value of TACTL TACTL = oldTactl; }
void eui64_get(uint8_t* addressToWrite) { // >= 6000us uint8_t id[8]; int retry; int crc; uint8_t* byte; uint16_t oldTactl; return;//poipoi retry = 5; memset(addressToWrite,0,8); // store current value of TACTL oldTactl = TACTL; // start timer in continuous mode at 1MHz TACTL = TASSEL_2 | ID_2 | MC_2; owpin_init(); while (retry-- > 0) { crc = 0; if(ow_reset()) { ow_write_byte(0x33); //read rom for(byte=id+7; byte>=id; byte--) { crc = crc8_byte( crc, *byte=ow_read_byte() ); } if(crc==0) { // CRC valid *(addressToWrite+0) = 0x14; *(addressToWrite+1) = 0x15; *(addressToWrite+2) = 0x92; memcpy(addressToWrite+3,id+1,5); } } } // restore value of TACTL TACTL = oldTactl; }