HiPi
Perl Modules for Raspberry Pi
Version 0.92 - released 28 March 2024

HiPi

The HiPi module provides access to constants used throughout the HiPi distribution using the following import tags.

:rpi :raspberry constants for use with HiPi::GPIO and the GPIO pins generally.
:i2c constants for use with HiPi::Device::I2C and related interface modules.
:spi constants for use with HiPi::Device::SPI and related interface modules.
:mcp23017 constants for use with HiPi::Interface::MCP23017 and and HiPi::Interface::MCP23S17 port extender modules.
:mpl3115a2 constants for use with HiPi::Interface::MPL3115A2 for the Freescale MPL3115A2 pressure and temperature sensor.
:lcd constants for modules providing HD44780 LCD support
:hrf69 constants for use with HiPi::Interface::HopeRF69 for the Hope RF69 434Mhz radio modules
:mcp3adc constants for use with HiPi::Interface::MCP3ADC providing support for the MCP 3004, 3008, 3204 and 3208 SPI analog to digital converters.
:mcp4dac constants for use with HiPi::Interface::MCP4DAC providing support for the MCP 48xx series and 49xx series SPI digital to analog converters.
:openthings constants for use with HiPi::RF::OpenThings::Message using the Sentec OpenThings RF message protocol.
:energenie constants for use with Energenie Modules controlling Energenie switches and sensors.
:pca9685 constants for use with HiPi::Interface::PCA9685 and PWM.
:oled constants for use with HiPi::Interface::MonoOLED
:ms5611 constants for use with HiPi::Interface::MS5611
:tmp102 constants for use with HiPi::Interface::TMP102
:epaper constants for use with HiPi::Interface::EPaper
:fl3730 constants for use with HiPi::Interface::IS31FL3730
:max7219 constants for use with HiPi::Interface::MAX7219
:hilink constants for use with Huawei HiLink Modules

:rpi :raspberry

use HiPi qw( :rpi );
use HiPi qw( :raspberry )

The :rpi or :raspberry tags import useful GPIO constants.

All methods and functions in the HiPi library take
BCM ( GPIO ) pin numbers. The RPI constants allow you to use the pin number from the Raspberry Pi header to refer to the necessary BCM pin number. For example, to refer to GPIO 22 you may use the constant RPI_PIN_15. You may, of course, always use the number 22 directly.
RPI_PIN_3
RPI_PIN_5
RPI_PIN_7
RPI_PIN_8
RPI_PIN_10
RPI_PIN_11
RPI_PIN_12
RPI_PIN_13
RPI_PIN_15
RPI_PIN_16
RPI_PIN_18
RPI_PIN_19
RPI_PIN_21
RPI_PIN_22
RPI_PIN_23
RPI_PIN_24
RPI_PIN_26
RPI_PIN_27
RPI_PIN_28
RPI_PIN_29
RPI_PIN_31
RPI_PIN_32
RPI_PIN_33
RPI_PIN_35
RPI_PIN_36
RPI_PIN_37
RPI_PIN_38
RPI_PIN_40
Mode constants for use with the HiPi::GPIO methods for setting GPIO function.
RPI_OUTPUT
RPI_INPUT

RPI_MODE_INPUT
RPI_MODE_OUTPUT
RPI_MODE_ALT0
RPI_MODE_ALT1
RPI_MODE_ALT2
RPI_MODE_ALT3
RPI_MODE_ALT4
RPI_MODE_ALT5
Interrupt constants for use with the HiPi::GPIO methods for setting interrupt functions.
RPI_INT_NONE       
RPI_INT_FALL           
RPI_INT_RISE        
RPI_INT_BOTH    
RPI_INT_AFALL    
RPI_INT_ARISE    
RPI_INT_HIGH    
RPI_INT_LOW
Utility constants for setting and checking pin values.
RPI_HIGH
RPI_LOW
Pull up / Pull Down constants.
RPI_PUD_OFF
RPI_PUD_DOWN
RPI_PUD_UP
RPI_PUD_UNSET

:i2c

use HiPi qw( :i2c );
I2C_READMODE_SYSTEM
I2C_READMODE_REPEATED_START
I2C_READMODE_START_STOP

I2C_SCANMODE_AUTO
I2C_SCANMODE_QUICK
I2C_SCANMODE_READ

I2C_RETRIES
I2C_TIMEOUT
I2C_SLAVE
I2C_TENBIT
I2C_FUNCS
I2C_SLAVE_FORCE
I2C_RDWR
I2C_PEC
I2C_SMBUS

I2C_M_TEN
I2C_M_RD
I2C_M_NOSTART
I2C_M_REV_DIR_ADDR
I2C_M_IGNORE_NAK
I2C_M_NO_RD_ACK
I2C_M_RECV_LEN

I2C0_SDA
I2C0_SCL
I2C1_SDA
I2C1_SCL
I2C_SDA
I2C_SCL
ID_SD
ID_SC

