task_accelerometer.c
/******************************************************************************
* Bottom Half Task.  Examines the ADC data from the accelerometer
******************************************************************************/
Bottom Half Task.  Examines the ADC data from the accelerometer
Bottom Half Task . Examines the ADC data from the accelerometer
void Task_Accelerometer_Bottom_Half(void *pvParameters)
{
    PACKMAN_MSG_t direction;
    while(1)
        {
            ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
            if(ACC_X_DIR < 2000){
               direction.cmd = PACKMAN_CMD_LEFT;
            }else if(ACC_X_DIR > 2150){
                direction.cmd = PACKMAN_CMD_RIGHT;
            }else if(ACC_Y_DIR < 2020){
                direction.cmd = PACKMAN_CMD_DOWN;
            }else if(ACC_Y_DIR > 2100){
                direction.cmd = PACKMAN_CMD_UP;
            }else{
                direction.cmd = PACKMAN_CMD_CENTER;
            }
            direction.value = 1;
            if(direction.cmd != PACKMAN_CMD_CENTER){
                xQueueSend(Queue_Packman, &direction, portMAX_DELAY);
            }
        }
}
void Task_Accelerometer_Bottom_Half ( void * pvParameters ) { PACKMAN_MSG_t direction ; while ( 1 ) { ulTaskNotifyTake ( pdTRUE , portMAX_DELAY ) ; if ( ACC_X_DIR < 2000 ) { direction . cmd = PACKMAN_CMD_LEFT ; } else if ( ACC_X_DIR > 2150 ) { direction . cmd = PACKMAN_CMD_RIGHT ; } else if ( ACC_Y_DIR < 2020 ) { direction . cmd = PACKMAN_CMD_DOWN ; } else if ( ACC_Y_DIR > 2100 ) { direction . cmd = PACKMAN_CMD_UP ; } else { direction . cmd = PACKMAN_CMD_CENTER ; } direction . value = 1 ; if ( direction . cmd != PACKMAN_CMD_CENTER ) { xQueueSend ( Queue_Packman , & direction , portMAX_DELAY ) ; } } }
Bottom Half Task.
Bottom Half Task .
// Wait until we get a task notification from the ADC14 ISR /*
             * Set the dir variable to one of the following values based
             * on the values of the accelerometer
             */ // set the value of the direction // Send dir to Queue_Console if the joystick is not at the center // as to not fill the queue with center commands