Made edits from review

patch/i75-userbutton
Gee Bartlett 2023-02-03 12:53:14 +00:00 zatwierdzone przez Phil Howard
rodzic 93a18a874a
commit 8637967605
5 zmienionych plików z 11 dodań i 4 usunięć

Wyświetl plik

@ -13,8 +13,11 @@ PicoGraphics_PenRGB888 graphics(hub75.width, hub75.height, nullptr);
// And each button // And each button
Button button_a(Interstate75::A); Button button_a(Interstate75::A);
Button button_b(Interstate75::B); // For the Interstate75
// Button button_b(Interstate75::BOOT); // Using this button definition on the Interstate75W will most likely disable the wifi make sure it is commented out if using Interstate75W
// Or for the Interstate75W
Button button_b(Interstate75::B); // This button is not present on the Interstate75 (non W version)
// RGB LED // RGB LED
RGBLED led(Interstate75::LED_R, Interstate75::LED_G, Interstate75::LED_B, ACTIVE_LOW); RGBLED led(Interstate75::LED_R, Interstate75::LED_G, Interstate75::LED_B, ACTIVE_LOW);

Wyświetl plik

@ -27,6 +27,9 @@ PicoGraphics_PenRGB888 graphics(hub75.width, hub75.height, nullptr);
// And each button // And each button
Button button_a(Interstate75::A); Button button_a(Interstate75::A);
// For the Interstate75
Button button_b(Interstate75::BOOT);
// Or for the Interstate75W
Button button_b(Interstate75::B); Button button_b(Interstate75::B);
// RGB LED // RGB LED

Wyświetl plik

@ -9,6 +9,7 @@ namespace pimoroni {
namespace Interstate75{ namespace Interstate75{
static const uint8_t A = 14; static const uint8_t A = 14;
static const uint8_t B = 15; static const uint8_t B = 15;
static const uint8_t BOOT = 23;
static const uint8_t LED_R = 16; static const uint8_t LED_R = 16;
static const uint8_t LED_G = 17; static const uint8_t LED_G = 17;
static const uint8_t LED_B = 18; static const uint8_t LED_B = 18;

Wyświetl plik

@ -27,7 +27,7 @@ DISPLAY_INTERSTATE75_192X64
DISPLAY_INTERSTATE75_256X64 DISPLAY_INTERSTATE75_256X64
``` ```
You are able to set which version of the Interstate75 that you are using with the `interstate75w=` as default this value is set to `False` to use the Interstate75 button layout by setting it to `True` the module will use the Intersate75W button layout. If you are using an Interstate75W it is important to set this value to `interstate75w=True`, otherwise this could disable the wifi in your project. You are able to set which version of the Interstate75 that you are using with the `interstate75w=`. By default this value is set to `True` to use the Interstate75W button layout. By setting it to `False` the module will use the Interstate75 button layout. If you are using an Interstate75W it is important to set this value to interstate75w=True, otherwise this could disable the WiFi in your project
```python ```python
import interstate75 import interstate75
@ -44,7 +44,7 @@ import interstate75
display = interstate75.DISPLAY_INTERSTATE75_32X32 display = interstate75.DISPLAY_INTERSTATE75_32X32
board = interstate75.Interstate75(display=display, interstate75w=True) board = interstate75.Interstate75(display=display, interstate75w=False) #This is th e setup to be able to access the both A and BOOT on the Interstate75 (non W)
``` ```
From here, all features can be accessed by calling functions on `board`. In addition, when using Qwiic / Stemma QT devices, the I2C channel to use can be accessed with `board.i2c`. From here, all features can be accessed by calling functions on `board`. In addition, when using Qwiic / Stemma QT devices, the I2C channel to use can be accessed with `board.i2c`.

Wyświetl plik

@ -67,7 +67,7 @@ class Interstate75:
def switch_pressed(self, switch): def switch_pressed(self, switch):
if switch < 0 or switch >= self.NUM_SWITCHES: if switch < 0 or switch >= self.NUM_SWITCHES:
raise ValueError("switch out of range. Expected SWITCH_A (0), SWITCH_B (1) SWITCH_BOOT (2)") raise ValueError("switch out of range. Expected SWITCH_A (0), SWITCH_B/BOOT (1)")
return self.__switches[switch].is_pressed return self.__switches[switch].is_pressed
def set_led(self, r, g, b): def set_led(self, r, g, b):