:spi

use HiPi qw( :spi );
SPI_CPHA
SPI_CPOL
SPI_MODE_0
SPI_MODE_1
SPI_MODE_2
SPI_MODE_3
SPI_CS_HIGH
SPI_LSB_FIRST
SPI_3WIRE
SPI_LOOP
SPI_NO_CS
SPI_READY
SPI_SPEED_KHZ_500
SPI_SPEED_MHZ_1
SPI_SPEED_MHZ_2
SPI_SPEED_MHZ_4
SPI_SPEED_MHZ_8
SPI_SPEED_MHZ_16
SPI_SPEED_MHZ_32

:mcp23017 :mcp23S17

use HiPi qw( :mcp23017 );
use HiPi qw( :mcp23S17 );
use HiPi qw( :mcp23x17 );
MCP23S17_A0
MCP23S17_A1
MCP23S17_A2
MCP23S17_A3
MCP23S17_A4
MCP23S17_A5
MCP23S17_A6
MCP23S17_A7
MCP23S17_B0
MCP23S17_B1
MCP23S17_B2
MCP23S17_B3
MCP23S17_B4
MCP23S17_B5
MCP23S17_B6
MCP23S17_B7

MCP23S17_BANK
MCP23S17_MIRROR
MCP23S17_SEQOP
MCP23S17_DISSLW
MCP23S17_HAEN
MCP23S17_ODR
MCP23S17_INTPOL

MCP23S17_INPUT
MCP23S17_OUTPUT

MCP23S17_HIGH
MCP23S17_LOW

MCP23017_A0
MCP23017_A1
MCP23017_A2
MCP23017_A3
MCP23017_A4
MCP23017_A5
MCP23017_A6
MCP23017_A7
MCP23017_B0
MCP23017_B1
MCP23017_B2
MCP23017_B3
MCP23017_B4
MCP23017_B5
MCP23017_B6
MCP23017_B7

MCP23017_BANK
MCP23017_MIRROR
MCP23017_SEQOP
MCP23017_DISSLW
MCP23017_HAEN
MCP23017_ODR
MCP23017_INTPOL

MCP23017_INPUT
MCP23017_OUTPUT

MCP23017_HIGH
MCP23017_LOW
    
MCP_PIN_A0
MCP_PIN_A1
MCP_PIN_A2
MCP_PIN_A3
MCP_PIN_A4
MCP_PIN_A5
MCP_PIN_A6
MCP_PIN_A7
MCP_PIN_B0
MCP_PIN_B1
MCP_PIN_B2
MCP_PIN_B3
MCP_PIN_B4
MCP_PIN_B5
MCP_PIN_B6
MCP_PIN_B7

:mpl3115a2

use HiPi qw( :mpl3115a2);
MPL_REG_STATUS
MPL_REG_OUT_P_MSB
MPL_REG_OUT_P_CSB
MPL_REG_OUT_P_LSB
MPL_REG_OUT_T_MSB
MPL_REG_OUT_T_LSB
MPL_REG_DR_STATUS
MPL_REG_OUT_P_DELTA_MSB
MPL_REG_OUT_P_DELTA_CSB
MPL_REG_OUT_P_DELTA_LSB
MPL_REG_OUT_T_DELTA_MSB
MPL_REG_OUT_T_DELTA_LSB
MPL_REG_WHO_AM_I
MPL_REG_F_STATUS
MPL_REG_F_DATA
MPL_REG_F_SETUP
MPL_REG_TIME_DLY
MPL_REG_SYSMOD
MPL_REG_INT_SOURCE
MPL_REG_PT_DATA_CFG
MPL_REG_BAR_IN_MSB
MPL_REG_MAR_IN_LSB
MPL_REG_P_TGT_MSB
MPL_REG_P_TGT_LSB
MPL_REG_T_TGT
MPL_REG_P_WND_MSB
MPL_REG_P_WND_LSB
MPL_REG_T_WND
MPL_REG_P_MIN_MSB
MPL_REG_P_MIN_CSB
MPL_REG_P_MIN_LSB
MPL_REG_T_MIN_MSB
MPL_REG_T_MIN_LSB
MPL_REG_P_MAX_MSB
MPL_REG_P_MAX_CSB
MPL_REG_P_MAX_LSB
MPL_REG_T_MAX_MSB
MPL_REG_T_MAX_LSB
MPL_REG_CTRL_REG1
MPL_REG_CTRL_REG2
MPL_REG_CTRL_REG3
MPL_REG_CTRL_REG4
MPL_REG_CTRL_REG5
MPL_REG_OFF_P
MPL_REG_OFF_T
MPL_REG_OFF_H

MPL_CTRL_REG1_SBYB
MPL_CTRL_REG1_OST
MPL_CTRL_REG1_RST
MPL_CTRL_REG1_OS0
MPL_CTRL_REG1_OS1
MPL_CTRL_REG1_OS2
MPL_CTRL_REG1_RAW
MPL_CTRL_REG1_ALT

