mmu2_power.cpp 800 B

12345678910111213141516171819202122232425262728293031323334
  1. #include "mmu2_power.h"
  2. #include "Configuration_prusa.h"
  3. #include "pins.h"
  4. #include "fastio.h"
  5. #include <util/delay.h>
  6. #include "mmu2.h"
  7. #include "eeprom.h"
  8. namespace MMU2 {
  9. // sadly, on MK3 we cannot do actual power cycle on HW...
  10. // so we just block the MMU via EEPROM var instead.
  11. void power_on()
  12. {
  13. eeprom_update_byte((uint8_t *)EEPROM_MMU_ENABLED, true);
  14. }
  15. void power_off()
  16. {
  17. eeprom_update_byte((uint8_t *)EEPROM_MMU_ENABLED, false);
  18. }
  19. void reset() {
  20. #ifdef MMU_HWRESET // HW - pulse reset pin
  21. WRITE(MMU_RST_PIN, 0);
  22. _delay_us(100);
  23. WRITE(MMU_RST_PIN, 1);
  24. #else
  25. mmu2.Reset(MMU2::Software); // @@TODO needs to be redesigned, this power implementation shall not know anything about the MMU itself
  26. #endif
  27. // otherwise HW reset is not available
  28. }
  29. } // namespace MMU2