This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: TI-RTOS
Hello everyone,
i'm attempting to establish an interrupt for Start Button and Stop Button, so the idea here is if the Start Button is pressed a callback function called StartTest () will be called to change the state variable from Ready_state to Testing_state and then, whatever the value of the state variable, if Stop Button is pressed a callback function called StopTest () will be called to change the state variable from ( Testing_state or Passed_state or Failed_state ) to Ready_state.
How can i can use a callback function that takes two parameters ( Gpio Index and state variable ) ? i'm using GPIO_setCallback(unsigned int index, GPIO_CallbackFxn callback) and GPIO_enableInt(unsigned int index) functions. is there any wrong in passing parameters like i did ?
this is my code :
void StartTest (unsigned int index, state_enum state)
{
state = TESTING_STATE;
System_printf("Linking with Testing State\n");
}
void StopTest (unsigned int index, state_enum state)
{
state = READY_STATE;
System_printf("Linking with Ready State\n");
}
int main(void)
{
/* Initial State of the tester */
state_enum state = READY_STATE ;
Task_Params taskParams;
/* Call board init functions */
Board_initGeneral();
Board_initGPIO();
while (1)
{
switch(state)
{
case READY_STATE:
GPIO_write(ready_led, 1);
/* install "Start Button" callback */
GPIO_setCallback(start_button, StartTest(state));
/* Enable interrupts */
GPIO_enableInt(start_button);
**Attention** This is a public forum