MPL_CTRL_REG1_MASK

MPL_CTRL_REG2_ST0
MPL_CTRL_REG2_ST1
MPL_CTRL_REG2_ST2
MPL_CTRL_REG2_ST3
MPL_CTRL_REG2_ALARM_SEL
MPL_CTRL_REG2_LOAD_OUTPUT

MPL_CTRL_REG2_MASK

MPL_CTRL_REG3_PP_0D2
MPL_CTRL_REG3_IPOL2
MPL_CTRL_REG3_PP_OD1
MPL_CTRL_REG3_IPOL1

MPL_CTRL_REG3_MASK

MPL_CTRL_REG4_INT_EN_DRDY
MPL_CTRL_REG4_INT_EN_FIFO
MPL_CTRL_REG4_INT_EN_PW
MPL_CTRL_REG4_INT_EN_TW
MPL_CTRL_REG4_INT_EN_PTH
MPL_CTRL_REG4_INT_EN_TTH
MPL_CTRL_REG4_INT_EN_PCHG
MPL_CTRL_REG4_INT_EN_TCHG

MPL_CTRL_REG4_MASK

MPL_INTREGS_DRDY
MPL_INTREGS_FIFO
MPL_INTREGS_PW
MPL_INTREGS_TW
MPL_INTREGS_PTH
MPL_INTREGS_TTH
MPL_INTREGS_PCHG
MPL_INTREGS_TCHG

MPL_INTREGS_MASK

MPL_DR_STATUS_PTOW
MPL_DR_STATUS_POW
MPL_DR_STATUS_TOW
MPL_DR_STATUS_PTDR
MPL_DR_STATUS_PDR
MPL_DR_STATUS_TDR

MPL_DR_STATUS_MASK

MPL_F_STATUS_F_OVF
MPL_F_STATUS_F_WMRK_FLAG
MPL_F_STATUS_F_CNT5
MPL_F_STATUS_F_CNT4
MPL_F_STATUS_F_CNT3
MPL_F_STATUS_F_CNT2
MPL_F_STATUS_F_CNT1
MPL_F_STATUS_F_CNT0

MPL_F_STATUS_MASK

MPL_PT_DATA_CFG_DREM
MPL_PT_DATA_CFG_PDEFE
MPL_PT_DATA_CFG_TDEFE

MPL_PT_DATA_CFG_MASK

MPL_BIT_SBYB
MPL_BIT_OST
MPL_BIT_RST
MPL_BIT_OS0
MPL_BIT_OS1
MPL_BIT_OS2
MPL_BIT_RAW
MPL_BIT_ALT

MPL_BIT_ST0
MPL_BIT_ST1
MPL_BIT_ST2
MPL_BIT_ST3
MPL_BIT_ALARM_SEL
MPL_BIT_LOAD_OUTPUT

MPL_BIT_PP_0D2
MPL_BIT_IPOL2
MPL_BIT_PP_OD1
MPL_BIT_IPOL1

# interrupt bits for CTRL_REG5,

MPL_BIT_DRDY
MPL_BIT_FIFO
MPL_BIT_PW
MPL_BIT_TW
MPL_BIT_PTH
MPL_BIT_TTH
MPL_BIT_PCHG
MPL_BIT_TCHG

MPL_BIT_PTOW
MPL_BIT_POW
MPL_BIT_TOW
MPL_BIT_PTDR
MPL_BIT_PDR
MPL_BIT_TDR

MPL_BIT_F_OVF
MPL_BIT_F_WMRK_FLAG
MPL_BIT_F_CNT5
MPL_BIT_F_CNT4
MPL_BIT_F_CNT3
MPL_BIT_F_CNT2
MPL_BIT_F_CNT1
MPL_BIT_F_CNT0

MPL_BIT_DREM
MPL_BIT_PDEFE
MPL_BIT_TDEFE
                              
MPL_FUNC_ALTITUDE
MPL_FUNC_PRESSURE
MPL3115A2_ID

MPL_CONTROL_MASK
MPL_BYTE_MASK
MPL_WORD_MASK

MPL_OVERSAMPLE_1 
MPL_OVERSAMPLE_2  
MPL_OVERSAMPLE_4 
MPL_OVERSAMPLE_8  
MPL_OVERSAMPLE_16 
MPL_OVERSAMPLE_32 
MPL_OVERSAMPLE_64 
MPL_OVERSAMPLE_128 

MPL_OVERSAMPLE_MASK

:lcd

use HiPi qw( :lcd );
HD44780_CLEAR_DISPLAY
HD44780_HOME_UNSHIFT
HD44780_CURSOR_MODE_LEFT
HD44780_CURSOR_MODE_LEFT_SHIFT
HD44780_CURSOR_MODE_RIGHT
HD44780_CURSOR_MODE_RIGHT_SHIFT
HD44780_DISPLAY_OFF

