4094.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef SHREG_4094_H_
  2. #define SHREG_4094_H_
  3. /*** HARDWARE PIN CONFIGURATION ***/
  4. #define SR4094_DATA_PORT PORTB
  5. #define SR4094_DATA_DDR DDRB
  6. #define SR4094_DATA_BIT 2
  7. #define SR4094_CLOCK_PORT PORTB
  8. #define SR4094_CLOCK_DDR DDRB
  9. #define SR4094_CLOCK_BIT 0
  10. #define SR4094_STROBE_PORT PORTB
  11. #define SR4094_STROBE_DDR DDRB
  12. #define SR4094_STROBE_BIT 1
  13. #define SR4094_OUTEN_PORT PORTB
  14. #define SR4094_OUTEN_DDR DDRB
  15. #define SR4094_OUTEN_BIT 3
  16. #include <stdint.h>
  17. /**
  18. * sr4094_init - Initialize the shiftregister chain
  19. * @nr_chips: Number of cascaded chips.
  20. */
  21. void sr4094_init(void *initial_data, uint8_t nr_chips);
  22. /**
  23. * sr4094_put_data - Put data on the output of the 4094 chip(s)
  24. *
  25. * @data: Byte array with output data. The size of the data array
  26. * in bytes must match "nr_chips".
  27. * @nr_chips: Number of cascaded chips.
  28. *
  29. * bit0 of the first byte will be the QP0 output of the first chip.
  30. * bit1 of the first byte will be the QP1 output of the first chip.
  31. * ...
  32. * bit0 of the second byte will be the QP0 output of the second chip.
  33. * ...
  34. * The "first" chip is directly connected to the microcontroller.
  35. * The "second" chip is cascaded to the "first" chip...
  36. */
  37. void sr4094_put_data(void *data, uint8_t nr_chips);
  38. /**
  39. * sr4094_outen - Set Output Enable
  40. *
  41. * @enable: If true, enable output.
  42. */
  43. void sr4094_outen(uint8_t enable);
  44. #endif /* SHREG_4094_H_ */