1wire.h 786 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef _1WIRE_H
  2. #define _1WIRE_H
  3. #define SEARCHROM
  4. #define INITST
  5. #ifdef INITST
  6. extern unsigned char initst;
  7. #endif
  8. #include <avr/io.h>
  9. #define _1WPORT PORTC
  10. #define _1WDDR DDRC
  11. #define _1WPIN PINC
  12. #define _1WL _BV(PC6)
  13. unsigned char _1WireInit(void);
  14. void _1WireWriteSlot(unsigned char bit, unsigned char pr);
  15. unsigned char _1WireReadSlot(void);
  16. void _1WireWriteByte(unsigned char dana);
  17. void _1WireWriteBytePR(unsigned char dana);
  18. unsigned char _1WireReadByte(void);
  19. void _1WirePoweroff(void);
  20. void _1WireSendRom(unsigned char *rom);
  21. unsigned char _1WireSearch(unsigned char rv, unsigned char *buf);
  22. #define _1WLOW() _1WDDR |= _1WL;
  23. #define _1WHIGH() _1WDDR &= ~_1WL;
  24. #define _1WISHIGH() (_1WPIN & _1WL)
  25. #define _1WirePoweroff() { _1WDDR &= ~_1WL; _1WPORT &= ~_1WL; }
  26. #endif