From e822a74d2830716a7e22270d673c681ddaf8331f Mon Sep 17 00:00:00 2001 From: Marco van Wieringen Date: Tue, 1 Dec 2020 12:42:00 +0100 Subject: [PATCH] Add test version of setting pwm for POE hat. --- pyUtil/pimonLib/__init__.py | 52 +++++++++++++++++++++++++++++++++++-- pyUtil/pimon_getpwm.py | 12 +++++++++ pyUtil/pimon_setpwm.py | 12 +++++++++ 3 files changed, 74 insertions(+), 2 deletions(-) create mode 100755 pyUtil/pimon_getpwm.py create mode 100755 pyUtil/pimon_setpwm.py diff --git a/pyUtil/pimonLib/__init__.py b/pyUtil/pimonLib/__init__.py index ed1aa5a..4b61065 100644 --- a/pyUtil/pimonLib/__init__.py +++ b/pyUtil/pimonLib/__init__.py @@ -32,7 +32,7 @@ PIMON_DEVICE_PATH = '/dev/vmgfx33' ######################################################################### RPIQ_BUFFER_LEN = 32 - +RPIQ_POE_BUFFER_LEN = 40 RPIQ_PROCESS_REQ = 0 # @@ -65,6 +65,12 @@ RPIQ_MBOX_GET_TEMP_LEN = 0x8 RPIQ_MBOX_TAG_ARMMEM = 0x00010005 RPIQ_MBOX_ARMMEM_LEN = 0x8 +RPIQ_MBOX_TAG_GET_POE_HAT = 0x00030049 +RPIQ_MBOX_GET_POE_HAT_LEN = 0x3 + +RPIQ_MBOX_TAG_SET_POE_HAT = 0x00030050 +RPIQ_MBOX_SET_POE_HAT_LEN = 0x3 + ######################################################################### # PiMon -- # @@ -225,4 +231,46 @@ class PiMon: except Exception as e: print(e) return 0 - return out \ No newline at end of file + return out + + ######################################################################### + # getPoeHat -- + # + ######################################################################### + def getPoeHat(self, reg): + try: + ioctlData = bytearray(struct.pack('