Compare commits
60 commits
master
...
fix-cpy-31
| Author | SHA1 | Date | |
|---|---|---|---|
| 2a1ba8fa47 | |||
|
|
761d6437e8 | ||
|
|
4c8bed2303 | ||
|
|
07015d5cb5 | ||
|
|
00e00ee8ac | ||
|
|
0651691425 | ||
|
|
af5c045b6b | ||
|
|
017ba00ab4 | ||
|
|
8c53b2515c | ||
|
|
7daa236e41 | ||
|
|
2b4489d809 | ||
|
|
0bb0dea200 | ||
|
|
9b015cecd6 | ||
|
|
5a8428975c | ||
|
|
f0ea03cecd | ||
|
|
a3efbfbfdc | ||
|
|
60414a4d0d | ||
|
|
3e64c1e127 | ||
|
|
8c8d096f15 | ||
|
|
b135ae26e5 | ||
|
|
2ad6f03357 | ||
|
|
f27da0d358 | ||
|
|
aa8411cc30 | ||
|
|
e38c872cca | ||
|
|
e9db308764 | ||
|
|
ac1b8e07b7 | ||
|
|
63b4df7435 | ||
|
|
9f88b5a74c | ||
|
|
7dbdf19c1d | ||
|
|
d405666d8a | ||
| 3a817d6057 | |||
|
|
160dd0af4b | ||
|
|
597c56e658 | ||
|
|
78d4c9bb15 | ||
|
|
4cbf99aa54 | ||
|
|
a51676db5e | ||
|
|
40cb6a9cac | ||
|
|
87a95379b5 | ||
|
|
8968259c14 | ||
|
|
fc180e4689 | ||
|
|
9f71088d2c | ||
|
|
973de07bfc | ||
| 1b8f461f64 | |||
| 241bf2516c | |||
| 41a92d7731 | |||
|
|
fac7eea645 | ||
|
|
3bc6f23541 | ||
| c411714cbd | |||
| c3a3e35731 | |||
| 7f448357d0 | |||
| 969672dff1 | |||
|
|
5a1151db28 | ||
|
|
e1659f270c | ||
|
|
20c3b67bc3 | ||
|
|
103ea89935 | ||
|
|
51f39d9594 | ||
|
|
0958b759a5 | ||
|
|
97c2122ba7 | ||
|
|
250675d2fc | ||
|
|
831a253898 |
13 changed files with 2540 additions and 1168 deletions
46
.github/ISSUE_TEMPLATE.md
vendored
Normal file
46
.github/ISSUE_TEMPLATE.md
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
Thank you for opening an issue on an Adafruit Arduino library repository. To
|
||||
improve the speed of resolution please review the following guidelines and
|
||||
common troubleshooting steps below before creating the issue:
|
||||
|
||||
- **Do not use GitHub issues for troubleshooting projects and issues.** Instead use
|
||||
the forums at http://forums.adafruit.com to ask questions and troubleshoot why
|
||||
something isn't working as expected. In many cases the problem is a common issue
|
||||
that you will more quickly receive help from the forum community. GitHub issues
|
||||
are meant for known defects in the code. If you don't know if there is a defect
|
||||
in the code then start with troubleshooting on the forum first.
|
||||
|
||||
- **If following a tutorial or guide be sure you didn't miss a step.** Carefully
|
||||
check all of the steps and commands to run have been followed. Consult the
|
||||
forum if you're unsure or have questions about steps in a guide/tutorial.
|
||||
|
||||
- **For Arduino projects check these very common issues to ensure they don't apply**:
|
||||
|
||||
- For uploading sketches or communicating with the board make sure you're using
|
||||
a **USB data cable** and **not** a **USB charge-only cable**. It is sometimes
|
||||
very hard to tell the difference between a data and charge cable! Try using the
|
||||
cable with other devices or swapping to another cable to confirm it is not
|
||||
the problem.
|
||||
|
||||
- **Be sure you are supplying adequate power to the board.** Check the specs of
|
||||
your board and plug in an external power supply. In many cases just
|
||||
plugging a board into your computer is not enough to power it and other
|
||||
peripherals.
|
||||
|
||||
- **Double check all soldering joints and connections.** Flakey connections
|
||||
cause many mysterious problems. See the [guide to excellent soldering](https://learn.adafruit.com/adafruit-guide-excellent-soldering/tools) for examples of good solder joints.
|
||||
|
||||
- **Ensure you are using an official Arduino or Adafruit board.** We can't
|
||||
guarantee a clone board will have the same functionality and work as expected
|
||||
with this code and don't support them.
|
||||
|
||||
If you're sure this issue is a defect in the code and checked the steps above
|
||||
please fill in the following fields to provide enough troubleshooting information.
|
||||
You may delete the guideline and text above to just leave the following details:
|
||||
|
||||
- Arduino board: **INSERT ARDUINO BOARD NAME/TYPE HERE**
|
||||
|
||||
- Arduino IDE version (found in Arduino -> About Arduino menu): **INSERT ARDUINO
|
||||
VERSION HERE**
|
||||
|
||||
- List the steps to reproduce the problem below (if possible attach a sketch or
|
||||
copy the sketch code in too): **LIST REPRO STEPS BELOW**
|
||||
26
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
26
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
Thank you for creating a pull request to contribute to Adafruit's GitHub code!
|
||||
Before you open the request please review the following guidelines and tips to
|
||||
help it be more easily integrated:
|
||||
|
||||
- **Describe the scope of your change--i.e. what the change does and what parts
|
||||
of the code were modified.** This will help us understand any risks of integrating
|
||||
the code.
|
||||
|
||||
- **Describe any known limitations with your change.** For example if the change
|
||||
doesn't apply to a supported platform of the library please mention it.
|
||||
|
||||
- **Please run any tests or examples that can exercise your modified code.** We
|
||||
strive to not break users of the code and running tests/examples helps with this
|
||||
process.
|
||||
|
||||
Thank you again for contributing! We will try to test and integrate the change
|
||||
as soon as we can, but be aware we have many GitHub repositories to manage and
|
||||
can't immediately respond to every request. There is no need to bump or check in
|
||||
on a pull request (it will clutter the discussion of the request).
|
||||
|
||||
Also don't be worried if the request is closed or not integrated--sometimes the
|
||||
priorities of Adafruit's GitHub code (education, ease of use) might not match the
|
||||
priorities of the pull request. Don't fret, the open source community thrives on
|
||||
forks and GitHub makes it easy to keep your changes in a forked repo.
|
||||
|
||||
After reviewing the guidelines above you can delete this text from the pull request.
|
||||
37
.github/workflows/githubci.yml
vendored
Normal file
37
.github/workflows/githubci.yml
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
name: Arduino Library CI
|
||||
|
||||
on: [pull_request, push, repository_dispatch]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
arduino-platform: ["metro_m0", "metro_m4", "nrf52840", "esp32"]
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
repository: adafruit/ci-arduino
|
||||
path: ci
|
||||
|
||||
- name: pre-install
|
||||
run: bash ci/actions_install.sh
|
||||
|
||||
- name: test platforms
|
||||
run: python3 ci/build_platform.py ${{ matrix.arduino-platform }}
|
||||
|
||||
- name: clang
|
||||
run: python3 ci/run-clang-format.py -e "ci/*" -e "bin/*" -r .
|
||||
|
||||
- name: doxygen
|
||||
env:
|
||||
GH_REPO_TOKEN: ${{ secrets.GH_REPO_TOKEN }}
|
||||
PRETTYNAME : "Adafruit Protomatter"
|
||||
run: bash ci/doxy_gen_and_deploy.sh
|
||||
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# Our handy .gitignore for automation ease
|
||||
Doxyfile*
|
||||
doxygen_sqlite3.db
|
||||
html
|
||||
|
|
@ -1,3 +1,38 @@
|
|||
/*!
|
||||
* @file Adafruit_Protomatter.cpp
|
||||
*
|
||||
* @mainpage Adafruit Protomatter RGB LED matrix library.
|
||||
*
|
||||
* @section intro_sec Introduction
|
||||
*
|
||||
* This is documentation for Adafruit's protomatter library for HUB75-style
|
||||
* RGB LED matrices. It is designed to work with various matrices sold by
|
||||
* Adafruit ("HUB75" is a vague term and other similar matrices are not
|
||||
* guaranteed to work). This file is the Arduino-specific calls; the
|
||||
* underlying C code is more platform-neutral.
|
||||
*
|
||||
* Adafruit invests time and resources providing this open source code,
|
||||
* please support Adafruit and open-source hardware by purchasing products
|
||||
* from Adafruit!
|
||||
*
|
||||
* @section dependencies Dependencies
|
||||
*
|
||||
* This library depends on
|
||||
* <a href="https://github.com/adafruit/Adafruit-GFX-Library">Adafruit_GFX</a>
|
||||
* being present on your system. Please make sure you have installed the
|
||||
* latest version before using this library.
|
||||
*
|
||||
* @section author Author
|
||||
*
|
||||
* Written by Phil "Paint Your Dragon" Burgess and Jeff Epler for
|
||||
* Adafruit Industries, with contributions from the open source community.
|
||||
*
|
||||
* @section license License
|
||||
*
|
||||
* BSD license, all text here must be included in any redistribution.
|
||||
*
|
||||
*/
|
||||
|
||||
// Arduino-specific wrapper for the Protomatter C library (provides
|
||||
// constructor and so forth, builds on Adafruit_GFX). There should
|
||||
// not be any device-specific #ifdefs here. See notes in core.c and
|
||||
|
|
@ -5,7 +40,7 @@
|
|||
|
||||
#include "Adafruit_Protomatter.h" // Also includes core.h & Adafruit_GFX.h
|
||||
|
||||
extern Protomatter_core *_PM_protoPtr; // In core.c (via arch.h)
|
||||
extern Protomatter_core *_PM_protoPtr; ///< In core.c (via arch.h)
|
||||
|
||||
// Overall matrix refresh rate (frames/second) is a function of matrix width
|
||||
// and chain length, number of address lines, number of bit planes, CPU speed
|
||||
|
|
@ -21,67 +56,50 @@ extern Protomatter_core *_PM_protoPtr; // In core.c (via arch.h)
|
|||
// refresh slower than this, and in many cases will...just need to set an
|
||||
// upper limit to avoid excessive CPU load). An incredibly long comment block
|
||||
// for a single constant, thank you for coming to my TED talk!
|
||||
#define _PM_MAX_REFRESH_HZ 250
|
||||
#define _PM_MAX_REFRESH_HZ 250 ///< Upper limit (ish) to matrix refresh rate
|
||||
|
||||
// Time (in milliseconds) to pause following any change in address lines
|
||||
// (individually or collectively). Some matrices respond slowly there...
|
||||
// must pause on change for matrix to catch up. Defined here (rather than
|
||||
// arch.h) because it's not architecture-specific.
|
||||
#define _PM_ROW_DELAY 8
|
||||
#define _PM_ROW_DELAY 8 ///< Delay time between row address line changes (ms)
|
||||
|
||||
Adafruit_Protomatter::Adafruit_Protomatter(uint16_t bitWidth, uint8_t bitDepth,
|
||||
uint8_t rgbCount, uint8_t *rgbList,
|
||||
uint8_t addrCount, uint8_t *addrList,
|
||||
uint8_t clockPin, uint8_t latchPin,
|
||||
uint8_t oePin, bool doubleBuffer,
|
||||
void *timer)
|
||||
: GFXcanvas16(bitWidth,
|
||||
(2 << min((int)addrCount, 5)) * min((int)rgbCount, 5)) {
|
||||
if (bitDepth > 6)
|
||||
bitDepth = 6; // GFXcanvas16 color limit (565)
|
||||
|
||||
Adafruit_Protomatter::Adafruit_Protomatter(
|
||||
uint16_t bitWidth, uint8_t bitDepth,
|
||||
uint8_t rgbCount, uint8_t *rgbList,
|
||||
uint8_t addrCount, uint8_t *addrList,
|
||||
uint8_t clockPin, uint8_t latchPin, uint8_t oePin,
|
||||
bool doubleBuffer, void *timer) :
|
||||
GFXcanvas16(bitWidth, (2 << min(addrCount, 5)) * min(rgbCount, 5)) {
|
||||
if(bitDepth > 6) bitDepth = 6; // GFXcanvas16 color limit (565)
|
||||
|
||||
// Arguments are passed through to the C _PM_init() function which does
|
||||
// some input validation and minor allocation. Return value is ignored
|
||||
// because we can't really do anything about it in a C++ constructor.
|
||||
// The class begin() function checks rgbPins for NULL to determine
|
||||
// whether to proceed or indicate an error.
|
||||
(void)_PM_init(&core, bitWidth, bitDepth, rgbCount, rgbList,
|
||||
addrCount, addrList, clockPin, latchPin, oePin, doubleBuffer, timer);
|
||||
// Arguments are passed through to the C _PM_init() function which does
|
||||
// some input validation and minor allocation. Return value is ignored
|
||||
// because we can't really do anything about it in a C++ constructor.
|
||||
// The class begin() function checks rgbPins for NULL to determine
|
||||
// whether to proceed or indicate an error.
|
||||
(void)_PM_init(&core, bitWidth, bitDepth, rgbCount, rgbList, addrCount,
|
||||
addrList, clockPin, latchPin, oePin, doubleBuffer, timer);
|
||||
}
|
||||
|
||||
Adafruit_Protomatter::~Adafruit_Protomatter(void) {
|
||||
_PM_free(&core);
|
||||
_PM_protoPtr = NULL;
|
||||
_PM_free(&core);
|
||||
_PM_protoPtr = NULL;
|
||||
}
|
||||
|
||||
ProtomatterStatus Adafruit_Protomatter::begin(void) {
|
||||
_PM_protoPtr = &core;
|
||||
_PM_begin(&core);
|
||||
return PROTOMATTER_OK;
|
||||
_PM_protoPtr = &core;
|
||||
return _PM_begin(&core);
|
||||
}
|
||||
|
||||
// Transfer data from GFXcanvas16 to the matrix framebuffer's weird
|
||||
// internal format. The actual conversion functions referenced below
|
||||
// are in core.c, reasoning is explained there.
|
||||
void Adafruit_Protomatter::show(void) {
|
||||
|
||||
// Destination address is computed in convert function
|
||||
// (based on active buffer value, if double-buffering),
|
||||
// just need to pass in the canvas buffer address and
|
||||
// width in pixels.
|
||||
if(core.bytesPerElement == 1) {
|
||||
_PM_convert_565_byte(&core, getBuffer(), WIDTH);
|
||||
} else if(core.bytesPerElement == 2) {
|
||||
_PM_convert_565_word(&core, getBuffer(), WIDTH);
|
||||
} else {
|
||||
_PM_convert_565_long(&core, getBuffer(), WIDTH);
|
||||
}
|
||||
|
||||
if(core.doubleBuffer) {
|
||||
core.swapBuffers = 1;
|
||||
// To avoid overwriting data on the matrix, don't return
|
||||
// until the timer ISR has performed the swap at the right time.
|
||||
while(core.swapBuffers);
|
||||
}
|
||||
_PM_convert_565(&core, getBuffer(), WIDTH);
|
||||
_PM_swapbuffer_maybe(&core);
|
||||
}
|
||||
|
||||
// Returns current value of frame counter and resets its value to zero.
|
||||
|
|
@ -89,5 +107,5 @@ void Adafruit_Protomatter::show(void) {
|
|||
// intervals), can be used to get a rough frames-per-second value for
|
||||
// the matrix (since this is difficult to estimate beforehand).
|
||||
uint32_t Adafruit_Protomatter::getFrameCount(void) {
|
||||
return _PM_getFrameCount(_PM_protoPtr);
|
||||
return _PM_getFrameCount(_PM_protoPtr);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,22 +7,99 @@
|
|||
#include "core.h"
|
||||
#include <Adafruit_GFX.h>
|
||||
|
||||
/*!
|
||||
@brief Class representing the Arduino-facing side of the Protomatter
|
||||
library. Subclass of Adafruit_GFX's GFXcanvas16 to allow all
|
||||
the drawing operations.
|
||||
*/
|
||||
class Adafruit_Protomatter : public GFXcanvas16 {
|
||||
public:
|
||||
Adafruit_Protomatter(uint16_t bitWidth, uint8_t bitDepth,
|
||||
uint8_t rgbCount, uint8_t *rgbList,
|
||||
uint8_t addrCount, uint8_t *addrList,
|
||||
uint8_t clockPin, uint8_t latchPin, uint8_t oePin,
|
||||
bool doubleBuffer, void *timer=NULL);
|
||||
~Adafruit_Protomatter(void);
|
||||
ProtomatterStatus begin(void);
|
||||
void show(void);
|
||||
uint32_t getFrameCount(void);
|
||||
private:
|
||||
Protomatter_core core; // Underlying C struct
|
||||
void convert_byte(uint8_t *dest); // GFXcanvas16-to-matrix
|
||||
void convert_word(uint16_t *dest); // conversion functions
|
||||
void convert_long(uint32_t *dest); // for 8/16/32 bit bufs
|
||||
public:
|
||||
/*!
|
||||
@brief Adafruit_Protomatter constructor.
|
||||
@param bitWidth Total width of RGB matrix chain, in pixels.
|
||||
Usu. some multiple of 32, but maybe exceptions.
|
||||
@param bitDepth Color "depth" in bitplanes, determines range of
|
||||
shades of red, green and blue. e.g. passing 4
|
||||
bits = 16 shades ea. R,G,B = 16x16x16 = 4096
|
||||
colors. Max is 6, since the GFX library works
|
||||
with "565" RGB colors (6 bits green, 5 red/blue).
|
||||
@param rgbCount Number of "sets" of RGB data pins, each set
|
||||
containing 6 pins (2 ea. R,G,B). Typically 1,
|
||||
indicating a single matrix (or matrix chain).
|
||||
In theory (but not yet extensively tested),
|
||||
multiple sets of pins can be driven in parallel,
|
||||
up to 5 on some devices (if the hardware design
|
||||
provides all those bits on one PORT).
|
||||
@param rgbList A uint8_t array of pins (Arduino pin numbering),
|
||||
6X the prior rgbCount value, corresponding to
|
||||
the 6 output color bits for a matrix (or chain).
|
||||
Order is upper-half red, green, blue, lower-half
|
||||
red, green blue (repeat for each add'l chain).
|
||||
All the RGB pins (plus the clock pin below on
|
||||
some architectures) MUST be on the same PORT
|
||||
register. It's recommended (but not required)
|
||||
that all RGB pins (and clock depending on arch)
|
||||
be within the same byte of a PORT (but do not
|
||||
need to be sequential or contiguous within that
|
||||
byte) for more efficient RAM utilization. For
|
||||
two concurrent chains, same principle but 16-bit
|
||||
word instead of byte.
|
||||
@param addrCount Number of row address lines required of matrix.
|
||||
Total pixel height is then 2 x 2^addrCount, e.g.
|
||||
32-pixel-tall matrices have 4 row address lines.
|
||||
@param addrList A uint8_t array of pins (Arduino pin numbering),
|
||||
one per row address line.
|
||||
@param clockPin RGB clock pin (Arduino pin #).
|
||||
@param latchPin RGB data latch pin (Arduino pin #).
|
||||
@param oePin Output enable pin (Arduino pin #), active low.
|
||||
@param doubleBuffer If true, two matrix buffers are allocated,
|
||||
so changing display contents doesn't introduce
|
||||
artifacts mid-conversion. Requires ~2X RAM.
|
||||
@param timer Pointer to timer peripheral or timer-related
|
||||
struct (architecture-dependent), or NULL to
|
||||
use a default timer ID (also arch-dependent).
|
||||
*/
|
||||
Adafruit_Protomatter(uint16_t bitWidth, uint8_t bitDepth, uint8_t rgbCount,
|
||||
uint8_t *rgbList, uint8_t addrCount, uint8_t *addrList,
|
||||
uint8_t clockPin, uint8_t latchPin, uint8_t oePin,
|
||||
bool doubleBuffer, void *timer = NULL);
|
||||
~Adafruit_Protomatter(void);
|
||||
|
||||
/*!
|
||||
@brief Start a Protomatter matrix display running -- initialize
|
||||
pins, timer and interrupt into existence.
|
||||
@return A ProtomatterStatus status, one of:
|
||||
PROTOMATTER_OK if everything is good.
|
||||
PROTOMATTER_ERR_PINS if data and/or clock pins are split
|
||||
across different PORTs.
|
||||
PROTOMATTER_ERR_MALLOC if insufficient RAM to allocate
|
||||
display memory.
|
||||
PROTOMATTER_ERR_ARG if a bad value was passed to the
|
||||
constructor.
|
||||
*/
|
||||
ProtomatterStatus begin(void);
|
||||
|
||||
/*!
|
||||
@brief Process data from GFXcanvas16 to the matrix framebuffer's
|
||||
internal format for display.
|
||||
*/
|
||||
void show(void);
|
||||
|
||||
/*!
|
||||
@brief Returns current value of frame counter and resets its value
|
||||
to zero. Two calls to this, timed one second apart (or use
|
||||
math with other intervals), can be used to get a rough
|
||||
frames-per-second value for the matrix (since this is
|
||||
difficult to estimate beforehand).
|
||||
@return Frame count since previous call to function, as a uint32_t.
|
||||
*/
|
||||
uint32_t getFrameCount(void);
|
||||
|
||||
private:
|
||||
Protomatter_core core; // Underlying C struct
|
||||
void convert_byte(uint8_t *dest); // GFXcanvas16-to-matrix
|
||||
void convert_word(uint16_t *dest); // conversion functions
|
||||
void convert_long(uint32_t *dest); // for 8/16/32 bit bufs
|
||||
};
|
||||
|
||||
#endif // _ADAFRUIT_PROTOMATTER_H_
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# Adafruit_Protomatter
|
||||
# Adafruit_Protomatter [](https://github.com/adafruit/Adafruit_Protomatter/actions)
|
||||
|
||||
"I used protomatter in the Genesis matrix." - David Marcus, Star Trek III
|
||||
|
||||
|
|
@ -6,8 +6,6 @@ Code for driving HUB75-style RGB LED matrices, targeted at 32-bit MCUs
|
|||
using brute-force GPIO (that is, not relying on DMA or other specialized
|
||||
peripherals beyond a timer interrupt, goal being portability).
|
||||
|
||||
Name might change as it's nondescriptive and tedious to type in code.
|
||||
|
||||
# Matrix Concepts and Jargon
|
||||
|
||||
HUB75 RGB LED matrices are basically a set of six concurrent shift register
|
||||
|
|
|
|||
315
core.h
315
core.h
|
|
@ -1,3 +1,19 @@
|
|||
/*!
|
||||
* @file core.h
|
||||
*
|
||||
* Part of Adafruit's Protomatter library for HUB75-style RGB LED matrices.
|
||||
*
|
||||
* Adafruit invests time and resources providing this open source code,
|
||||
* please support Adafruit and open-source hardware by purchasing
|
||||
* products from Adafruit!
|
||||
*
|
||||
* Written by Phil "Paint Your Dragon" Burgess and Jeff Epler for
|
||||
* Adafruit Industries, with contributions from the open source community.
|
||||
*
|
||||
* BSD license, all text here must be included in any redistribution.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _PROTOMATTER_CORE_H_
|
||||
#define _PROTOMATTER_CORE_H_
|
||||
|
||||
|
|
@ -5,103 +21,240 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// Status type returned by some functions.
|
||||
/** Status type returned by some functions. */
|
||||
typedef enum {
|
||||
PROTOMATTER_OK, // Everything is hunky-dory!
|
||||
PROTOMATTER_ERR_PINS, // Clock and/or data pins on different PORTs
|
||||
PROTOMATTER_ERR_MALLOC, // Couldn't allocate memory for display
|
||||
PROTOMATTER_ERR_ARG, // Bad input to function
|
||||
PROTOMATTER_OK, // Everything is hunky-dory!
|
||||
PROTOMATTER_ERR_PINS, // Clock and/or data pins on different PORTs
|
||||
PROTOMATTER_ERR_MALLOC, // Couldn't allocate memory for display
|
||||
PROTOMATTER_ERR_ARG, // Bad input to function
|
||||
} ProtomatterStatus;
|
||||
|
||||
// Struct for matrix control lines NOT related to RGB data or clock, i.e.
|
||||
// latch, OE and address lines. RGB data and clock ("RGBC") are handled
|
||||
// differently as they have specific requirements (and might use a toggle
|
||||
// register if present). The data conversion functions need bitmasks for
|
||||
// RGB data but do NOT need the set or clear registers, so those items
|
||||
// are also declared as separate things in the core structure that follows.
|
||||
/** Struct for matrix control lines NOT related to RGB data or clock, i.e.
|
||||
latch, OE and address lines. RGB data and clock ("RGBC") are handled
|
||||
differently as they have specific requirements (and might use a toggle
|
||||
register if present). The data conversion functions need bitmasks for
|
||||
RGB data but do NOT need the set or clear registers, so those items are
|
||||
also declared as separate things in the core structure that follows. */
|
||||
typedef struct {
|
||||
volatile uint32_t *setReg; // GPIO bit set register
|
||||
volatile uint32_t *clearReg; // GPIO bit clear register
|
||||
uint32_t bit; // GPIO bitmask
|
||||
uint8_t pin; // Some identifier, e.g. Arduino pin #
|
||||
volatile void *setReg; ///< GPIO bit set register
|
||||
volatile void *clearReg; ///< GPIO bit clear register
|
||||
uint32_t bit; ///< GPIO bitmask
|
||||
uint8_t pin; ///< Some unique ID, e.g. Arduino pin #
|
||||
} _PM_pin;
|
||||
|
||||
// Struct with info about an RGB matrix chain and lots of state and buffer
|
||||
// details for the library. Toggle-related items in this structure MUST be
|
||||
// declared even if the device lacks GPIO bit-toggle registers (i.e. don't
|
||||
// do an ifdef check around these). All hardware-specific details (including
|
||||
// the presence or lack of toggle registers) are isolated to a single
|
||||
// file -- arch.h -- which should ONLY be included by core.c, and ifdef'ing
|
||||
// them would result in differing representations of this structure which
|
||||
// must be shared between the library and calling code. (An alternative is
|
||||
// to put any toggle-specific stuff at the end of the struct with an ifdef
|
||||
// check, but that's just dirty pool and asking for trouble.)
|
||||
/** Struct with info about an RGB matrix chain and lots of state and buffer
|
||||
details for the library. Toggle-related items in this structure MUST be
|
||||
declared even if the device lacks GPIO bit-toggle registers (i.e. don't
|
||||
do an ifdef check around these). All hardware-specific details (including
|
||||
the presence or lack of toggle registers) are isolated to a single
|
||||
file -- arch.h -- which should ONLY be included by core.c, and ifdef'ing
|
||||
them would result in differing representations of this structure which
|
||||
must be shared between the library and calling code. (An alternative is
|
||||
to put any toggle-specific stuff at the end of the struct with an ifdef
|
||||
check, but that's just dirty pool and asking for trouble.) */
|
||||
typedef struct {
|
||||
void *timer; // Arch-specific timer/counter info
|
||||
void *setReg; // RGBC bit set register (cast to use)
|
||||
void *clearReg; // RGBC bit clear register "
|
||||
void *toggleReg; // RGBC bit toggle register "
|
||||
uint8_t *rgbPins; // Array of RGB data pins (mult of 6)
|
||||
void *rgbMask; // PORT bit mask for each RGB pin
|
||||
uint32_t clockMask; // PORT bit mask for RGB clock
|
||||
uint32_t rgbAndClockMask; // PORT bit mask for RGB data + clock
|
||||
volatile uint32_t *addrPortToggle; // See singleAddrPort below
|
||||
void *screenData; // Per-bitplane RGB data for matrix
|
||||
_PM_pin latch; // RGB data latch
|
||||
_PM_pin oe; // !OE (LOW out enable)
|
||||
_PM_pin *addr; // Array of address pins
|
||||
uint32_t bufferSize; // Bytes per matrix buffer
|
||||
uint32_t bitZeroPeriod; // Bitplane 0 timer period
|
||||
uint32_t minPeriod; // Plane 0 timer period for ~250Hz
|
||||
volatile uint32_t frameCount; // For estimating refresh rate
|
||||
uint16_t width; // Matrix chain width in bits
|
||||
uint8_t bytesPerElement; // Using 8, 16 or 32 bits of PORT?
|
||||
uint8_t clockPin; // RGB clock pin identifier
|
||||
uint8_t parallel; // Number of concurrent matrix outs
|
||||
uint8_t numAddressLines; // Number of address line pins
|
||||
uint8_t portOffset; // Active 8- or 16-bit pos. in PORT
|
||||
uint8_t numPlanes; // Display bitplanes (1 to 6)
|
||||
uint8_t numRowPairs; // Addressable row pairs
|
||||
bool doubleBuffer; // 2X buffers for clean switchover
|
||||
bool singleAddrPort; // If 1, all addr lines on same PORT
|
||||
volatile uint8_t activeBuffer; // Index of currently-displayed buf
|
||||
volatile uint8_t plane; // Current bitplane (changes in ISR)
|
||||
volatile uint8_t row; // Current scanline (changes in ISR)
|
||||
volatile uint8_t prevRow; // Scanline from prior ISR
|
||||
volatile bool swapBuffers; // If 1, awaiting double-buf switch
|
||||
void *timer; ///< Arch-specific timer/counter info
|
||||
void *setReg; ///< RGBC bit set register (cast to use)
|
||||
void *clearReg; ///< RGBC bit clear register "
|
||||
void *toggleReg; ///< RGBC bit toggle register "
|
||||
uint8_t *rgbPins; ///< Array of RGB data pins (mult of 6)
|
||||
void *rgbMask; ///< PORT bit mask for each RGB pin
|
||||
uint32_t clockMask; ///< PORT bit mask for RGB clock
|
||||
uint32_t rgbAndClockMask; ///< PORT bit mask for RGB data + clock
|
||||
volatile void *addrPortToggle; ///< See singleAddrPort below
|
||||
void *screenData; ///< Per-bitplane RGB data for matrix
|
||||
_PM_pin latch; ///< RGB data latch
|
||||
_PM_pin oe; ///< !OE (LOW out enable)
|
||||
_PM_pin *addr; ///< Array of address pins
|
||||
uint32_t bufferSize; ///< Bytes per matrix buffer
|
||||
uint32_t bitZeroPeriod; ///< Bitplane 0 timer period
|
||||
uint32_t minPeriod; ///< Plane 0 timer period for ~250Hz
|
||||
volatile uint32_t frameCount; ///< For estimating refresh rate
|
||||
uint16_t width; ///< Matrix chain width in bits
|
||||
uint8_t bytesPerElement; ///< Using 8, 16 or 32 bits of PORT?
|
||||
uint8_t clockPin; ///< RGB clock pin identifier
|
||||
uint8_t parallel; ///< Number of concurrent matrix outs
|
||||
uint8_t numAddressLines; ///< Number of address line pins
|
||||
uint8_t portOffset; ///< Active 8- or 16-bit pos. in PORT
|
||||
uint8_t numPlanes; ///< Display bitplanes (1 to 6)
|
||||
uint8_t numRowPairs; ///< Addressable row pairs
|
||||
bool doubleBuffer; ///< 2X buffers for clean switchover
|
||||
bool singleAddrPort; ///< If 1, all addr lines on same PORT
|
||||
volatile uint8_t activeBuffer; ///< Index of currently-displayed buf
|
||||
volatile uint8_t plane; ///< Current bitplane (changes in ISR)
|
||||
volatile uint8_t row; ///< Current scanline (changes in ISR)
|
||||
volatile uint8_t prevRow; ///< Scanline from prior ISR
|
||||
volatile bool swapBuffers; ///< If 1, awaiting double-buf switch
|
||||
} Protomatter_core;
|
||||
|
||||
// Protomatter core function prototypes. Environment-specific code (like the
|
||||
// Adafruit_Protomatter class for Arduino) calls on these underlying things,
|
||||
// and has to provide a few extras of its own (interrupt handlers and such).
|
||||
// User code shouldn't need to invoke any of them directly.
|
||||
extern ProtomatterStatus _PM_init(Protomatter_core *core,
|
||||
uint16_t bitWidth, uint8_t bitDepth,
|
||||
uint8_t rgbCount, uint8_t *rgbList,
|
||||
uint8_t addrCount, uint8_t *addrList,
|
||||
uint8_t clockPin, uint8_t latchPin, uint8_t oePin,
|
||||
bool doubleBuffer, void *timer);
|
||||
extern ProtomatterStatus _PM_begin(Protomatter_core *core);
|
||||
extern void _PM_stop(Protomatter_core *core);
|
||||
extern void _PM_resume(Protomatter_core *core);
|
||||
extern void _PM_free(Protomatter_core *core);
|
||||
extern void _PM_row_handler(Protomatter_core *core);
|
||||
extern uint32_t _PM_getFrameCount(Protomatter_core *core);
|
||||
extern void _PM_timerStart(void *tptr, uint32_t period);
|
||||
extern uint32_t _PM_timerStop(void *tptr);
|
||||
extern uint32_t _PM_timerGetCount(void *tptr);
|
||||
|
||||
#if defined(ARDUINO)
|
||||
extern void _PM_convert_565_byte(Protomatter_core *core,
|
||||
uint16_t *source, uint16_t width);
|
||||
extern void _PM_convert_565_word(Protomatter_core *core,
|
||||
uint16_t *source, uint16_t width);
|
||||
extern void _PM_convert_565_long(Protomatter_core *core,
|
||||
uint16_t *source, uint16_t width);
|
||||
#endif // ARDUINO
|
||||
/*!
|
||||
@brief Initialize values in Protomatter_core structure.
|
||||
@param core Pointer to Protomatter_core structure.
|
||||
@param bitWidth Total width of RGB matrix chain, in pixels.
|
||||
Usu. some multiple of 32, but maybe exceptions.
|
||||
@param bitDepth Color "depth" in bitplanes, determines range of
|
||||
shades of red, green and blue. e.g. passing 4
|
||||
bits = 16 shades ea. R,G,B = 16x16x16 = 4096
|
||||
colors.
|
||||
@param rgbCount Number of "sets" of RGB data pins, each set
|
||||
containing 6 pins (2 ea. R,G,B). Typically 1,
|
||||
indicating a single matrix (or matrix chain).
|
||||
In theory (but not yet extensively tested),
|
||||
multiple sets of pins can be driven in parallel,
|
||||
up to 5 on some devices (if the hardware design
|
||||
provides all those bits on one PORT).
|
||||
@param rgbList A uint8_t array of pins (values are platform-
|
||||
dependent), 6X the prior rgbCount value,
|
||||
corresponding to the 6 output color bits for a
|
||||
matrix (or chain). Order is upper-half red, green,
|
||||
blue, lower-half red, green blue (repeat for each
|
||||
add'l chain). All the RGB pins (plus the clock pin
|
||||
below on some architectures) MUST be on the same
|
||||
PORT register. It's recommended (but not required)
|
||||
that all RGB pins (and clock depending on arch) be
|
||||
within the same byte of a PORT (but do not need to
|
||||
be sequential or contiguous within that byte) for
|
||||
more efficient RAM utilization. For two concurrent
|
||||
chains, same principle but 16-bit word.
|
||||
@param addrCount Number of row address lines required of matrix.
|
||||
Total pixel height is then 2 x 2^addrCount, e.g.
|
||||
32-pixel-tall matrices have 4 row address lines.
|
||||
@param addrList A uint8_t array of pins (platform-dependent pin
|
||||
numbering), one per row address line.
|
||||
@param clockPin RGB clock pin (platform-dependent pin #).
|
||||
@param latchPin RGB data latch pin (platform-dependent pin #).
|
||||
@param oePin Output enable pin (platform-dependent pin #),
|
||||
active low.
|
||||
@param doubleBuffer If true, two matrix buffers are allocated,
|
||||
so changing display contents doesn't introduce
|
||||
artifacts mid-conversion. Requires ~2X RAM.
|
||||
@param timer Pointer to timer peripheral or timer-related
|
||||
struct (architecture-dependent), or NULL to
|
||||
use a default timer ID (also arch-dependent).
|
||||
@return A ProtomatterStatus status, one of:
|
||||
PROTOMATTER_OK if everything is good.
|
||||
PROTOMATTER_ERR_PINS if data and/or clock pins are split across
|
||||
different PORTs.
|
||||
PROTOMATTER_ERR_MALLOC if insufficient RAM to allocate display
|
||||
memory.
|
||||
PROTOMATTER_ERR_ARG if a bad value (core or timer pointer) was
|
||||
passed in.
|
||||
*/
|
||||
extern ProtomatterStatus _PM_init(Protomatter_core *core, uint16_t bitWidth,
|
||||
uint8_t bitDepth, uint8_t rgbCount,
|
||||
uint8_t *rgbList, uint8_t addrCount,
|
||||
uint8_t *addrList, uint8_t clockPin,
|
||||
uint8_t latchPin, uint8_t oePin,
|
||||
bool doubleBuffer, void *timer);
|
||||
|
||||
/*!
|
||||
@brief Allocate display buffers and populate additional elements of a
|
||||
Protomatter matrix.
|
||||
@param core Pointer to Protomatter_core structure.
|
||||
@return A ProtomatterStatus status, one of:
|
||||
PROTOMATTER_OK if everything is good.
|
||||
PROTOMATTER_ERR_PINS if data and/or clock pins are split across
|
||||
different PORTs.
|
||||
PROTOMATTER_ERR_MALLOC if insufficient RAM to allocate display
|
||||
memory.
|
||||
PROTOMATTER_ERR_ARG if a bad value.
|
||||
*/
|
||||
extern ProtomatterStatus _PM_begin(Protomatter_core *core);
|
||||
|
||||
/*!
|
||||
@brief Disable (but do not deallocate) a Protomatter matrix. Disables
|
||||
matrix by setting OE pin HIGH and writing all-zero data to
|
||||
matrix shift registers, so it won't halt with lit LEDs.
|
||||
@param core Pointer to Protomatter_core structure.
|
||||
*/
|
||||
extern void _PM_stop(Protomatter_core *core);
|
||||
|
||||
/*!
|
||||
@brief Start or restart a matrix. Initialize counters, configure and
|
||||
start timer.
|
||||
@param core Pointer to Protomatter_core structure.
|
||||
*/
|
||||
extern void _PM_resume(Protomatter_core *core);
|
||||
|
||||
/*!
|
||||
@brief Deallocate memory associated with Protomatter_core structure
|
||||
(e.g. screen data, pin lists for data and rows). Does not
|
||||
deallocate the structure itself.
|
||||
@param core Pointer to Protomatter_core structure.
|
||||
*/
|
||||
extern void _PM_free(Protomatter_core *core);
|
||||
|
||||
/*!
|
||||
@brief Matrix "row handler" that's called by the timer interrupt.
|
||||
Handles row address lines and issuing data to matrix.
|
||||
@param core Pointer to Protomatter_core structure.
|
||||
*/
|
||||
extern void _PM_row_handler(Protomatter_core *core);
|
||||
|
||||
/*!
|
||||
@brief Returns current value of frame counter and resets its value to
|
||||
zero. Two calls to this, timed one second apart (or use math with
|
||||
other intervals), can be used to get a rough frames-per-second
|
||||
value for the matrix (since this is difficult to estimate
|
||||
beforehand).
|
||||
@param core Pointer to Protomatter_core structure.
|
||||
@return Frame count since previous call to function, as a uint32_t.
|
||||
*/
|
||||
extern uint32_t _PM_getFrameCount(Protomatter_core *core);
|
||||
|
||||
/*!
|
||||
@brief Start (or restart) a timer/counter peripheral.
|
||||
@param tptr Pointer to timer/counter peripheral OR a struct
|
||||
encapsulating information about a timer/counter
|
||||
periph (architecture-dependent).
|
||||
@param period Timer 'top' / rollover value.
|
||||
*/
|
||||
extern void _PM_timerStart(void *tptr, uint32_t period);
|
||||
|
||||
/*!
|
||||
@brief Stop timer/counter peripheral.
|
||||
@param tptr Pointer to timer/counter peripheral OR a struct
|
||||
encapsulating information about a timer/counter
|
||||
periph (architecture-dependent).
|
||||
@return Counter value when timer was stopped.
|
||||
*/
|
||||
extern uint32_t _PM_timerStop(void *tptr);
|
||||
|
||||
/*!
|
||||
@brief Query a timer/counter peripheral's current count.
|
||||
@param tptr Pointer to timer/counter peripheral OR a struct
|
||||
encapsulating information about a timer/counter
|
||||
periph (architecture-dependent).
|
||||
@return Counter value.
|
||||
*/
|
||||
extern uint32_t _PM_timerGetCount(void *tptr);
|
||||
|
||||
/*!
|
||||
@brief Converts image data from GFX16 canvas to the matrices weird
|
||||
internal format.
|
||||
@param core Pointer to Protomatter_core structure.
|
||||
@param source Pointer to source image data (see Adafruit_GFX 16-bit
|
||||
canvas type for format).
|
||||
@param width Width of canvas in pixels, as this may be different than
|
||||
the matrix pixel width due to row padding.
|
||||
*/
|
||||
extern void _PM_convert_565(Protomatter_core *core, uint16_t *source,
|
||||
uint16_t width);
|
||||
|
||||
/*!
|
||||
@brief Pauses until the next vertical blank to avoid 'tearing' animation
|
||||
(if display is double-buffered). If single-buffered, has no effect.
|
||||
@param core Pointer to Protomatter_core structure.
|
||||
*/
|
||||
extern void _PM_swapbuffer_maybe(Protomatter_core *core);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
|
|
|||
|
|
@ -41,6 +41,26 @@ PA05 A4 PA13 PA21 D7 PB05 PB13
|
|||
PA06 PA14 PA22 SDA PB06 PB14
|
||||
PA07 D9 PA15 D5 PA23 SCL PB07 PB15
|
||||
|
||||
FEATHER nRF52840:
|
||||
P0.00 P0.08 D12 P0.24 RXD P1.08 D5
|
||||
P0.01 P0.09 P0.25 TXD P1.09 D13
|
||||
P0.02 A4 P0.10 D2 (NFC) P0.26 D9 P1.10
|
||||
P0.03 A5 P0.11 SCL P0.27 D10 P1.11
|
||||
P0.04 A0 P0.12 SDA P0.28 A3 P1.12
|
||||
P0.05 A1 P0.13 MOSI P0.29 P1.13
|
||||
P0.06 D11 P0.14 SCK P0.30 A2 P1.14
|
||||
P0.07 D6 P0.15 MISO P0.31 P1.15
|
||||
|
||||
FEATHER ESP32:
|
||||
P0.00 P0.08 P0.16 16/RX P0.24 P1.00 32/A7
|
||||
P0.01 P0.09 P0.17 17/TX P0.25 25/A1 P1.01 33/A9/SS
|
||||
P0.02 P0.10 P0.18 18/MOSI P0.26 26/A0 P1.02 34/A2 (in)
|
||||
P0.03 P0.11 P0.19 19/MISO P0.27 27/A10 P1.03
|
||||
P0.04 4/A5 P0.12 12/A11 P0.20 P0.28 P1.04 36/A4 (in)
|
||||
P0.05 5/SCK P0.13 13/A12 P0.21 21 P0.29 P1.05
|
||||
P0.06 P0.14 14/A6 P0.22 22/SCL P0.30 P1.06
|
||||
P0.07 P0.15 15/A8 P0.23 23/SDA P0.31 P1.07 39/A3 (in)
|
||||
|
||||
RGB Matrix FeatherWing:
|
||||
R1 D6 A A5
|
||||
G1 D5 B A4
|
||||
|
|
@ -55,6 +75,7 @@ the code could run there (with some work to be done in the convert_*
|
|||
functions), but would be super RAM-inefficient. Should be fine on other
|
||||
M0 devices like a Metro, if wiring manually so one can pick a contiguous
|
||||
byte of PORT bits.
|
||||
RGB+clock are on different PORTs on nRF52840.
|
||||
*/
|
||||
|
||||
#if defined(__SAMD51__)
|
||||
|
|
@ -64,12 +85,41 @@ byte of PORT bits.
|
|||
uint8_t clockPin = 13;
|
||||
uint8_t latchPin = 0;
|
||||
uint8_t oePin = 1;
|
||||
#else // SAMD21
|
||||
#elif defined(_SAMD21_)
|
||||
uint8_t rgbPins[] = {6, 7, 10, 11, 12, 13};
|
||||
uint8_t addrPins[] = {0, 1, 2, 3};
|
||||
uint8_t clockPin = SDA;
|
||||
uint8_t latchPin = 4;
|
||||
uint8_t oePin = 5;
|
||||
#elif defined(NRF52_SERIES)
|
||||
// Special nRF52840 FeatherWing pinout
|
||||
uint8_t rgbPins[] = {6, A5, A1, A0, A4, 11};
|
||||
uint8_t addrPins[] = {10, 5, 13, 9};
|
||||
uint8_t clockPin = 12;
|
||||
uint8_t latchPin = PIN_SERIAL1_RX;
|
||||
uint8_t oePin = PIN_SERIAL1_TX;
|
||||
#elif defined(ESP32)
|
||||
// 'Safe' pins (not overlapping any peripherals):
|
||||
// GPIO.out: 4, 12, 13, 14, 15, 21, 27, GPIO.out1: 32, 33
|
||||
// Peripheral-overlapping pins, sorted from 'most expendible':
|
||||
// 16, 17 (RX, TX), 25, 26 (A0, A1), 18, 5, 9 (MOSI, SCK, MISO), 22, 23 (SCL, SDA)
|
||||
uint8_t rgbPins[] = {4, 12, 13, 14, 15, 21};
|
||||
uint8_t addrPins[] = {16, 17, 25, 26};
|
||||
uint8_t clockPin = 27; // Must be on same port as rgbPins
|
||||
uint8_t latchPin = 32;
|
||||
uint8_t oePin = 33;
|
||||
#elif defined(ARDUINO_TEENSY40)
|
||||
uint8_t rgbPins[] = {15, 16, 17, 20, 21, 22}; // A1-A3, A6-A8, skips SDA,SCL
|
||||
uint8_t addrPins[] = {2, 3, 4, 5};
|
||||
uint8_t clockPin = 23; // A9
|
||||
uint8_t latchPin = 6;
|
||||
uint8_t oePin = 9;
|
||||
#elif defined(ARDUINO_TEENSY41)
|
||||
uint8_t rgbPins[] = {26, 27, 38, 20, 21, 22}; // A12-14, A6-A8 (yes that's a 38, NOT 28!)
|
||||
uint8_t addrPins[] = {2, 3, 4, 5};
|
||||
uint8_t clockPin = 23; // A9
|
||||
uint8_t latchPin = 6;
|
||||
uint8_t oePin = 9;
|
||||
#endif
|
||||
|
||||
// Last arg here enables double-buffering
|
||||
|
|
|
|||
|
|
@ -41,6 +41,26 @@ PA05 A4 PA13 PA21 D7 PB05 PB13
|
|||
PA06 PA14 PA22 SDA PB06 PB14
|
||||
PA07 D9 PA15 D5 PA23 SCL PB07 PB15
|
||||
|
||||
FEATHER nRF52840:
|
||||
P0.00 P0.08 D12 P0.24 RXD P1.08 D5
|
||||
P0.01 P0.09 P0.25 TXD P1.09 D13
|
||||
P0.02 A4 P0.10 D2 (NFC) P0.26 D9 P1.10
|
||||
P0.03 A5 P0.11 SCL P0.27 D10 P1.11
|
||||
P0.04 A0 P0.12 SDA P0.28 A3 P1.12
|
||||
P0.05 A1 P0.13 MOSI P0.29 P1.13
|
||||
P0.06 D11 P0.14 SCK P0.30 A2 P1.14
|
||||
P0.07 D6 P0.15 MISO P0.31 P1.15
|
||||
|
||||
FEATHER ESP32:
|
||||
P0.00 P0.08 P0.16 16/RX P0.24 P1.00 32/A7
|
||||
P0.01 P0.09 P0.17 17/TX P0.25 25/A1 P1.01 33/A9/SS
|
||||
P0.02 P0.10 P0.18 18/MOSI P0.26 26/A0 P1.02 34/A2 (in)
|
||||
P0.03 P0.11 P0.19 19/MISO P0.27 27/A10 P1.03
|
||||
P0.04 4/A5 P0.12 12/A11 P0.20 P0.28 P1.04 36/A4 (in)
|
||||
P0.05 5/SCK P0.13 13/A12 P0.21 21 P0.29 P1.05
|
||||
P0.06 P0.14 14/A6 P0.22 22/SCL P0.30 P1.06
|
||||
P0.07 P0.15 15/A8 P0.23 23/SDA P0.31 P1.07 39/A3 (in)
|
||||
|
||||
RGB Matrix FeatherWing:
|
||||
R1 D6 A A5
|
||||
G1 D5 B A4
|
||||
|
|
@ -55,6 +75,7 @@ the code could run there (with some work to be done in the convert_*
|
|||
functions), but would be super RAM-inefficient. Should be fine on other
|
||||
M0 devices like a Metro, if wiring manually so one can pick a contiguous
|
||||
byte of PORT bits.
|
||||
RGB+clock are on different PORTs on nRF52840.
|
||||
*/
|
||||
|
||||
#if defined(__SAMD51__)
|
||||
|
|
@ -64,12 +85,41 @@ byte of PORT bits.
|
|||
uint8_t clockPin = 13;
|
||||
uint8_t latchPin = 0;
|
||||
uint8_t oePin = 1;
|
||||
#else // SAMD21
|
||||
#elif defined(_SAMD21_)
|
||||
uint8_t rgbPins[] = {6, 7, 10, 11, 12, 13};
|
||||
uint8_t addrPins[] = {0, 1, 2, 3};
|
||||
uint8_t clockPin = SDA;
|
||||
uint8_t latchPin = 4;
|
||||
uint8_t oePin = 5;
|
||||
#elif defined(NRF52_SERIES)
|
||||
// Special nRF52840 FeatherWing pinout
|
||||
uint8_t rgbPins[] = {6, A5, A1, A0, A4, 11};
|
||||
uint8_t addrPins[] = {10, 5, 13, 9};
|
||||
uint8_t clockPin = 12;
|
||||
uint8_t latchPin = PIN_SERIAL1_RX;
|
||||
uint8_t oePin = PIN_SERIAL1_TX;
|
||||
#elif defined(ESP32)
|
||||
// 'Safe' pins (not overlapping any peripherals):
|
||||
// GPIO.out: 4, 12, 13, 14, 15, 21, 27, GPIO.out1: 32, 33
|
||||
// Peripheral-overlapping pins, sorted from 'most expendible':
|
||||
// 16, 17 (RX, TX), 25, 26 (A0, A1), 18, 5, 9 (MOSI, SCK, MISO), 22, 23 (SCL, SDA)
|
||||
uint8_t rgbPins[] = {4, 12, 13, 14, 15, 21};
|
||||
uint8_t addrPins[] = {16, 17, 25, 26};
|
||||
uint8_t clockPin = 27; // Must be on same port as rgbPins
|
||||
uint8_t latchPin = 32;
|
||||
uint8_t oePin = 33;
|
||||
#elif defined(ARDUINO_TEENSY40)
|
||||
uint8_t rgbPins[] = {15, 16, 17, 20, 21, 22}; // A1-A3, A6-A8, skips SDA,SCL
|
||||
uint8_t addrPins[] = {2, 3, 4, 5};
|
||||
uint8_t clockPin = 23; // A9
|
||||
uint8_t latchPin = 6;
|
||||
uint8_t oePin = 9;
|
||||
#elif defined(ARDUINO_TEENSY41)
|
||||
uint8_t rgbPins[] = {26, 27, 38, 20, 21, 22}; // A12-14, A6-A8 (yes that's a 38, NOT 28!)
|
||||
uint8_t addrPins[] = {2, 3, 4, 5};
|
||||
uint8_t clockPin = 23; // A9
|
||||
uint8_t latchPin = 6;
|
||||
uint8_t oePin = 9;
|
||||
#endif
|
||||
|
||||
Adafruit_Protomatter matrix(
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
name=Adafruit Protomatter
|
||||
version=0.0.0
|
||||
version=1.0.3
|
||||
author=Adafruit
|
||||
maintainer=Adafruit <info@adafruit.com>
|
||||
sentence=This is a library for the Adafruit RGB LED matrix.
|
||||
paragraph=RGB LED matrix.
|
||||
category=Display
|
||||
url=https://github.com/adafruit/Adafruit_protomatter
|
||||
architectures=*
|
||||
architectures=samd,nrf52,stm32,esp32
|
||||
depends=Adafruit GFX Library
|
||||
|
|
|
|||
Loading…
Reference in a new issue