How to configure SET & CLR for SAMD21E15B?
Closed this issue · 2 comments
RojasMilo commented
Soldia1138 commented
There are two errors in your line:
PORT->Group[0]->OUTSET.bit[14]
isn't the correct syntax.
First of all the OUTSET is part of the Group struct, so it should be
PORT->Group[0].OUTSET
The next one is the bit address. You need to either address the bit (bit) itself or the whole register (reg). Technically it doesn't really matter, because it is a union the definition is:
typedef union {
struct {
uint32_t OUTSET:32; /*!< bit: 0..31 Port Data Output Value Set */
} bit; /*!< Structure used for bit access */
uint32_t reg; /*!< Type used for register access */
} PORT_OUTSET_Type;
So you can either type:
PORT->Group[0].OUTSET.reg = PORT_PA14;
or
PORT->Group[0].OUTSET.bit.OUTSET = PORT_PA14;
cpldcpu commented
Thanks to soldia for solving this. Closing.