Created
July 16, 2023 19:17
-
-
Save LeoDJ/09403d046f9fb2449d00ce3646f06eb2 to your computer and use it in GitHub Desktop.
Python script to control/open a Partner Tech SP-850 cash drawer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Control a Partner Tech SP-850 cash drawer | |
# Needs root | |
import portio | |
import time | |
# request permission to I/O port range | |
portio.ioperm(0x5a8, 4, 1) | |
# Has to be 32bit access, otherwise the EC won't respond | |
def open_drawer(): | |
portio.outl(0xFF, 0x5a8) # (val, port) | |
time.sleep(0.05) | |
portio.outl(0xFE, 0x5a8) # bit 0 -> 0 open drawer A, bit 1 -> B | |
time.sleep(0.05) | |
portio.outl(0xFF, 0x5a8) # reset to 1 according to manual | |
def is_drawer_open(): | |
return not (portio.inl(0x5a8) & 0x40) | |
if __name__ == "__main__": | |
open_drawer() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment