Created
April 29, 2020 13:35
-
-
Save nanase/c9c3f48da9fa895e476addf0db512a5e to your computer and use it in GitHub Desktop.
Manipulating PA30 and PA31 pins on Seeeduino XIAO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
// instead of pinMode(30, OUTPUT); | |
(&(PORT->Group[PORTA]))->PINCFG[30].reg = (uint8_t)(PORT_PINCFG_INEN); | |
(&(PORT->Group[PORTA]))->PINCFG[31].reg = (uint8_t)(PORT_PINCFG_INEN); | |
(&(PORT->Group[PORTA]))->DIRSET.reg = (1 << 30); | |
(&(PORT->Group[PORTA]))->DIRSET.reg = (1 << 31); | |
} | |
void loop() { | |
// instead of digitalWrite(30, HIGH); | |
(&(PORT->Group[PORTA]))->OUTSET.reg = (1 << 30); | |
(&(PORT->Group[PORTA]))->OUTSET.reg = (1 << 31); | |
delay(1000); | |
// instead of digitalWrite(30, LOW); | |
(&(PORT->Group[PORTA]))->OUTCLR.reg = (1 << 30); | |
(&(PORT->Group[PORTA]))->OUTCLR.reg = (1 << 31); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment