For Teensy 3, in mk20dx128.h, there is:
and
so one can write statements such as
without having to worry about pointer details.
Is there any way to set up a variable FTM_CNT, such that it will behave as FTM1_CNT or FTM2_CNT depending on a selection variable? Behave such that pointer de-referencing is done automatically as with the existing FTM1_CNT and FTM2_CNT?
Explicitly de-referencing all the register accesses is by no means the end of the world, but I thought I would check if there is some C++ trick that I don't know about.
I want to set up a class that uses the same functions instantiated with either FTM1 or FTM2.
Thanks,
TLB
Code:
#define FTM1_CNT *(volatile uint32_t *)0x40039004 // Counter
Code:
#define FTM2_CNT *(volatile uint32_t *)0x400B8004 // Counter
so one can write statements such as
Code:
Posn=FTM1_CNT;
without having to worry about pointer details.
Is there any way to set up a variable FTM_CNT, such that it will behave as FTM1_CNT or FTM2_CNT depending on a selection variable? Behave such that pointer de-referencing is done automatically as with the existing FTM1_CNT and FTM2_CNT?
Explicitly de-referencing all the register accesses is by no means the end of the world, but I thought I would check if there is some C++ trick that I don't know about.
I want to set up a class that uses the same functions instantiated with either FTM1 or FTM2.
Thanks,
TLB