@@ -131,7 +131,7 @@ wheel.set_rgb(0, 255, 0, 255);
131
131
Set the first LED - ` 0 ` - to Red ` 0.0 ` :
132
132
133
133
``` c++
134
- wheel.set_hsv(0 , 0.0 , 1.0 , 1.0 );
134
+ wheel.set_hsv(0 , 0 .0f , 1 .0f , 1 .0f );
135
135
```
136
136
137
137
@@ -239,7 +239,7 @@ BreakoutEncoderWheel wheel(&i2c);
239
239
wheel.gpio_pin_mode(GP7, IOExpander::PIN_PWM);
240
240
241
241
// Set the gpio pin's frequency to 25KHz, and record the cycle period
242
- uint16_t period = wheel.gpio_pwm_frequency(25000);
242
+ uint16_t period = wheel.gpio_pwm_frequency(25000.0f );
243
243
244
244
// Output a 50% duty cycle square wave
245
245
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
264
264
265
265
Here is the complete list of functions available on the `BreakoutEncoderWheel` class:
266
266
```c++
267
- BreakoutEncoderWheel(ioe_address=0x13, led_address=0x77, interrupt=PIN_UNUSED)
268
- set_ioe_address(address)
269
- pressed(button)
270
- count()
271
- delta()
272
- step()
273
- turn()
274
- zero()
275
- revolutions()
276
- degrees()
277
- radians()
278
- direction()
279
- direction(direction)
280
- set_rgb(index, r, g, b)
281
- set_hsv(index, h, s=1.0, v=1.0)
282
- clear()
283
- show()
284
- gpio_pin_mode(gpio)
285
- gpio_pin_mode(gpio, mode)
286
- gpio_pin_value(gpio)
287
- gpio_pin_value(gpio, value)
288
- gpio_pwm_load(wait_for_load=True)
289
- gpio_pwm_frequency(frequency, load=True, wait_for_load=True)
267
+ BreakoutEncoderWheel(uint8_t ioe_address = DEFAULT_IOE_I2C_ADDRESS, uint8_t led_address = DEFAULT_LED_I2C_ADDRESS);
268
+ BreakoutEncoderWheel(I2C *i2c, uint8_t ioe_address = 0x13, uint8_t led_address = 0x77, uint interrupt = PIN_UNUSED, uint32_t timeout = 1, bool debug = false);
269
+ bool init(bool skip_chip_id_check = false);
270
+ void set_ioe_address(uint8_t address);
271
+ bool get_interrupt_flag();
272
+ void clear_interrupt_flag();
273
+ bool pressed(uint button);
274
+ int16_t count();
275
+ int16_t delta();
276
+ void zero();
277
+ int16_t step();
278
+ int16_t turn();
279
+ float revolutions();
280
+ float degrees();
281
+ float radians();
282
+ Direction direction();
283
+ void direction(Direction direction);
284
+ void set_rgb(int index, int r, int g, int b);
285
+ void set_hsv(int index, float h, float s = 1.0f, float v = 1.0f);
286
+ void clear();
287
+ void show();
288
+ uint8_t gpio_pin_mode(uint8_t gpio);
289
+ void gpio_pin_mode(uint8_t gpio, uint8_t mode);
290
+ int16_t gpio_pin_value(uint8_t gpio);
291
+ float gpio_pin_value_as_voltage(uint8_t gpio);
292
+ void gpio_pin_value(uint8_t gpio, uint16_t value, bool load = true, bool wait_for_load = false);
293
+ void gpio_pwm_load(bool wait_for_load = true);
294
+ uint16_t gpio_pwm_frequency(float frequency, bool load = true, bool wait_for_load = false);
290
295
```
291
296
292
297
## Constants Reference
@@ -315,15 +320,13 @@ Here is the complete list of public constants in the `encoderwheel` namespace:
315
320
* ` RIGHT ` = ` 3 `
316
321
* ` CENTRE ` = ` 4 `
317
322
318
-
319
323
### GPIO Constants
320
324
321
325
* ` GP7 ` = ` 7 `
322
326
* ` GP8 ` = ` 8 `
323
327
* ` GP9 ` = ` 9 `
324
328
* ` GPIOS ` = (` 7 ` , ` 8 ` , ` 9 ` )
325
329
326
-
327
330
### Count Constants
328
331
329
332
* ` NUM_LEDS ` = ` 24 `
0 commit comments