HD44780_DISPLAY_ON
HD44780_CURSOR_OFF
HD44780_CURSOR_UNDERLINE
HD44780_CURSOR_BLINK

HD44780_SHIFT_CURSOR_LEFT
HD44780_SHIFT_CURSOR_RIGHT
HD44780_SHIFT_DISPLAY_LEFT
HD44780_SHIFT_DISPLAY_RIGHT

HD44780_CURSOR_POSITION

SRX_CURSOR_OFF
SRX_CURSOR_BLINK
SRX_CURSOR_UNDERLINE

HTV2_END_SERIALRX_COMMAND    => chr(0xFF),

HTV2_BAUD_2400
HTV2_BAUD_4800
HTV2_BAUD_9600
HTV2_BAUD_14400
HTV2_BAUD_19200
HTV2_BAUD_28800
HTV2_BAUD_57600
HTV2_BAUD_115200

HTV2_CMD_PRINT
HTV2_CMD_SET_CURSOR_POS
HTV2_CMD_CLEAR_LINE
HTV2_CMD_CLEAR_DISPLAY
HTV2_CMD_LCD_TYPE
HTV2_CMD_HD44780_CMD
HTV2_CMD_BACKLIGHT
HTV2_CMD_WRITE_CHAR
HTV2_CMD_I2C_ADDRESS
HTV2_CMD_BAUD_RATE
HTV2_CMD_CUSTOM_CHAR

SLCD_START_COMMAND    => chr(0xFE)
SLCD_SPECIAL_COMMAND  => chr(0x7C)

:hrf69

use HiPi qw( :hrf69 );
RF69_REG_FIFO
RF69_REG_OPMODE
RF69_REG_REGDATAMODUL
RF69_REG_BITRATEMSB
RF69_REG_BITRATELSB
RF69_REG_FDEVMSB
RF69_REG_FDEVLSB
RF69_REG_FRMSB
RF69_REG_FRMID
RF69_REG_FRLSB
RF69_REG_CALLIB
RF69_REG_AFCCTRL
RF69_REG_LISTEN1
RF69_REG_LISTEN2
RF69_REG_LISTEN3
RF69_REG_VERSION
RF69_REG_PALEVEL
RF69_REG_PARAMP
RF69_REG_OCP
RF69_REG_LNA
RF69_REG_RXBW
RF69_REG_AFCBW
RF69_REG_OOKPEAK
RF69_REG_OOKAVG
RF69_REG_OOKFIX
RF69_REG_AFCFEI
RF69_REG_AFCMSB
RF69_REG_AFCLSB
RF69_REG_FEIMSB
RF69_REG_FEILSB
RF69_REG_RSSICONFIG
RF69_REG_RSSIVALUE
RF69_REG_DIOMAPPING1
RF69_REG_DIOMAPPING2
RF69_REG_IRQFLAGS1
RF69_REG_IRQFLAGS2
RF69_REG_RSSITHRESH
RF69_REG_RXTIMEOUT1
RF69_REG_RXTIMEOUT2
RF69_REG_PREAMBLEMSB
RF69_REG_PREAMBLELSB
RF69_REG_SYNCCONFIG
RF69_REG_SYNCVALUE1
RF69_REG_SYNCVALUE2
RF69_REG_SYNCVALUE3
RF69_REG_SYNCVALUE4
RF69_REG_SYNCVALUE5
RF69_REG_SYNCVALUE6
RF69_REG_SYNCVALUE7
RF69_REG_SYNCVALUE8
RF69_REG_PACKETCONFIG1
RF69_REG_PAYLOADLEN
RF69_REG_NODEADDRESS
RF69_REG_BROADCASTADDRESS
RF69_REG_AUTOMODES
RF69_REG_FIFOTHRESH
RF69_REG_PACKETCONFIG2
RF69_REG_AESKEY1
RF69_REG_AESKEY2
RF69_REG_AESKEY3
RF69_REG_AESKEY4
RF69_REG_AESKEY5
RF69_REG_AESKEY6
RF69_REG_AESKEY7
RF69_REG_AESKEY8
RF69_REG_AESKEY9
RF69_REG_AESKEY10
RF69_REG_AESKEY11
RF69_REG_AESKEY12
RF69_REG_AESKEY13
RF69_REG_AESKEY14
RF69_REG_AESKEY15
RF69_REG_AESKEY16
RF69_REG_TEMP1
RF69_REG_TEMP2

RF69_REG_TESTLNA
RF69_REG_TESTPA1
RF69_REG_TESTPA2
RF69_REG_TESTDAGC

RF69_REG_TESTAFC

RF69_MASK_REG_WRITE

RF69_TRUE
RF69_FALSE

