I'm hacking on my Curiosity Nano with atmega4809. I'm trying to set up TCA0 to toggle pin 5 on port F (the user LED).
The 0-series datasheet indicates I can direct TCA0 output to PORTF via PORTMUX.TCAROUTEA = PORTMUX_TCA0_PORTF_gc;
The include file thinks the three bits for CMP[2:0]EN are independent pin bits, which does not make sense.
The 0-series datasheet (in TCA CTRLB section) is ambiguous IMO (see below).
I think that I should be able to set CtRLB.CMP[2:0]EN to 5 to select pin 5.
EDIT: That is, it makes more sense to me to have 3 bits indicate which single pin of a port should be output rather than independent control of only 3/8 pins of a port.
What do you think?
#define TCA_SINGLE_CMP0EN_bm 0x10 /* Compare 0 Enable bit mask. */ #define TCA_SINGLE_CMP0EN_bp 4 /* Compare 0 Enable bit position. */ #define TCA_SINGLE_CMP1EN_bm 0x20 /* Compare 1 Enable bit mask. */ #define TCA_SINGLE_CMP1EN_bp 5 /* Compare 1 Enable bit position. */ #define TCA_SINGLE_CMP2EN_bm 0x40 /* Compare 2 Enable bit mask. */ #define TCA_SINGLE_CMP2EN_bp 6 /* Compare 2 Enable bit position. */