#ifndef ONEWIRE_H_
#define ONEWIRE_H_

#ifdef __cplusplus
	extern "C" {
#endif

#include <stdint.h>

/*******************************************/
/* Hardware connection                     */
/*******************************************/

/* Define OW_ONE_BUS if only one 1-Wire-Bus is used
   in the application -> shorter code.
   If not defined make sure to call ow_set_bus() before using 
   a bus. Runtime bus-select increases code size by around 300 
   bytes so use OW_ONE_BUS if possible */
 #define OW_ONE_BUS
#define OW_PORT	GPIOA
#define OW_PIN GPIO_Pin_5


	

	#define OW_CONF_DELAYOFFSET 0	//	13

#define OW_RECOVERY_TIME         10 /* usec */

#define OW_USE_INTERNAL_PULLUP     0  /* 0=external, 1=internal */
// nebude vyuzit interni pullup mikrokontroleru
/*******************************************/


#define OW_MATCH_ROM    0x55
#define OW_SKIP_ROM     0xCC
#define OW_SEARCH_ROM   0xF0

#define OW_SEARCH_FIRST 0xFF        // start new search
#define OW_PRESENCE_ERR 0xFF
#define OW_DATA_ERR     0xFE
#define OW_LAST_DEVICE  0x00        // last device found

#define OW_READ_ROM		0x33		// precte ROM CODE
// rom-code size including CRC
#define OW_ROMCODE_SIZE 8

extern uint8_t ow_reset(void);

extern uint8_t ow_bit_io( uint8_t b );
extern uint8_t ow_byte_wr( uint8_t b );
extern uint8_t ow_byte_rd( void );

extern uint8_t ow_rom_search( uint8_t diff, uint8_t *id );

extern void ow_command( uint8_t command, uint8_t *id );
extern void ow_command_with_parasite_enable( uint8_t command, uint8_t *id );

extern void ow_parasite_enable( void );
extern void ow_parasite_disable( void );
extern uint8_t ow_input_pin_state( void );

#ifndef OW_ONE_BUS

#endif

#ifdef __cplusplus
	}
#endif

#endif