RF69_MASK_OPMODE_SEQOFF
RF69_MASK_OPMODE_LISTENON
RF69_MASK_OPMODE_LISTENABORT
RF69_MASK_OPMODE_RX
RF69_MASK_OPMODE_TX
RF69_MASK_OPMODE_FS
RF69_MASK_OPMODE_SB

RF69_MASK_MODEREADY
RF69_MASK_FIFONOTEMPTY

RF69_MASK_FIFOLEVEL
RF69_MASK_FIFOOVERRUN
RF69_MASK_PACKETSENT
RF69_MASK_TXREADY
RF69_MASK_PACKETMODE
RF69_MASK_MODULATION
RF69_MASK_PAYLOADRDY
RF69_MASK_REGDATAMODUL_FSK  # Modulation scheme FSK
RF69_MASK_REGDATAMODUL_OOK  # Modulation scheme OOK

RF69_VAL_AFCCTRLS  # standard AFC routine
RF69_VAL_AFCCTRLI  # improved AFC routine
RF69_VAL_LNA50  # LNA input impedance 50 ohms
RF69_VAL_LNA50G  # LNA input impedance 50 ohms, LNA gain -> 48db
RF69_VAL_LNA200  # LNA input impedance 200 ohms
RF69_VAL_RXBW60  # channel filter bandwidth 10kHz -> 60kHz  page:26
RF69_VAL_RXBW120  # channel filter bandwidth 120kHz
RF69_VAL_AFCFEIRX  # AFC is performed each time RX mode is entered
RF69_VAL_RSSITHRESH220  # RSSI threshold => 0xE4 -> => 0xDC (220)
RF69_VAL_PREAMBLELSB3  # preamble size LSB 3
RF69_VAL_PREAMBLELSB5  # preamble size LSB 5

:mcp3adc

use HiPi qw( :mcp3adc );
MCP3004 # 4 channels, 10 bit
MCP3008 # 8 channels, 10 bit
MCP3204 # 4 channels, 12 bit
MCP3208 # 8 channels, 12 bit

MCP3ADC_CHAN_0    => 0b00001000,  # single-ended CH0
MCP3ADC_CHAN_1    => 0b00001001,  # single-ended CH1
MCP3ADC_CHAN_2    => 0b00001010,  # single-ended CH2
MCP3ADC_CHAN_3    => 0b00001011,  # single-ended CH3
MCP3ADC_CHAN_4    => 0b00001100,  # single-ended CH4
MCP3ADC_CHAN_5    => 0b00001101,  # single-ended CH5
MCP3ADC_CHAN_6    => 0b00001110,  # single-ended CH6
MCP3ADC_CHAN_7    => 0b00001111,  # single-ended CH7
MCP3ADC_DIFF_0_1  => 0b00000000,  # differential +CH0 -CH1
MCP3ADC_DIFF_1_0  => 0b00000001,  # differential -CH0 +CH1
MCP3ADC_DIFF_2_3  => 0b00000010,  # differential +CH2 -CH3
MCP3ADC_DIFF_3_2  => 0b00000011,  # differential -CH2 +CH3
MCP3ADC_DIFF_4_5  => 0b00000100,  # differential +CH4 -CH5
MCP3ADC_DIFF_5_4  => 0b00000101,  # differential -CH4 +CH5
MCP3ADC_DIFF_6_7  => 0b00000110,  # differential +CH6 -CH7
MCP3ADC_DIFF_7_6  => 0b00000111,  # differential -CH6 +CH7

MCP3008_S0        => 0b00001000,  # single-ended CH0
MCP3008_S1        => 0b00001001,  # single-ended CH1
MCP3008_S2        => 0b00001010,  # single-ended CH2
MCP3008_S3        => 0b00001011,  # single-ended CH3
MCP3008_S4        => 0b00001100,  # single-ended CH4
MCP3008_S5        => 0b00001101,  # single-ended CH5
MCP3008_S6        => 0b00001110,  # single-ended CH6
MCP3008_S7        => 0b00001111,  # single-ended CH7
MCP3008_DIFF_0_1  => 0b00000000,  # differential +CH0 -CH1
MCP3008_DIFF_1_0  => 0b00000001,  # differential -CH0 +CH1
MCP3008_DIFF_2_3  => 0b00000010,  # differential +CH2 -CH3
MCP3008_DIFF_3_2  => 0b00000011,  # differential -CH2 +CH3
MCP3008_DIFF_4_5  => 0b00000100,  # differential +CH4 -CH5
MCP3008_DIFF_5_4  => 0b00000101,  # differential -CH4 +CH5
MCP3008_DIFF_6_7  => 0b00000110,  # differential +CH6 -CH7
MCP3008_DIFF_7_6  => 0b00000110,  # differential -CH6 +CH7

