Hi,
I've got a custom board with a SAMD21 E18A on it. I want to program it using Platform IO (VS Code) and want to be able to use Arduino libraries.
Since I couldn't find a custom board board, I went with adafruit_trinket_m0.
Now I wan't to toggle IOs PA05 to PA07 but I can't find their names. How do I refer to an IO like PA05?!
Actually PA08 is toggled instead of PA05.
The pin definitions from samd21e18a.h are not very helpful:
...
#define PIN_PA05 5 /**< \brief Pin Number for PA05 */
#define PORT_PA05 (1ul << 5) /**< \brief PORT Mask for PA05 */
#define PIN_PA06 6 /**< \brief Pin Number for PA06 */
#define PORT_PA06 (1ul << 6) /**< \brief PORT Mask for PA06 */
#define PIN_PA07 7 /**< \brief Pin Number for PA07 */
#define PORT_PA07 (1ul << 7) /**< \brief PORT Mask for PA07 */
Guess these are just the bit positions in the actual port register and are not meant to be used as pin names in the Arduino world.
When I use this:
#define LED_R 4 // actually PA06 by measurement
#define LED_G PIN_PA05 // actually PA08 by measurement
#define LED_B 3 // actually PA07 by measurement
It actually works. 3/4 are the pin labels used by the adafruit trinket M0. But the problem is, the trinket only has 5 IOs and PA05 isn't one of them.
All the SAMD21 E18A boards available only have a hand full of IOs broken out.
Isn't there a way to use the SAMD21 without writing my own board definition?
Hi, I've got a custom board with a SAMD21 E18A on it. I want to program it using Platform IO (VS Code) and want to be able to use Arduino libraries. Since I couldn't find a
custom board
board, I went withadafruit_trinket_m0
. Now I wan't to toggle IOsPA05
toPA07
but I can't find their names. How do I refer to an IO likePA05
?!This is my
platformio.ini
:This is my code:
Actually
PA08
is toggled instead ofPA05
. The pin definitions fromsamd21e18a.h
are not very helpful:Guess these are just the bit positions in the actual port register and are not meant to be used as pin names in the Arduino world. When I use this:
It actually works. 3/4 are the pin labels used by the adafruit trinket M0. But the problem is, the trinket only has 5 IOs and
PA05
isn't one of them.All the SAMD21 E18A boards available only have a hand full of IOs broken out. Isn't there a way to use the SAMD21 without writing my own board definition?