Definition in file controller.h.
#include "compiler.h"
Go to the source code of this file.
Defines | |
#define | CONTROLLER_LONG_PRESS_TIME_MS 3000 |
Functions | |
void | controller_init (int cpu_hz, int hsb_hz, int pba_hz, int pbb_hz) |
Bool | controller_key_back (void) |
Bool | controller_key_fct1 (void) |
Bool | controller_key_fct1_pressed (void) |
Bool | controller_key_fct2 (void) |
Bool | controller_key_fct2_pressed (void) |
Bool | controller_key_fct3 (void) |
Bool | controller_key_fct3_pressed (void) |
Bool | controller_key_pressed (void) |
Bool | controller_key_released (void) |
Bool | controller_key_reset (void) |
void | controller_reset (void) |
void | controller_task (void) |
Bool | controller_wheel_left (int wheel_inc) |
Bool | controller_wheel_pressed (void) |
Bool | controller_wheel_right (int wheel_inc) |
#define CONTROLLER_LONG_PRESS_TIME_MS 3000 |
void controller_init | ( | int | cpu_hz, | |
int | hsb_hz, | |||
int | pba_hz, | |||
int | pbb_hz | |||
) |
Definition at line 363 of file controller_evk1104.c.
References controller_cpu_hz, JOYSTICK_KEY_DEBOUNCE_MS, joystick_key_sensibility_timer, qt60168_resources_init(), static_fcpu_hz, touch_button_isr(), TOUCH_IDLE, and touch_states.
Referenced by main().
00364 { 00365 int i; 00366 // Initialize QT60168 resources: GPIO, SPI and QT60168. 00367 qt60168_resources_init(cpu_hz); 00368 // Initialize QT60168 component. 00369 qt60168_init(cpu_hz); 00370 // Read the touch states 00371 for (i=0; i<QT60168_TOUCH_NUMBER_OF_SENSORS; i++ ) 00372 touch_states[i] = TOUCH_IDLE; 00373 controller_cpu_hz = cpu_hz; 00374 }
Bool controller_key_back | ( | void | ) |
Definition at line 266 of file controller_evk1104.c.
References CLEAR_RELEASED_STATE, controller_state, FALSE, IS_JOYSTICK_KEY_PRESSED, no_store, STATE_BACK_RELEASED, static_fcpu_hz, and TRUE.
Referenced by state_machine_task().
00267 { 00268 if (controller_state & STATE_BACK_RELEASED) 00269 { 00270 CLEAR_RELEASED_STATE(BACK); 00271 return TRUE; 00272 } 00273 return FALSE; 00274 }
Bool controller_key_fct1 | ( | void | ) |
Definition at line 286 of file controller_evk1104.c.
References CLEAR_RELEASED_STATE, controller_state, FALSE, is_joystick_released_up(), STATE_FCT1_RELEASED, and TRUE.
Referenced by state_machine_task().
00287 { 00288 if (controller_state & STATE_FCT1_RELEASED) 00289 { 00290 CLEAR_RELEASED_STATE(FCT1); 00291 return TRUE; 00292 } 00293 return FALSE; 00294 }
Bool controller_key_fct1_pressed | ( | void | ) |
Definition at line 316 of file controller_evk1104.c.
References controller_state, FALSE, STATE_FCT1_PRESSED, and TRUE.
00317 { 00318 if (controller_state & STATE_FCT1_PRESSED) 00319 return TRUE; 00320 return FALSE; 00321 }
Bool controller_key_fct2 | ( | void | ) |
Definition at line 296 of file controller_evk1104.c.
References CLEAR_RELEASED_STATE, controller_state, FALSE, is_joystick_released_pressed(), STATE_FCT2_RELEASED, and TRUE.
Referenced by state_machine_task().
00297 { 00298 if (controller_state & STATE_FCT2_RELEASED) 00299 { 00300 CLEAR_RELEASED_STATE(FCT2); 00301 return TRUE; 00302 } 00303 return FALSE; 00304 }
Bool controller_key_fct2_pressed | ( | void | ) |
Definition at line 323 of file controller_evk1104.c.
References controller_state, FALSE, STATE_FCT2_PRESSED, and TRUE.
00324 { 00325 if (controller_state & STATE_FCT2_PRESSED) 00326 return TRUE; 00327 return FALSE; 00328 }
Bool controller_key_fct3 | ( | void | ) |
Definition at line 306 of file controller_evk1104.c.
References CLEAR_RELEASED_STATE, controller_state, FALSE, is_joystick_released_down(), STATE_FCT3_RELEASED, and TRUE.
Referenced by state_machine_task().
00307 { 00308 if (controller_state & STATE_FCT3_RELEASED) 00309 { 00310 CLEAR_RELEASED_STATE(FCT3); 00311 return TRUE; 00312 } 00313 return FALSE; 00314 }
Bool controller_key_fct3_pressed | ( | void | ) |
Definition at line 330 of file controller_evk1104.c.
References controller_state, FALSE, IS_JOYSTICK_KEY_DOWN, STATE_FCT3_PRESSED, and TRUE.
Referenced by state_machine_task().
00331 { 00332 if (controller_state & STATE_FCT3_PRESSED) 00333 return TRUE; 00334 return FALSE; 00335 }
Bool controller_key_pressed | ( | void | ) |
Definition at line 241 of file controller_evk1104.c.
References controller_state, FALSE, IS_JOYSTICK_KEY_DOWN, IS_JOYSTICK_KEY_LEFT, IS_JOYSTICK_KEY_PRESSED, IS_JOYSTICK_KEY_RIGHT, IS_JOYSTICK_KEY_UP, STATE_IDLE, and TRUE.
Referenced by controller_wheel_pressed().
00242 { 00243 if (controller_state == STATE_IDLE) 00244 return FALSE; 00245 return TRUE; 00246 }
Bool controller_key_released | ( | void | ) |
Definition at line 248 of file controller_evk1104.c.
References controller_state, FALSE, IS_JOYSTICK_RELEASED_KEY_DOWN, IS_JOYSTICK_RELEASED_KEY_LEFT, IS_JOYSTICK_RELEASED_KEY_PRESSED, IS_JOYSTICK_RELEASED_KEY_RIGHT, IS_JOYSTICK_RELEASED_KEY_UP, STATE_BACK_RELEASED, STATE_FCT1_RELEASED, STATE_FCT2_RELEASED, STATE_FCT3_RELEASED, and TRUE.
00249 { 00250 if (controller_state & STATE_BACK_RELEASED || 00251 controller_state & STATE_FCT1_RELEASED || 00252 controller_state & STATE_FCT2_RELEASED || 00253 controller_state & STATE_FCT3_RELEASED) 00254 return TRUE; 00255 return FALSE; 00256 }
Bool controller_key_reset | ( | void | ) |
Definition at line 276 of file controller_evk1104.c.
References controller_state, FALSE, STATE_BACK_LONG_PRESS, and TRUE.
Referenced by state_machine_task().
00277 { 00278 if (controller_state & STATE_BACK_LONG_PRESS) 00279 { 00280 controller_state &= ~STATE_BACK_LONG_PRESS; 00281 return TRUE; 00282 } 00283 return FALSE; 00284 }
void controller_reset | ( | void | ) |
Definition at line 357 of file controller_evk1104.c.
References controller_state, STATE_IDLE, and wheel_step_counter.
Referenced by state_machine_filter(), state_machine_signal(), state_machine_source(), and state_machine_task().
00358 { 00359 controller_state = STATE_IDLE; 00360 wheel_step_counter = 0; 00361 }
void controller_task | ( | void | ) |
Definition at line 376 of file controller_evk1104.c.
References TOUCH_IDLE, TOUCH_PRESS, TOUCH_RELEASE, touch_states, and update_controller_state().
Referenced by main().
00377 { 00378 int i; 00379 00380 for (i=0; i<QT60168_TOUCH_NUMBER_OF_SENSORS; i++ ) 00381 { 00382 if (qt60168_is_key_pressed(i)) 00383 touch_states[i] = TOUCH_PRESS; 00384 else if (touch_states[i] == TOUCH_PRESS) 00385 touch_states[i] = TOUCH_RELEASE; 00386 else 00387 touch_states[i] = TOUCH_IDLE; 00388 } 00389 update_controller_state(); 00390 }
Bool controller_wheel_left | ( | int | wheel_inc | ) |
Definition at line 347 of file controller_evk1104.c.
References controller_state, FALSE, is_joystick_left(), STATE_WHEEL_LEFT, TRUE, and wheel_step_counter.
Referenced by state_machine_filter(), state_machine_idle(), state_machine_signal(), and state_machine_source().
00348 { 00349 if (wheel_step_counter >= wheel_inc && controller_state & STATE_WHEEL_LEFT) 00350 { 00351 wheel_step_counter -= wheel_inc; 00352 return TRUE; 00353 } 00354 return FALSE; 00355 }
Bool controller_wheel_pressed | ( | void | ) |
Definition at line 258 of file controller_evk1104.c.
References controller_key_pressed(), controller_state, FALSE, STATE_WHEEL_LEFT, STATE_WHEEL_RIGHT, and TRUE.
00259 { 00260 if (controller_state & STATE_WHEEL_LEFT || 00261 controller_state & STATE_WHEEL_RIGHT) 00262 return TRUE; 00263 return FALSE; 00264 }
Bool controller_wheel_right | ( | int | wheel_inc | ) |
Definition at line 337 of file controller_evk1104.c.
References controller_state, FALSE, is_joystick_right(), STATE_WHEEL_RIGHT, TRUE, and wheel_step_counter.
Referenced by state_machine_filter(), state_machine_idle(), state_machine_signal(), and state_machine_source().
00338 { 00339 if (wheel_step_counter >= wheel_inc && controller_state & STATE_WHEEL_RIGHT) 00340 { 00341 wheel_step_counter -= wheel_inc; 00342 return TRUE; 00343 } 00344 return FALSE; 00345 }