move pin configs into Adafruit_dvhstx.h, make examples check device type and use common pin config if known type
This commit is contained in:
parent
06d6dd8b14
commit
7c14a23ddb
5 changed files with 43 additions and 12 deletions
|
|
@ -2,9 +2,21 @@
|
|||
|
||||
#include <Adafruit_dvhstx.h>
|
||||
|
||||
|
||||
#if defined(ADAFRUIT_FEATHER_RP2350_HSTX)
|
||||
DVHSTXPinout pinConfig = ADAFRUIT_FEATHER_RP2350_CFG;
|
||||
#elif defined(ADAFRUIT_METRO_RP2350)
|
||||
DVHSTXPinout pinConfig = ADAFRUIT_METRO_RP2350_CFG;
|
||||
#elif (defined(ARDUINO_RASPBERRY_PI_PICO_2) || defined(ARDUINO_RASPBERRY_PI_PICO_2W))
|
||||
DVHSTXPinout pinConfig = ADAFRUIT_HSTXDVIBELL_CFG;
|
||||
#else
|
||||
// If your board definition has PIN_CKP and related defines,
|
||||
// DVHSTX_PINOUT_DEFAULT is available
|
||||
DVHSTX16 display(DVHSTX_PINOUT_DEFAULT, DVHSTX_RESOLUTION_320x240);
|
||||
DVHSTXPinout pinConfig = DVHSTX_PINOUT_DEFAULT;
|
||||
#endif
|
||||
|
||||
|
||||
DVHSTX16 display(pinConfig, DVHSTX_RESOLUTION_320x240);
|
||||
// If you get the message "error: 'DVHSTX_PINOUT_DEFAULTx' was not declared"
|
||||
// then you need to give the pins numbers explicitly, like the example below.
|
||||
// The order is: {CKP, D0P, D1P, D2P} DVHSTX16 display({12, 14, 16, 18},
|
||||
|
|
|
|||
|
|
@ -2,9 +2,20 @@
|
|||
|
||||
#include <Adafruit_dvhstx.h>
|
||||
|
||||
#if defined(ADAFRUIT_FEATHER_RP2350_HSTX)
|
||||
DVHSTXPinout pinConfig = ADAFRUIT_FEATHER_RP2350_CFG;
|
||||
#elif defined(ADAFRUIT_METRO_RP2350)
|
||||
DVHSTXPinout pinConfig = ADAFRUIT_METRO_RP2350_CFG;
|
||||
#elif (defined(ARDUINO_RASPBERRY_PI_PICO_2) || defined(ARDUINO_RASPBERRY_PI_PICO_2W))
|
||||
DVHSTXPinout pinConfig = ADAFRUIT_HSTXDVIBELL_CFG;
|
||||
#else
|
||||
// If your board definition has PIN_CKP and related defines,
|
||||
// DVHSTX_PINOUT_DEFAULT is available
|
||||
DVHSTX8 display(DVHSTX_PINOUT_DEFAULT, DVHSTX_RESOLUTION_640x360);
|
||||
DVHSTXPinout pinConfig = DVHSTX_PINOUT_DEFAULT;
|
||||
#endif
|
||||
|
||||
|
||||
DVHSTX8 display(pinConfig, DVHSTX_RESOLUTION_320x240);
|
||||
// If you get the message "error: 'DVHSTX_PINOUT_DEFAULTx' was not declared"
|
||||
// then you need to give the pins numbers explicitly, like the example below.
|
||||
// The order is: {CKP, D0P, D1P, D2P} DVHSTX8 display({12, 14, 16, 18},
|
||||
|
|
|
|||
|
|
@ -2,9 +2,20 @@
|
|||
// With apologies to Stanley Kubrick et al
|
||||
#include <Adafruit_dvhstx.h>
|
||||
|
||||
#if defined(ADAFRUIT_FEATHER_RP2350_HSTX)
|
||||
DVHSTXPinout pinConfig = ADAFRUIT_FEATHER_RP2350_CFG;
|
||||
#elif defined(ADAFRUIT_METRO_RP2350)
|
||||
DVHSTXPinout pinConfig = ADAFRUIT_METRO_RP2350_CFG;
|
||||
#elif (defined(ARDUINO_RASPBERRY_PI_PICO_2) || defined(ARDUINO_RASPBERRY_PI_PICO_2W))
|
||||
DVHSTXPinout pinConfig = ADAFRUIT_HSTXDVIBELL_CFG;
|
||||
#else
|
||||
// If your board definition has PIN_CKP and related defines,
|
||||
// DVHSTX_PINOUT_DEFAULT is available
|
||||
DVHSTXText display(DVHSTX_PINOUT_DEFAULT);
|
||||
DVHSTXPinout pinConfig = DVHSTX_PINOUT_DEFAULT;
|
||||
#endif
|
||||
|
||||
|
||||
DVHSTXText display(pinConfig);
|
||||
// If you get the message "error: 'DVHSTX_PINOUT_DEFAULTx' was not declared"
|
||||
// then you need to give the pins numbers explicitly, like the example below.
|
||||
// The order is: {CKP, D0P, D1P, D2P}.
|
||||
|
|
|
|||
|
|
@ -97,6 +97,12 @@ using pimoroni::DVHSTXPinout;
|
|||
{ 12, 14, 16, 18 }
|
||||
#endif
|
||||
|
||||
// Other common HSTX pin configurations
|
||||
#define ADAFRUIT_HSTXDVIBELL_CFG {14, 12, 18, 16}
|
||||
#define ADAFRUIT_METRO_RP2350_CFG {14, 18, 16, 12}
|
||||
#define ADAFRUIT_FEATHER_RP2350_CFG {14, 18, 16, 12}
|
||||
#define ADAFRUIT_FRUIT_JAM_CFG {13, 15, 17, 19}
|
||||
|
||||
int16_t dvhstx_width(DVHSTXResolution r);
|
||||
int16_t dvhstx_height(DVHSTXResolution r);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
#pragma once
|
||||
#include "drivers/dvhstx/dvhstx.hpp"
|
||||
|
||||
using pimoroni::DVHSTXPinout;
|
||||
|
||||
static const DVHSTXPinout adafruit_hstxdvibell_cfg = {14, 12, 18, 16};
|
||||
static const DVHSTXPinout adafruit_metro_rp2350_cfg = {14, 18, 16, 12};
|
||||
static const DVHSTXPinout adafruit_feather_rp2350_cfg = {14, 18, 16, 12};
|
||||
static const DVHSTXPinout adafruit_fruit_jam_cfg = {13, 15, 17, 19};
|
||||
Loading…
Reference in a new issue