1wire.h 687 B

123456789101112131415161718192021222324252627
  1. #ifndef _1WIRE_H
  2. #define _1WIRE_H
  3. #include <avr/io.h>
  4. #define _1WPORT PORTB
  5. #define _1WDDR DDRB
  6. #define _1WPIN PINB
  7. #define _1WL _BV(PB3)
  8. unsigned char _1WireInit(void);
  9. void _1WireWriteSlot(unsigned char bit, unsigned char pr);
  10. unsigned char _1WireReadSlot(void);
  11. void _1WireWriteByte(unsigned char dana);
  12. void _1WireWriteBytePR(unsigned char dana);
  13. unsigned char _1WireReadByte(void);
  14. //void _1WirePoweroff(void);
  15. void _1WireSendRom(unsigned char *rom);
  16. unsigned char _1WireSearch(unsigned char rv, unsigned char *buf);
  17. #define ZERO _1WDDR |= _1WL;
  18. #define JEDEN _1WDDR &= ~_1WL;
  19. #define WYS (_1WPIN & _1WL)
  20. #define _1WirePoweroff() { _1WDDR &= ~_1WL; _1WPORT &= ~_1WL; }
  21. #endif