/*
Diplomova prace : Palubni pocitac

serial_num - obsluha DS2401

Atmega128A 10 MHz XTAL

Autor: Ondrej Lutera

2011/2012

*/

#include "serial_num.h"


unsigned char snFind(void){

    ow_set_bus(&SN_PIN,&SN_PORT,&SN_DDR,SN);
    ow_parasite_enable();

    return !ow_reset();

}

void snRead(unsigned char * serialNum){

    unsigned char i;

    ow_set_bus(&SN_PIN,&SN_PORT,&SN_DDR,SN);
    ow_parasite_enable();

    ow_reset();

    ow_byte_wr(0x33)  ;

	for ( i = 0; i < SN_SIZE; i++ ) {
		*(serialNum+SN_SIZE-1-i) = ow_byte_rd();
	}

}