MCP3208_S0        => 0b00001000,  # single-ended CH0
MCP3208_S1        => 0b00001001,  # single-ended CH1
MCP3208_S2        => 0b00001010,  # single-ended CH2
MCP3208_S3        => 0b00001011,  # single-ended CH3
MCP3208_S4        => 0b00001100,  # single-ended CH4
MCP3208_S5        => 0b00001101,  # single-ended CH5
MCP3208_S6        => 0b00001110,  # single-ended CH6
MCP3208_S7        => 0b00001111,  # single-ended CH7
MCP3208_DIFF_0_1  => 0b00000000,  # differential +CH0 -CH1
MCP3208_DIFF_1_0  => 0b00000001,  # differential -CH0 +CH1
MCP3208_DIFF_2_3  => 0b00000010,  # differential +CH2 -CH3
MCP3208_DIFF_3_2  => 0b00000011,  # differential -CH2 +CH3
MCP3208_DIFF_4_5  => 0b00000100,  # differential +CH4 -CH5
MCP3208_DIFF_5_4  => 0b00000101,  # differential -CH4 +CH5
MCP3208_DIFF_6_7  => 0b00000110,  # differential +CH6 -CH7
MCP3208_DIFF_7_6  => 0b00000110,  # differential -CH6 +CH7

MCP3004_S0        => 0b00001000,  # single-ended CH0
MCP3004_S1        => 0b00001001,  # single-ended CH1
MCP3004_S2        => 0b00001010,  # single-ended CH2
MCP3004_S3        => 0b00001011,  # single-ended CH3
MCP3004_DIFF_0_1  => 0b00000000,  # differential +CH0 -CH1
MCP3004_DIFF_1_0  => 0b00000001,  # differential -CH0 +CH1
MCP3004_DIFF_2_3  => 0b00000010,  # differential +CH2 -CH3
MCP3004_DIFF_3_2  => 0b00000011,  # differential -CH2 +CH3

MCP3204_S0        => 0b00001000,  # single-ended CH0
MCP3204_S1        => 0b00001001,  # single-ended CH1
MCP3204_S2        => 0b00001010,  # single-ended CH2
MCP3204_S3        => 0b00001011,  # single-ended CH3
MCP3204_DIFF_0_1  => 0b00000000,  # differential +CH0 -CH1
MCP3204_DIFF_1_0  => 0b00000001,  # differential -CH0 +CH1
MCP3204_DIFF_2_3  => 0b00000010,  # differential +CH2 -CH3
MCP3204_DIFF_3_2  => 0b00000011,  # differential -CH2 +CH3

:mcp4dac

use HiPi qw( :mcp4dac );
MCP_DAC_CHANNEL_A
MCP_DAC_CHANNEL_B
MCP_DAC_BUFFER
MCP_DAC_GAIN
MCP_DAC_NO_GAIN
MCP_DAC_LIVE
MCP_DAC_SHUTDOWN
        
MCP4801 
MCP4811 
MCP4821 
MCP4802 
MCP4812 
MCP4822
MCP4901 
MCP4911 
MCP4921 
MCP4902 
MCP4912 
MCP4922

:openthings

use HiPi qw( :openthings );
OPENTHINGS_MANUFACTURER_ENERGENIE
OPENTHINGS_MANUFACTURER_SENTEC
OPENTHINGS_MANUFACTURER_HILDERBRAND
OPENTHINGS_MANUFACTURER_RASPBERRY

OPENTHINGS_PARAM_ALARM
OPENTHINGS_PARAM_DEBUG_OUTPUT
OPENTHINGS_PARAM_IDENTIFY
OPENTHINGS_PARAM_SOURCE_SELECTOR
OPENTHINGS_PARAM_WATER_DETECTOR
OPENTHINGS_PARAM_GLASS_BREAKAGE
OPENTHINGS_PARAM_CLOSURES
OPENTHINGS_PARAM_DOOR_BELL
OPENTHINGS_PARAM_ENERGY
OPENTHINGS_PARAM_FALL_SENSOR
OPENTHINGS_PARAM_GAS_VOLUME
OPENTHINGS_PARAM_AIR_PRESSURE
OPENTHINGS_PARAM_ILLUMINANCE
OPENTHINGS_PARAM_LEVEL
OPENTHINGS_PARAM_RAINFALL
OPENTHINGS_PARAM_APPARENT_POWER
OPENTHINGS_PARAM_POWER_FACTOR
OPENTHINGS_PARAM_REPORT_PERIOD
OPENTHINGS_PARAM_SMOKE_DETECTOR
OPENTHINGS_PARAM_TIME_AND_DATE
OPENTHINGS_PARAM_VIBRATION
OPENTHINGS_PARAM_WATER_VOLUME
OPENTHINGS_PARAM_WIND_SPEED
OPENTHINGS_PARAM_GAS_PRESSURE
OPENTHINGS_PARAM_BATTERY_LEVEL
OPENTHINGS_PARAM_CO_DETECTOR
OPENTHINGS_PARAM_DOOR_SENSOR
OPENTHINGS_PARAM_EMERGENCY
OPENTHINGS_PARAM_FREQUENCY
OPENTHINGS_PARAM_GAS_FLOW_RATE
OPENTHINGS_PARAM_RELATIVE_HUMIDITY =>0x68,
OPENTHINGS_PARAM_CURRENT
OPENTHINGS_PARAM_JOIN
OPENTHINGS_PARAM_LIGHT_LEVEL
OPENTHINGS_PARAM_MOTION_DETECTOR
OPENTHINGS_PARAM_OCCUPANCY
OPENTHINGS_PARAM_REAL_POWER
OPENTHINGS_PARAM_REACTIVE_POWER
OPENTHINGS_PARAM_ROTATION_SPEED
OPENTHINGS_PARAM_SWITCH_STATE
OPENTHINGS_PARAM_TEMPERATURE
OPENTHINGS_PARAM_VOLTAGE
OPENTHINGS_PARAM_WATER_FLOW_RATE
OPENTHINGS_PARAM_WATER_PRESSURE
OPENTHINGS_PARAM_PHASE_1_POWER
OPENTHINGS_PARAM_PHASE_2_POWER
OPENTHINGS_PARAM_PHASE_3_POWER
OPENTHINGS_PARAM_3_PHASE_TOTAL
OPENTHINGS_PARAM_TEST

