1
0

1wire.h 850 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * 1wire.h
  3. * k4be 2019
  4. * License: BSD
  5. */
  6. #ifndef OWIRE_H_
  7. #define OWIRE_H_
  8. #undef SEARCHROM
  9. #undef INITST
  10. #ifdef INITST
  11. extern unsigned char initst;
  12. #endif
  13. #include <avr/io.h>
  14. #define _1WPORT PORTB
  15. #define _1WDDR DDRB
  16. #define _1WPIN PINB
  17. #define _1WL _BV(PB0)
  18. unsigned char _1WireInit(void);
  19. void _1WireWriteSlot(unsigned char bit, unsigned char pr);
  20. unsigned char _1WireReadSlot(void);
  21. void _1WireWriteByte(unsigned char dana);
  22. void _1WireWriteBytePR(unsigned char dana);
  23. unsigned char _1WireReadByte(void);
  24. void _1WirePoweroff(void);
  25. void _1WireSendRom(unsigned char *rom);
  26. unsigned char _1WireSearch(unsigned char rv, unsigned char *buf);
  27. #define _1WLOW() _1WDDR |= _1WL;
  28. #define _1WHIGH() _1WDDR &= ~_1WL;
  29. #define _1WISHIGH() (_1WPIN & _1WL)
  30. #define _1WirePoweroff() { _1WDDR &= ~_1WL; _1WPORT &= ~_1WL; }
  31. #endif /* OWIRE_H_ */