/*
Diplomova prace : Palubni pocitac

ibutton.h

Atmega128A 10 MHz XTAL

Autor: Ondrej Lutera

2011/2012

*/

#ifndef IBUTTON_H_INCLUDED
#define IBUTTON_H_INCLUDED

#include "ds18lib/onewire.h"
#include <avr/io.h>
#include "define.h"

#ifdef CAR_DEBUG
#include "uart.h"
#include "uart_addon.h"
#include <avr/pgmspace.h>
#endif

#define SP_SIZE 8

#define IBUT_PIN    PING
#define IBUT_DDR    DDRG
#define IBUT_PORT   PORTG
#define IBUT        PG4

#define IBUT_LED    PD5
#define IBUT_LED_DDR    DDRD
#define IBUT_LED_PORT   PORTD


typedef struct{

    unsigned char romCode[SP_SIZE];

}ibutton_t;

unsigned char ibuttonFind(void);        // funkce ktera hleda zarizeni na sbernici

void ibuttonRead(ibutton_t * pStruct);      // vraci seriove cislo nalezleho klice

void ibuttonLed(unsigned char bit);     //nastavuje stav LED v ctecce iButton

#endif // IBUTTON_H_INCLUDED
