diff --git a/README.md b/README.md index 71ac73b7..bc6139d9 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,7 @@ We also maintain a C++/CMake boilerplate with GitHub workflows configured for te * MICS6814 - Gas Sensor - https://shop.pimoroni.com/products/mics6814-gas-sensor-breakout * RGB Potentiometer - https://shop.pimoroni.com/products/rgb-potentiometer-breakout * RGB Encoder - https://shop.pimoroni.com/products/rgb-encoder-breakout +* RGB Encoder Wheel - https://shop.pimoroni.com/products/rgb-encoder-wheel-breakout * IO Expander - https://shop.pimoroni.com/products/io-expander * RV3028 - Real-Time Clock (RTC) - https://shop.pimoroni.com/products/rv3028-real-time-clock-rtc-breakout * ST7735 - 0.96" LCD - https://shop.pimoroni.com/products/0-96-spi-colour-lcd-160x80-breakout diff --git a/libraries/breakout_encoder_wheel/README.md b/libraries/breakout_encoder_wheel/README.md index 9a18544e..f592e5e2 100644 --- a/libraries/breakout_encoder_wheel/README.md +++ b/libraries/breakout_encoder_wheel/README.md @@ -131,7 +131,7 @@ wheel.set_rgb(0, 255, 0, 255); Set the first LED - `0` - to Red `0.0`: ```c++ -wheel.set_hsv(0, 0.0, 1.0, 1.0); +wheel.set_hsv(0, 0.0f, 1.0f, 1.0f); ``` @@ -239,7 +239,7 @@ BreakoutEncoderWheel wheel(&i2c); wheel.gpio_pin_mode(GP7, IOExpander::PIN_PWM); // Set the gpio pin's frequency to 25KHz, and record the cycle period -uint16_t period = wheel.gpio_pwm_frequency(25000); +uint16_t period = wheel.gpio_pwm_frequency(25000.0f); // Output a 50% duty cycle square wave wheel.gpio_pin_value(GP7, (int)(period * 0.5f)); @@ -264,29 +264,34 @@ All of Encoder Wheel's PWM outputs share the same timing parameters. This means Here is the complete list of functions available on the `BreakoutEncoderWheel` class: ```c++ -BreakoutEncoderWheel(ioe_address=0x13, led_address=0x77, interrupt=PIN_UNUSED) -set_ioe_address(address) -pressed(button) -count() -delta() -step() -turn() -zero() -revolutions() -degrees() -radians() -direction() -direction(direction) -set_rgb(index, r, g, b) -set_hsv(index, h, s=1.0, v=1.0) -clear() -show() -gpio_pin_mode(gpio) -gpio_pin_mode(gpio, mode) -gpio_pin_value(gpio) -gpio_pin_value(gpio, value) -gpio_pwm_load(wait_for_load=True) -gpio_pwm_frequency(frequency, load=True, wait_for_load=True) +BreakoutEncoderWheel(uint8_t ioe_address = DEFAULT_IOE_I2C_ADDRESS, uint8_t led_address = DEFAULT_LED_I2C_ADDRESS); +BreakoutEncoderWheel(I2C *i2c, uint8_t ioe_address = 0x13, uint8_t led_address = 0x77, uint interrupt = PIN_UNUSED, uint32_t timeout = 1, bool debug = false); +bool init(bool skip_chip_id_check = false); +void set_ioe_address(uint8_t address); +bool get_interrupt_flag(); +void clear_interrupt_flag(); +bool pressed(uint button); +int16_t count(); +int16_t delta(); +void zero(); +int16_t step(); +int16_t turn(); +float revolutions(); +float degrees(); +float radians(); +Direction direction(); +void direction(Direction direction); +void set_rgb(int index, int r, int g, int b); +void set_hsv(int index, float h, float s = 1.0f, float v = 1.0f); +void clear(); +void show(); +uint8_t gpio_pin_mode(uint8_t gpio); +void gpio_pin_mode(uint8_t gpio, uint8_t mode); +int16_t gpio_pin_value(uint8_t gpio); +float gpio_pin_value_as_voltage(uint8_t gpio); +void gpio_pin_value(uint8_t gpio, uint16_t value, bool load = true, bool wait_for_load = false); +void gpio_pwm_load(bool wait_for_load = true); +uint16_t gpio_pwm_frequency(float frequency, bool load = true, bool wait_for_load = false); ``` ## Constants Reference @@ -315,7 +320,6 @@ Here is the complete list of public constants in the `encoderwheel` namespace: * `RIGHT` = `3` * `CENTRE` = `4` - ### GPIO Constants * `GP7` = `7` @@ -323,7 +327,6 @@ Here is the complete list of public constants in the `encoderwheel` namespace: * `GP9` = `9` * `GPIOS` = (`7`, `8`, `9`) - ### Count Constants * `NUM_LEDS` = `24` diff --git a/micropython/modules/breakout_encoder_wheel/README.md b/micropython/modules/breakout_encoder_wheel/README.md index c6d511f8..20440459 100644 --- a/micropython/modules/breakout_encoder_wheel/README.md +++ b/micropython/modules/breakout_encoder_wheel/README.md @@ -225,7 +225,7 @@ Below is an example of setting a gpio pin to output a 25KHz signal with a 50% du from pimoroni_i2c import PimoroniI2C from pimoroni import BREAKOUT_GARDEN_I2C_PINS # or PICO_EXPLORER_I2C_PINS or HEADER_I2C_PINS from breakout_ioexpander import PWM -from breakout_encoderwheel import BreakoutEncoderWheel, GP7 +from breakout_encoder_wheel import BreakoutEncoderWheel, GP7 # Initialise EncoderWheel i2c = PimoroniI2C(**BREAKOUT_GARDEN_I2C_PINS)