You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.3 KiB

  1. /* Copyright 2022
  2. *
  3. * This program is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #pragma once
  17. #include <stdint.h>
  18. #include <stdbool.h>
  19. /**
  20. * Driver for 74x154 4-to-16 decoder/demultiplexer with inverting outputs
  21. * https://assets.nexperia.com/documents/data-sheet/74HC_HCT154.pdf
  22. */
  23. /**
  24. * Initialize the address and output enable pins.
  25. */
  26. void sn74x154_init(void);
  27. /**
  28. * Set the enabled state.
  29. *
  30. * When enabled is true, pulls the E0 and E1 pins low.
  31. *
  32. * \param enabled The enable state to set.
  33. */
  34. void sn74x154_set_enabled(bool enabled);
  35. /**
  36. * Set the output pin address.
  37. *
  38. * The selected output pin will be pulled low, while the remaining output pins will be high.
  39. *
  40. * \param address The address to set, from 0 to 15.
  41. */
  42. void sn74x154_set_addr(uint8_t address);