The Arduino writes an arbitrary 8 bit value to PORTD, using 8 digital output pins. The command to set the register is very simple, but since Arduino is supposed to be simplified code I'm not sure if it's setting and resetting the bits, or just setting them. I'll elaborate on this below.
I looked into adapting this for the green "black pill" board and am a little confused as to what to do. The following link contains instructions for setting the GPIO registers on the Blue Pill: https://gist.github.com/iwalpola/6c36c9 ... 0a118571ca
Here's where a couple of my questions begin. The first and most general question is, what is the best method to replicate the ATMEGA328P based sample code attached? Is it sufficient to write just the lower 8 bits in the register using ODR, or would I need to reset the bits for each cycle using BSRR and BRR?
From a previous post, I saw that there's a different syntax for the Black Pill boards, where on the Blue Pill would be:
Code: Select all
GPIOA->regs->ODR = 0b0011000000000100; //note, binary
Code: Select all
GPIOA->ODR = 0b0011000000000100;
Code: Select all
GPIOA->BSRR...
Thanks in advance!