CubeMX - TSC banks configuration
Hi,
I'm configuring the CubeMX for an application with 5 capacitive sensors.
I used G1_IO1 and G1_IO2 for two sensors, and G1_IO3 for the sampling capacitor of G1. The other three sensors are on G4_IO1, G4_IO2 and G4_IO3, with the sampling capacitor on G4_IO4.
The active shield is configured on G3_IO2 with the sampling cap on G3_IO3.
I would like to define banks to sample G1_IO1 at the same time as G4_IO1 (and shield), and G1_IO2 with G4_IO2 (and shield). The third bank will be a single channel (G4_IO3).
I was actually able to set it in the tsl_user.h as
#define CHANNEL_0_IO_MSK (TSC_GROUP1_IO1)
#define CHANNEL_0_GRP_MSK (TSC_GROUP1)
#define CHANNEL_0_SRC (TSC_GROUP1_IDX) /* Index in source register (TSC->IOGXCR[]) */
#define CHANNEL_0_DEST (0) /* Index in destination result array */
#define CHANNEL_1_IO_MSK (TSC_GROUP1_IO2)
#define CHANNEL_1_GRP_MSK (TSC_GROUP1)
#define CHANNEL_1_SRC (TSC_GROUP1_IDX)
#define CHANNEL_1_DEST (1)
#define CHANNEL_2_IO_MSK (TSC_GROUP4_IO1)
#define CHANNEL_2_GRP_MSK (TSC_GROUP4)
#define CHANNEL_2_SRC (TSC_GROUP4_IDX)
#define CHANNEL_2_DEST (2)
#define CHANNEL_3_IO_MSK (TSC_GROUP4_IO2)
#define CHANNEL_3_GRP_MSK (TSC_GROUP4)
#define CHANNEL_3_SRC (TSC_GROUP4_IDX)
#define CHANNEL_3_DEST (3)
#define CHANNEL_4_IO_MSK (TSC_GROUP4_IO3)
#define CHANNEL_4_GRP_MSK (TSC_GROUP4)
#define CHANNEL_4_SRC (TSC_GROUP4_IDX)
#define CHANNEL_4_DEST (4)
#define BANK_0_NBCHANNELS (1)
#define BANK_0_MSK_CHANNELS (CHANNEL_0_IO_MSK | CHANNEL_2_IO_MSK | SHIELD_IO_MSK)
#define BANK_0_MSK_GROUPS (CHANNEL_0_GRP_MSK | CHANNEL_2_GRP_MSK)
#define BANK_1_NBCHANNELS (2)
#define BANK_1_MSK_CHANNELS (CHANNEL_1_IO_MSK | CHANNEL_3_IO_MSK | SHIELD_IO_MSK)
#define BANK_1_MSK_GROUPS (CHANNEL_1_GRP_MSK | CHANNEL_3_GRP_MSK)
#define BANK_2_NBCHANNELS (1)
#define BANK_2_MSK_CHANNELS (CHANNEL_4_IO_MSK | SHIELD_IO_MSK)
#define BANK_2_MSK_GROUPS (CHANNEL_4_GRP_MSK)
But the code is not between
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
so I suppose that every time I generate code from CubeMX I will have to do the same configuration again.
Is there a way to set these banks in CubeMX directly and let it generate the code?
Thank you.
