Hi Dekiru,
first of all, thanks for your patience.
My code is really simple:
tss is the same of the KwikStick demo code, and the same for drivers directory (therefore including _Electrode_Init function).
My Main file is pretty dummy and it follows.
Thanks for your help
Mik
/****************************************************************************
*
* This file contains MQX only stationery code.
*
****************************************************************************/
#include "main.h"
#include "TSS_API.h"
#include "Driver_SLCD.h"
#include "Driver_Electrodes.h"
#if !BSPCFG_ENABLE_IO_SUBSYSTEM
#error This application requires BSPCFG_ENABLE_IO_SUBSYSTEM defined non-zero in user_config.h. Please recompile BSP with this option.
#endif
#ifndef BSP_DEFAULT_IO_CHANNEL_DEFINED
#error This application requires BSP_DEFAULT_IO_CHANNEL to be not NULL. Please set corresponding BSPCFG_ENABLE_TTYx to non-zero in user_config.h and recompile BSP with this option.
#endif
const STRING HELLO = "HELLO";
const STRING INITIALIZING = "INIT";
const STRING DBG = "DBG";
TASK_TEMPLATE_STRUCT MQX_template_list[] =
{
/* Task number, Entry point, Stack, Pri, String, Auto? */
{MAIN_TASK, Main_task, 1500, 9, "main", MQX_AUTO_START_TASK},
{0, 0, 0, 0, 0, 0, }
};
void SystemInit();
void _MainMenu_Electrode_Check();
U08 OptionIndex = 0;
S16 MarqueePosition = 256;
BOOL isMarqueeInitialDelay = TRUE;
BOOL isLoopComplete = FALSE;
/*TASK*-----------------------------------------------------
*
* Task Name : Main_task
* Comments :
* This task prints " Hello World "
*
*END*-----------------------------------------------------*/
void Main_task(uint_32 initial_data)
{
unsigned int counter = 0;
static StateMachine SM = INIT;
printf("\n Hello World \n");
//Initialize the Segment LCD
_SLCDModule_Init();
_SLCDMoudle_TurnOffAllSegments();
_SLCDModule_PrintScrolling(HELLO);
_time_delay(500);
while ( SM != OFF )
{
switch (SM)
{
case INIT:
_SLCDModule_PrintScrolling(INITIALIZING);
SystemInit();
SM = MAIN;
break;
case MAIN:
_SLCDModule_PrintScrolling(HELLO);
SM = ELECTRODE_CHECK;
break;
case ELECTRODE_CHECK:
_MainMenu_Electrode_Check();
break;
default:
break;
}
}
_mqx_exit(0);
}
/*
* SystemInit: Initialises the system
*/
void SystemInit()
{
// _SLCDModule_PrintScrolling(DBG);
//Turn on FSL icon on segment LCD
_SLCDModule_TurnOnFreescaleSign();
//Initailze the Touch Sense Software
_Electrodes_Init();
TSS_KeypadConfig(cKey0.ControlId,Keypad_MaxTouches_Register,1);
TSS_SetSystemConfig(System_ElectrodeEnablers_Register,0x33); //Disables E3 & E4
}
/**
Function Name : _MainMenu_Electrode_Check
Engineer : Manglio González Carrasco
Date : 05/01/2011
Parameters : Nothing
Returns : Nothing
Notes : This function is used to check the current status of the electrodes and to continuously display
the marquee of the current application. if a touch event occurs it sets the state machine to jump
to the selected application.
*/
void _MainMenu_Electrode_Check(void)
{
static U08 MarqueeDelay = 0x9;
_Electrodes_Check();
//TODO:
// incomplete code, but it never comes in here....
if ((ElectrodeFlags & TSS_ELECTRODE_4) || (ElectrodeFlags & TSS_ELECTRODE_5))
{
switch (OptionIndex)
{
default:
_SLCDModule_PrintScrolling(DBG);
break;
}
}
if (isLoopComplete == TRUE)
{
isMarqueeInitialDelay = TRUE;
isLoopComplete = FALSE;
}
}
/* EOF */