I2C Rotary Encoder Library

De library heeft de volgende methoden:

De library heeft de volgende setters:

SetterReturnsParmsDescription
setRotVal()boolint16_tset the value of the Rotary Encoder (-5000 .. + 5000)
setRotStep()boolint16_tset the rotary Step (1 .. 50)
setRotMin()boolint16_tset the Minimum rotary value (-5000 .. +5000)
setRotMax()boolint16_tset the Maximum rotary value (-5000 .. +5000)
setRotSpinTime()booluint8_tset the Rotary Spin thime value (2 .. 100 milli seconds)
setRGBcolor()booluint8_t, uint8_t, uint8_tset the color of all 3 leds Red, Green, Blue (0 .. 255, 0 .. 255, 0 .. 255)
setRGBcolor()booluint32_tset the RGB color of all 3 leds (0x000000 .. 0xFFFFFF)
setLedRed()booluint8_tset the PWM value of the Red led (0 .. 255)
setLedGreen()booluint8_tset the PWM value of the Green led (0 .. 255)
setLedBlue()booluint8_tset the PWM value of the Blue led (0 .. 255)
setDebounceTime()booluint8_tset the Debounce Time of the switch (5 .. 250 micro seconds)
setMidPressTime()booluint16_tset the Mid Press Time of the switch (100 .. 5000 milli seconds)
setLongPressTime()booluint16_tset the Long Press Time of the switch (300 .. 10000 milli seconds)
setModeSetBit()booluint8_tset the Mode Bit (STNG_HWROTDIR | STNG_FLIPMODE | STNG_TURNMODE)
setModeClearBit()booluint8_tclears the Mode Bit (STNG_HWROTDIR | STNG_FLIPMODE | STNG_TURNMODE)
setI²Caddress()booluint8_tset a new I²C address for this Slave (1 .. 127)
writeCommand()booluint8_twrite a command to the Slave (CMD_READCONF | CMD_WRITECONF | CMD_REBOOT)

 

De library heeft de volgende getters:

GetterReturnsParmsDescription
getStatus()uint8_tnonereads the status byte
getRotVal()int16_tnoneread the value of the rotary (-5000 .. +5000)
getRotStep()int16_tnoneread the rotary Step (1 .. 50)
getRotMin()int16_tnoneread the minimum rotary value (-5000 .. +5000)
getRotMax()int16_tnoneread the maximum rotary value (-5000 .. +5000)
getRotSpinTime()uint8_tnoneread the rotary spin time (2 .. 100 milli seconds)
getWhoAmI()int8_tnoneread the Address Register
getLedRed()uint8_tnoneread the current Red led PWM value (0 .. 255)
getLedGreen()uint8_tnoneread the current Green led PWM value (0 .. 255)
getLedBlue()uint8_tnoneread the current Blue led PWM value (0 .. 255)
getDebounceTime()uint8_tnoneread the Debounce Time of the switch (5 .. 250 micro seconds)
getMidPressTime()uint16_tnoneread the Mid Press Time of the switch (100 .. 5000 milli seconds)
getLongPressTime()uint16_tnoneread the Long Press Time of the switch (300 .. 10000 milli seconds)
getMajorRelease()uint8_tnoneread the Major Firmware Release byte (0 .. 255)
getMinorRelease()uint8_tnoneread the Minor Firmware Release byte (0 .. 255)
getModeSettings()uint8_tnoneread the Mode register byte (0 .. 255)
getModeSettings()booluint8_tread the Mode register byte and test against (STNG_HWROTDIR | STNG_FLIPMODE | STNG_TURNMODE)

 

De library heeft de volgende helpers:

HelperReturnsParmsDescription
isRotValChanged()boolnonetrue if the Rotary Value has changed
isRotValChangedUp()boolnonetrue if the Rotary Value > previous value
isRotValChangedDown()boolnonetrue if the Rotary Value < previous value
isButtonPressed()boolnonetrue if the Button is pressed
isButtonQuickReleased()boolnonetrue if the Button is released before midPressTime
isButtonMidReleased()boolnonetrue if the Button is released between midPressTime and longPressTime
isButtonLongReleased()boolnonetrue if the Button is released after longPressTime

 

Reacties

Webwinkelkeur Kiyoh Tweakers Trustpilot Opencircuit