AnsweredAssumed Answered

STM8L151F3 touch library 1.1.0

Question asked by fairlane.ford on Jun 7, 2017

¿Has anybody succeeded in using STM8 touch library with STM8L151F3?, I'm having problems getting it working with HW adquisition, I have ported STM8L151C3_Ex01 to my board and the touch pins are at 0v all the time.

My board has just 2 touch buttons on PB4 and PB5, sampling capacitor is connected to PB6, all of them belong to group 5.

This is how library is configured:

#define TSLPRM_TOTAL_CHANNELS (2)

#define TSLPRM_TOTAL_BANKS (2)

#define TSLPRM_TOTAL_TOUCHKEYS (0)

#define TSLPRM_TOTAL_TOUCHKEYS_B (2)

#define TSLPRM_TOTAL_LINROTS (0)

#define TSLPRM_TOTAL_LINROTS_B (0)

#define TSLPRM_TOTAL_OBJECTS (2)

#define TSLPRM_TICK_FREQ (1000)

#define TSLPRM_USE_SHIELD (0)

#define CHANNEL_0_SRC ((uint8_t)(GR5))
#define CHANNEL_0_DEST (0)
#define CHANNEL_0_SAMPLE (PB6)
#define CHANNEL_0_CHANNEL (PB4)

#define CHANNEL_1_SRC ((uint8_t)(GR5))
#define CHANNEL_1_DEST (1)
#define CHANNEL_1_SAMPLE (PB6)
#define CHANNEL_1_CHANNEL (PB5)

#define BANK_0_NBCHANNELS (1)
#define BANK_0_SHIELD_SAMPLE (0)
#define BANK_0_SHIELD_CHANNEL (0)

#define BANK_1_NBCHANNELS (1)
#define BANK_1_SHIELD_SAMPLE (0)
#define BANK_1_SHIELD_CHANNEL (0)

CONST TSL_ChannelSrc_T MyChannels_Src[TSLPRM_TOTAL_CHANNELS] ={
   { CHANNEL_0_SRC, CHANNEL_0_SAMPLE, CHANNEL_0_CHANNEL },
   { CHANNEL_1_SRC, CHANNEL_1_SAMPLE, CHANNEL_1_CHANNEL },
};

CONST TSL_ChannelDest_T MyChannels_Dest[TSLPRM_TOTAL_CHANNELS] ={
   { CHANNEL_0_DEST },
   { CHANNEL_1_DEST },
};

CONST TSL_Bank_T MyBanks[TSLPRM_TOTAL_BANKS] ={
   {&MyChannels_Src[0], &MyChannels_Dest[0], MyChannels_Data, BANK_0_NBCHANNELS, BANK_0_SHIELD_SAMPLE, BANK_0_SHIELD_CHANNEL},
   {&MyChannels_Src[1], &MyChannels_Dest[1], MyChannels_Data, BANK_1_NBCHANNELS, BANK_1_SHIELD_SAMPLE, BANK_1_SHIELD_CHANNEL},
};

TSL_tIndex_T MyBankSorting[TSLPRM_TOTAL_BANKS] = {0, 1};

CONST TSL_TouchKeyB_T MyTKeysB[TSLPRM_TOTAL_TOUCHKEYS_B] ={
   { &MyTKeysData[0], &MyTKeysParams[0], &MyChannels_Data[CHANNEL_0_DEST] },//banco 0 0
   { &MyTKeysData[1], &MyTKeysParams[1], &MyChannels_Data[CHANNEL_1_DEST] },//banco 1 0
};

CONST TSL_Object_T MyObjects[TSLPRM_TOTAL_OBJECTS] ={
   { TSL_OBJ_TOUCHKEYB, (TSL_TouchKeyB_T *)&MyTKeysB[0] },
   { TSL_OBJ_TOUCHKEYB, (TSL_TouchKeyB_T *)&MyTKeysB[1] },
};

Is there anything wrong?

Thank you in advance

Outcomes