OPENTHINGS_WRITE_MASK

OPENTHINGS_UINT
OPENTHINGS_UINT_BP4
OPENTHINGS_UINT_BP8
OPENTHINGS_UINT_BP12
OPENTHINGS_UINT_BP16
OPENTHINGS_UINT_BP20
OPENTHINGS_UINT_BP24
OPENTHINGS_CHAR
OPENTHINGS_SINT
OPENTHINGS_SINT_BP8
OPENTHINGS_SINT_BP16
OPENTHINGS_SINT_BP24
OPENTHINGS_ENUMERATION
OPENTHINGS_FLOAT

:energenie

use HiPi qw( :energenie );
ENERGENIE_ENER314_DUMMY_GROUP
        
ENERGENIE_MANUFACTURER_ID

ENERGENIE_PRODUCT_ID_MIHO004
ENERGENIE_PRODUCT_ID_MIHO005
ENERGENIE_PRODUCT_ID_MIHO013
ENERGENIE_PRODUCT_ID_MIHO006

ENERGENIE_PRODUCT_ID_MIHO032
ENERGENIE_PRODUCT_ID_MIHO033

ENERGENIE_DEFAULT_CRYPTSEED
ENERGENIE_DEFAULT_CRYPTPIP

ENERGENIE_FIFOTHRESH_FSK # Condition to start packet transmission: at least one byte in FIFO
ENERGENIE_FIFOTHRESH_OOK # Condition to start packet transmission: wait for 30 bytes in FIFO
ENERGENIE_TXOOK_REPEAT_RATE
ENERGENIE_MESSAGE_BUF_SIZE
ENERGENIE_MAX_FIFO_SIZE
ENERGENIE_NODEADDRESS01  # Node address used in address filtering
ENERGENIE_NODEADDRESS04  # Node address used in address filtering
ENERGENIE_FDEVMSB_FSK  # frequency deviation 5kHz => 0x0052 -> 30kHz => 0x01EC
ENERGENIE_FDEVLSB_FSK  # frequency deviation 5kHz => 0x0052 -> 30kHz => 0x01EC
ENERGENIE_FDEVMSB_OOK
ENERGENIE_FDEVLSB_OOK
ENERGENIE_FRMSB_434  # carrier freq -> 434.3MHz => 0x6C9333
ENERGENIE_FRMID_434  # carrier freq -> 434.3MHz => 0x6C9333
ENERGENIE_FRLSB_434  # carrier freq -> 434.3MHz => 0x6C9333
ENERGENIE_FRMSB_433  # carrier freq -> 433.92MHz => 0x6C7AE1
ENERGENIE_FRMID_433  # carrier freq -> 433.92MHz => 0x6C7AE1
ENERGENIE_FRLSB_433  # carrier freq -> 433.92MHz => 0x6C7AE1
ENERGENIE_SYNCVALUE1_FSK  # 1st byte of Sync word
ENERGENIE_SYNCVALUE2_FSK  # 2nd byte of Sync word
ENERGENIE_SYNCVALUE1_OOK  # 1nd byte of Sync word

ENERGENIE_SYNC_SIZE_2  # Size of the Synch word = 2 (SyncSize + 1)
ENERGENIE_SYNC_SIZE_4  # Size of the Synch word = 4 (SyncSize + 1)

ENERGENIE_PACKETCONFIG1_FSK  # Variable length, Manchester coding, Addr must match NodeAddress
ENERGENIE_PACKETCONFIG1_FSK_NOADDR  # Variable length, Manchester coding
ENERGENIE_PACKETCONFIG1_OOK  # Fixed length, no Manchester coding
ENERGENIE_NODEADDRESS  # Node address used in address filtering ( when enabled )

