kopia lustrzana https://github.com/pimoroni/pimoroni-pico
Added a plasma2040 namespaces
rodzic
823729dc24
commit
8e763f5efe
|
@ -33,4 +33,4 @@ add_subdirectory(pico_trackball_display)
|
|||
add_subdirectory(pico_audio)
|
||||
add_subdirectory(pico_wireless)
|
||||
|
||||
add_subdirectory(plasma_2040)
|
||||
add_subdirectory(plasma2040)
|
||||
|
|
|
@ -18,6 +18,7 @@ Press "Boot" to reset the speed back to default.
|
|||
*/
|
||||
|
||||
using namespace pimoroni;
|
||||
using namespace plasma;
|
||||
|
||||
// Set how many LEDs you have
|
||||
const uint N_LEDS = 30;
|
||||
|
@ -32,17 +33,17 @@ const uint UPDATES = 60;
|
|||
// Pick *one* LED type by uncommenting the relevant line below:
|
||||
|
||||
// APA102-style LEDs with Data/Clock lines. AKA DotStar
|
||||
//plasma::APA102 led_strip(N_LEDS, pio0, 0, plasma::PIN_DAT, plasma::PIN_CLK);
|
||||
//APA102 led_strip(N_LEDS, pio0, 0, plasma2040::DAT, plasma2040::CLK);
|
||||
|
||||
// WS28X-style LEDs with a single signal line. AKA NeoPixel
|
||||
// by default the WS2812 LED strip will be 400KHz, RGB with no white element
|
||||
plasma::WS2812 led_strip(N_LEDS, pio0, 0, plasma::PIN_DAT);
|
||||
WS2812 led_strip(N_LEDS, pio0, 0, plasma2040::DAT);
|
||||
|
||||
Button user_sw(plasma::USER_SW, Polarity::ACTIVE_LOW, 0);
|
||||
Button button_a(plasma::BUTTON_A, Polarity::ACTIVE_LOW, 50);
|
||||
Button button_b(plasma::BUTTON_B, Polarity::ACTIVE_LOW, 50);
|
||||
RGBLED led(plasma::LED_R, plasma::LED_G, plasma::LED_B);
|
||||
Analog sense(plasma::PIN_SENSE, plasma::ADC_GAIN, plasma::SHUNT_RESISTOR);
|
||||
Button user_sw(plasma2040::USER_SW, Polarity::ACTIVE_LOW, 0);
|
||||
Button button_a(plasma2040::BUTTON_A, Polarity::ACTIVE_LOW, 50);
|
||||
Button button_b(plasma2040::BUTTON_B, Polarity::ACTIVE_LOW, 50);
|
||||
RGBLED led(plasma2040::LED_R, plasma2040::LED_G, plasma2040::LED_B);
|
||||
Analog sense(plasma2040::SENSE, plasma2040::ADC_GAIN, plasma2040::SHUNT_RESISTOR);
|
||||
|
||||
|
||||
int main() {
|
|
@ -12,6 +12,7 @@
|
|||
#include "button.hpp"
|
||||
|
||||
using namespace pimoroni;
|
||||
using namespace plasma;
|
||||
|
||||
// Set how many LEDs you have
|
||||
const uint N_LEDS = 30;
|
||||
|
@ -22,17 +23,17 @@ const uint UPDATES = 60;
|
|||
// Pick *one* LED type by uncommenting the relevant line below:
|
||||
|
||||
// APA102-style LEDs with Data/Clock lines. AKA DotStar
|
||||
//plasma::APA102 led_strip(N_LEDS, pio0, 0, plasma::PIN_DAT, plasma::PIN_CLK);
|
||||
//APA102 led_strip(N_LEDS, pio0, 0, plasma2040::DAT, plasma2040::CLK);
|
||||
|
||||
// WS28X-style LEDs with a single signal line. AKA NeoPixel
|
||||
plasma::WS2812 led_strip(N_LEDS, pio0, 0, plasma::PIN_DAT);
|
||||
WS2812 led_strip(N_LEDS, pio0, 0, plasma2040::DAT);
|
||||
|
||||
|
||||
|
||||
Button button_a(plasma::BUTTON_A);
|
||||
Button button_b(plasma::BUTTON_B);
|
||||
Button button_a(plasma2040::BUTTON_A);
|
||||
Button button_b(plasma2040::BUTTON_B);
|
||||
|
||||
RGBLED led(plasma::LED_R, plasma::LED_G, plasma::LED_B);
|
||||
RGBLED led(plasma2040::LED_R, plasma2040::LED_G, plasma2040::LED_B);
|
||||
|
||||
I2C i2c(BOARD::PICO_EXPLORER);
|
||||
BreakoutEncoder enc(&i2c);
|
|
@ -21,6 +21,7 @@ by Gee 'Rabid Inventor' Bartlett
|
|||
*/
|
||||
|
||||
using namespace pimoroni;
|
||||
using namespace plasma;
|
||||
|
||||
// Set how many LEDs you have
|
||||
const uint N_LEDS = 40;
|
||||
|
@ -29,18 +30,18 @@ const uint REFRESH_DELAY = 100;
|
|||
// Pick *one* LED type by uncommenting the relevant line below:
|
||||
|
||||
// APA102-style LEDs with Data/Clock lines. AKA DotStar
|
||||
//plasma::APA102 led_strip(N_LEDS, pio0, 0, plasma::PIN_DAT, plasma::PIN_CLK);
|
||||
//APA102 led_strip(N_LEDS, pio0, 0, plasma2040::DAT, plasma2040::CLK);
|
||||
|
||||
// WS28X-style LEDs with a single signal line. AKA NeoPixel
|
||||
// by default the WS2812 LED strip will be 400KHz, RGB with no white element
|
||||
//plasma::WS2812 led_strip(N_LEDS, pio0, 0, plasma::PIN_DAT);
|
||||
//WS2812 led_strip(N_LEDS, pio0, 0, plasma2040::DAT);
|
||||
|
||||
//Uncomment for WS2812 with RGBW running at 800KHz
|
||||
plasma::WS2812 led_strip(N_LEDS, pio0, 0, plasma::PIN_DAT, 800000, true);
|
||||
WS2812 led_strip(N_LEDS, pio0, 0, plasma2040::DAT, 800000, true);
|
||||
|
||||
Button button_a(plasma::BUTTON_A, Polarity::ACTIVE_LOW, 50);
|
||||
Button button_b(plasma::BUTTON_B, Polarity::ACTIVE_LOW, 50);
|
||||
RGBLED led(plasma::LED_R, plasma::LED_G, plasma::LED_B);
|
||||
Button button_a(plasma2040::BUTTON_A, Polarity::ACTIVE_LOW, 50);
|
||||
Button button_b(plasma2040::BUTTON_B, Polarity::ACTIVE_LOW, 50);
|
||||
RGBLED led(plasma2040::LED_R, plasma2040::LED_G, plasma2040::LED_B);
|
||||
|
||||
|
||||
class playfield_object{
|
|
@ -5,20 +5,22 @@
|
|||
#include "ws2812.hpp"
|
||||
|
||||
namespace plasma {
|
||||
const uint LED_R = 16;
|
||||
const uint LED_G = 17;
|
||||
const uint LED_B = 18;
|
||||
namespace plasma2040 {
|
||||
static const uint LED_R = 16;
|
||||
static const uint LED_G = 17;
|
||||
static const uint LED_B = 18;
|
||||
|
||||
const uint BUTTON_A = 12;
|
||||
const uint BUTTON_B = 13;
|
||||
static const uint BUTTON_A = 12;
|
||||
static const uint BUTTON_B = 13;
|
||||
|
||||
const uint USER_SW = 23;
|
||||
static const uint USER_SW = 23;
|
||||
|
||||
const uint PIN_CLK = 14; // Used only for APA102
|
||||
const uint PIN_DAT = 15; // Used for both APA102 and WS2812
|
||||
static const uint CLK = 14; // Used only for APA102
|
||||
static const uint DAT = 15; // Used for both APA102 and WS2812
|
||||
|
||||
const uint PIN_SENSE = 29; // The pin used for current sensing
|
||||
static const uint SENSE = 29; // The pin used for current sensing
|
||||
|
||||
constexpr float ADC_GAIN = 50;
|
||||
constexpr float SHUNT_RESISTOR = 0.015f;
|
||||
static constexpr float ADC_GAIN = 50;
|
||||
static constexpr float SHUNT_RESISTOR = 0.015f;
|
||||
}
|
||||
}
|
Ładowanie…
Reference in New Issue