kopia lustrzana https://github.com/pimoroni/pimoroni-pico
Readme improvements
rodzic
12e38c1157
commit
0120975b3c
|
@ -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
|
* MICS6814 - Gas Sensor - https://shop.pimoroni.com/products/mics6814-gas-sensor-breakout
|
||||||
* RGB Potentiometer - https://shop.pimoroni.com/products/rgb-potentiometer-breakout
|
* RGB Potentiometer - https://shop.pimoroni.com/products/rgb-potentiometer-breakout
|
||||||
* RGB Encoder - https://shop.pimoroni.com/products/rgb-encoder-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
|
* 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
|
* 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
|
* ST7735 - 0.96" LCD - https://shop.pimoroni.com/products/0-96-spi-colour-lcd-160x80-breakout
|
||||||
|
|
|
@ -131,7 +131,7 @@ wheel.set_rgb(0, 255, 0, 255);
|
||||||
Set the first LED - `0` - to Red `0.0`:
|
Set the first LED - `0` - to Red `0.0`:
|
||||||
|
|
||||||
```c++
|
```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);
|
wheel.gpio_pin_mode(GP7, IOExpander::PIN_PWM);
|
||||||
|
|
||||||
// Set the gpio pin's frequency to 25KHz, and record the cycle period
|
// 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
|
// Output a 50% duty cycle square wave
|
||||||
wheel.gpio_pin_value(GP7, (int)(period * 0.5f));
|
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:
|
Here is the complete list of functions available on the `BreakoutEncoderWheel` class:
|
||||||
```c++
|
```c++
|
||||||
BreakoutEncoderWheel(ioe_address=0x13, led_address=0x77, interrupt=PIN_UNUSED)
|
BreakoutEncoderWheel(uint8_t ioe_address = DEFAULT_IOE_I2C_ADDRESS, uint8_t led_address = DEFAULT_LED_I2C_ADDRESS);
|
||||||
set_ioe_address(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);
|
||||||
pressed(button)
|
bool init(bool skip_chip_id_check = false);
|
||||||
count()
|
void set_ioe_address(uint8_t address);
|
||||||
delta()
|
bool get_interrupt_flag();
|
||||||
step()
|
void clear_interrupt_flag();
|
||||||
turn()
|
bool pressed(uint button);
|
||||||
zero()
|
int16_t count();
|
||||||
revolutions()
|
int16_t delta();
|
||||||
degrees()
|
void zero();
|
||||||
radians()
|
int16_t step();
|
||||||
direction()
|
int16_t turn();
|
||||||
direction(direction)
|
float revolutions();
|
||||||
set_rgb(index, r, g, b)
|
float degrees();
|
||||||
set_hsv(index, h, s=1.0, v=1.0)
|
float radians();
|
||||||
clear()
|
Direction direction();
|
||||||
show()
|
void direction(Direction direction);
|
||||||
gpio_pin_mode(gpio)
|
void set_rgb(int index, int r, int g, int b);
|
||||||
gpio_pin_mode(gpio, mode)
|
void set_hsv(int index, float h, float s = 1.0f, float v = 1.0f);
|
||||||
gpio_pin_value(gpio)
|
void clear();
|
||||||
gpio_pin_value(gpio, value)
|
void show();
|
||||||
gpio_pwm_load(wait_for_load=True)
|
uint8_t gpio_pin_mode(uint8_t gpio);
|
||||||
gpio_pwm_frequency(frequency, load=True, wait_for_load=True)
|
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
|
## Constants Reference
|
||||||
|
@ -315,7 +320,6 @@ Here is the complete list of public constants in the `encoderwheel` namespace:
|
||||||
* `RIGHT` = `3`
|
* `RIGHT` = `3`
|
||||||
* `CENTRE` = `4`
|
* `CENTRE` = `4`
|
||||||
|
|
||||||
|
|
||||||
### GPIO Constants
|
### GPIO Constants
|
||||||
|
|
||||||
* `GP7` = `7`
|
* `GP7` = `7`
|
||||||
|
@ -323,7 +327,6 @@ Here is the complete list of public constants in the `encoderwheel` namespace:
|
||||||
* `GP9` = `9`
|
* `GP9` = `9`
|
||||||
* `GPIOS` = (`7`, `8`, `9`)
|
* `GPIOS` = (`7`, `8`, `9`)
|
||||||
|
|
||||||
|
|
||||||
### Count Constants
|
### Count Constants
|
||||||
|
|
||||||
* `NUM_LEDS` = `24`
|
* `NUM_LEDS` = `24`
|
||||||
|
|
|
@ -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_i2c import PimoroniI2C
|
||||||
from pimoroni import BREAKOUT_GARDEN_I2C_PINS # or PICO_EXPLORER_I2C_PINS or HEADER_I2C_PINS
|
from pimoroni import BREAKOUT_GARDEN_I2C_PINS # or PICO_EXPLORER_I2C_PINS or HEADER_I2C_PINS
|
||||||
from breakout_ioexpander import PWM
|
from breakout_ioexpander import PWM
|
||||||
from breakout_encoderwheel import BreakoutEncoderWheel, GP7
|
from breakout_encoder_wheel import BreakoutEncoderWheel, GP7
|
||||||
|
|
||||||
# Initialise EncoderWheel
|
# Initialise EncoderWheel
|
||||||
i2c = PimoroniI2C(**BREAKOUT_GARDEN_I2C_PINS)
|
i2c = PimoroniI2C(**BREAKOUT_GARDEN_I2C_PINS)
|
||||||
|
|
Ładowanie…
Reference in New Issue