ENERGENIE_PAYLOADLEN_OOK  # fixed OOK Payload Length

:pca9685

use HiPi qw( :pca9685 );
PCA_9685_SERVOTYPE_DEFAULT
PCA_9685_SERVOTYPE_EXT_1
PCA_9685_SERVOTYPE_EXT_2
PCA_9685_SERVOTYPE_SG90

PCA_9685_SERVO_CHANNEL_MASK
PCA_9685_FULL_MASK

PCA_9685_SERVO_DIRECTION_CW
PCA_9685_SERVO_DIRECTION_AC

:oled

use HiPi qw( :oled );
SSD1306_128_X_64_I2C
SSD1306_128_X_32_I2C

SH1106_128_X_64_I2C
SH1106_128_X_32_I2C

SSD1306_128_X_64_SPI
SSD1306_128_X_32_SPI

SH1106_128_X_64_SPI
SH1106_128_X_32_SPI

:ms5611

use HiPi qw( :ms5611 );
MS5611_OSR_256
MS5611_OSR_512
MS5611_OSR_1024
MS5611_OSR_2048
MS5611_OSR_4096

:tmp102

use HiPi qw( :tmp102 );
TMP102_CR_0_25HZ
TMP102_CR_1HZ
TMP102_CR_4HZ
TMP102_CR_8HZ

TMP102_FAULTS_1
TMP102_FAULTS_2
TMP102_FAULTS_4
TMP102_FAULTS_6

:epaper

use HiPi qw( :epaper );
EPD_WS_1_54_200_X_200_A
EPD_WS_1_54_200_X_200_B
EPD_WS_1_54_152_X_152_C
EPD_WS_2_13_250_X_122_A
EPD_WS_2_13_212_X_104_B
EPD_WS_2_90_296_X_128_A
EPD_WS_2_90_296_X_128_B
EPD_PIMORONI_INKY_PHAT_V2

EPD_ROTATION_0
EPD_ROTATION_90
EPD_ROTATION_180
EPD_ROTATION_270

EPD_BLACK_PEN
EPD_COLOUR_PEN
EPD_COLOR_PEN
EPD_RED_PEN
EPD_YELLOW_PEN

EPD_UPD_MODE_FIXED
EPD_UPD_MODE_FULL
EPD_UPD_MODE_PARTIAL

:fl3730

use HiPi qw( :fl3730 );
# CONGIGURATION REGISTER 0x00    
FL3730_SSD_NORMAL
FL3730_SSD_SHUTDOWN

FL3730_DM_MATRIX_1
FL3730_DM_MATRIX_2
FL3730_DM_MATRIX_BOTH

FL3730_AEN_OFF
FL3730_AEN_ON

FL3730_ADM_8X8
FL3730_ADM_7X9
FL3730_ADM_6X10
FL3730_ADM_5X11

# LIGHTING EFFECT REGISTER 0x0D
FL3730_AGS_0_DB
FL3730_AGS_3_DB
FL3730_AGS_6_DB
FL3730_AGS_9_DB
FL3730_AGS_12_DB
FL3730_AGS_15_DB
FL3730_AGS_18_DB
FL3730_AGS_M6_DB 

FL3730_CS_05_MA
FL3730_CS_10_MA
FL3730_CS_15_MA
FL3730_CS_20_MA
FL3730_CS_25_MA
FL3730_CS_30_MA
FL3730_CS_35_MA
FL3730_CS_40_MA
FL3730_CS_45_MA
FL3730_CS_50_MA
FL3730_CS_55_MA
FL3730_CS_60_MA
FL3730_CS_65_MA
FL3730_CS_70_MA
FL3730_CS_75_MA

:max7219

use HiPi qw( :max7219 );
MAX7219_FLAG_FLIPPED
MAX7219_FLAG_MIRROR
MAX7219_FLAG_DECIMAL
MAX7219_REG_NOOP
MAX7219_REG_DIGIT_0
MAX7219_REG_DIGIT_1
MAX7219_REG_DIGIT_2
MAX7219_REG_DIGIT_3
MAX7219_REG_DIGIT_4
MAX7219_REG_DIGIT_5
MAX7219_REG_DIGIT_6
MAX7219_REG_DIGIT_7
MAX7219_REG_DECODE_MODE
MAX7219_REG_INTENSITY
MAX7219_REG_SCAN_LIMIT
MAX7219_REG_SHUTDOWN
MAX7219_REG_TEST

:hilink

use HiPi qw( :hilink );
HILINK_CONNSTATUS_CONNECTING
HILINK_CONNSTATUS_CONNECTED
HILINK_CONNSTATUS_DISCONNECTED
HILINK_CONNSTATUS_DISCONNECTING