AnsweredAssumed Answered

Stm8 touch library

Question asked by dobhal.puneet on May 7, 2014
I intend to implement a single touch key using stm8 touch library. I am having few issues regarding this.

I haven't used the shield concept for noise immunity, so what does a need to define for : SCKEY_P2_DRIVEN_SHIELD_MASK in the configuration file.

#include"stm8s.h"
#include"stm8_tsl_api.h"


#define LED1_GPIO_PORT             (GPIOB)
#define LED1_GPIO_PIN             (GPIO_PIN_4)




void main()
{
  LED1_GPIO_PORT->ODR |= (uint8_t)(LED1_GPIO_PIN);
  LED1_GPIO_PORT->DDR |= (uint8_t)(LED1_GPIO_PIN);
  LED1_GPIO_PORT->CR1 |= (uint8_t)(LED1_GPIO_PIN);
  LED1_GPIO_PORT->CR2 &= (uint8_t)(~(LED1_GPIO_PIN));
  
  TSL_Init();
  sSCKeyInfo[0].Setting.b.IMPLEMENTED = 1;
  sSCKeyInfo[0].Setting.b.ENABLED = 1;
  sSCKeyInfo[0].DxSGroup = 0x01;
  while(1)
  {
    TSL_Action();
    if (sSCKeyInfo[0].Setting.b.DETECTED)
    {
    LED1_GPIO_PORT->ODR &= ~(uint8_t)(LED1_GPIO_PIN);  
    }
    
    else
    {
    LED1_GPIO_PORT->ODR |= (uint8_t)(LED1_GPIO_PIN);  
    }
    
  }
}



Also here is the main file code , I am not too clear about the validity of this code too. Please provide me help on this issue.

Thank you.

Outcomes