#include "controller.h"
#include "board.h"
#include "gpio.h"
#include "cycle_counter.h"
#include "qt1081.h"
#include "intc.h"
Enumerations | |
enum | joystick_status_t { JOYSTICK_STATUS_IDLE = 0x00000000, JOYSTICK_STATUS_UP = 0x00000001, JOYSTICK_STATUS_DOWN = 0x00000002, JOYSTICK_STATUS_RIGHT = 0x00000004, JOYSTICK_STATUS_LEFT = 0x00000008, JOYSTICK_STATUS_PRESSED = 0x00000010, JOYSTICK_STATUS_PRESSED_MASK = 0x0000FFFF, JOYSTICK_STATUS_RELEASED_UP = 0x00010000, JOYSTICK_STATUS_RELEASED_DOWN = 0x00020000, JOYSTICK_STATUS_RELEASED_RIGHT = 0x00040000, JOYSTICK_STATUS_RELEASED_LEFT = 0x00080000, JOYSTICK_STATUS_RELEASED_PRESSED = 0x00100000, JOYSTICK_STATUS_RELEASED_MASK = 0xFFFF0000 } |
Variables | |
static t_cpu_time | joystick_key_sensibility_timer |
static enum joystick_status_t | joystick_status = JOYSTICK_STATUS_IDLE |
static bool | no_store = false |
static U32 | static_fcpu_hz |
#define CLEAR_JOYSTICK_KEY_ALL | ( | ) | (joystick_status = JOYSTICK_STATUS_IDLE) |
#define CLEAR_JOYSTICK_KEY_DOWN | ( | ) | (joystick_status &= ~JOYSTICK_STATUS_DOWN) |
#define CLEAR_JOYSTICK_KEY_LEFT | ( | ) | (joystick_status &= ~JOYSTICK_STATUS_LEFT) |
#define CLEAR_JOYSTICK_KEY_PRESSED | ( | ) | (joystick_status &= ~JOYSTICK_STATUS_PRESSED) |
#define CLEAR_JOYSTICK_KEY_RIGHT | ( | ) | (joystick_status &= ~JOYSTICK_STATUS_RIGHT) |
#define CLEAR_JOYSTICK_KEY_UP | ( | ) | (joystick_status &= ~JOYSTICK_STATUS_UP) |
#define CLEAR_JOYSTICK_RELEASED_KEY_DOWN | ( | ) | (joystick_status &= ~JOYSTICK_STATUS_RELEASED_DOWN) |
Referenced by is_joystick_released_down().
#define CLEAR_JOYSTICK_RELEASED_KEY_LEFT | ( | ) | (joystick_status &= ~JOYSTICK_STATUS_RELEASED_LEFT) |
Referenced by is_joystick_released_left().
#define CLEAR_JOYSTICK_RELEASED_KEY_PRESSED | ( | ) | (joystick_status &= ~JOYSTICK_STATUS_RELEASED_PRESSED) |
Referenced by is_joystick_released_pressed().
#define CLEAR_JOYSTICK_RELEASED_KEY_RIGHT | ( | ) | (joystick_status &= ~JOYSTICK_STATUS_RELEASED_RIGHT) |
Referenced by is_joystick_released_right().
#define CLEAR_JOYSTICK_RELEASED_KEY_UP | ( | ) | (joystick_status &= ~JOYSTICK_STATUS_RELEASED_UP) |
Referenced by is_joystick_released_up().
#define IS_JOYSTICK_KEY_DOWN | ( | ) | (joystick_status & JOYSTICK_STATUS_DOWN) |
Referenced by controller_key_fct3_pressed(), controller_key_pressed(), and touch_button_isr().
#define IS_JOYSTICK_KEY_LEFT | ( | ) | (joystick_status & JOYSTICK_STATUS_LEFT) |
Referenced by controller_key_pressed(), and is_joystick_left().
#define IS_JOYSTICK_KEY_PRESSED | ( | ) | (joystick_status & JOYSTICK_STATUS_PRESSED) |
Referenced by controller_key_back(), controller_key_pressed(), and touch_button_isr().
#define IS_JOYSTICK_KEY_RIGHT | ( | ) | (joystick_status & JOYSTICK_STATUS_RIGHT) |
Referenced by controller_key_pressed(), and is_joystick_right().
#define IS_JOYSTICK_KEY_UP | ( | ) | (joystick_status & JOYSTICK_STATUS_UP) |
Referenced by controller_key_pressed(), and touch_button_isr().
#define IS_JOYSTICK_ONLY_KEY_DOWN | ( | ) | ((joystick_status == JOYSTICK_STATUS_DOWN) & JOYSTICK_STATUS_PRESSED_MASK) |
#define IS_JOYSTICK_ONLY_KEY_LEFT | ( | ) | ((joystick_status == JOYSTICK_STATUS_LEFT) & JOYSTICK_STATUS_PRESSED_MASK) |
#define IS_JOYSTICK_ONLY_KEY_PRESSED | ( | ) | ((joystick_status == JOYSTICK_STATUS_PRESSED) & JOYSTICK_STATUS_PRESSED_MASK) |
#define IS_JOYSTICK_ONLY_KEY_RIGHT | ( | ) | ((joystick_status == JOYSTICK_STATUS_RIGHT) & JOYSTICK_STATUS_PRESSED_MASK) |
#define IS_JOYSTICK_ONLY_KEY_UP | ( | ) | ((joystick_status == JOYSTICK_STATUS_UP) & JOYSTICK_STATUS_PRESSED_MASK) |
#define IS_JOYSTICK_ONLY_RELEASED_KEY_DOWN | ( | ) | ((joystick_status & JOYSTICK_STATUS_RELEASED_DOWN) & JOYSTICK_STATUS_RELEASED_MASK) |
Referenced by is_joystick_released_down().
#define IS_JOYSTICK_ONLY_RELEASED_KEY_LEFT | ( | ) | ((joystick_status & JOYSTICK_STATUS_RELEASED_LEFT) & JOYSTICK_STATUS_RELEASED_MASK) |
Referenced by is_joystick_released_left().
#define IS_JOYSTICK_ONLY_RELEASED_KEY_PRESSED | ( | ) | ((joystick_status & JOYSTICK_STATUS_RELEASED_PRESSED) & JOYSTICK_STATUS_RELEASED_MASK) |
Referenced by is_joystick_released_pressed().
#define IS_JOYSTICK_ONLY_RELEASED_KEY_RIGHT | ( | ) | ((joystick_status & JOYSTICK_STATUS_RELEASED_RIGHT) & JOYSTICK_STATUS_RELEASED_MASK) |
Referenced by is_joystick_released_right().
#define IS_JOYSTICK_ONLY_RELEASED_KEY_UP | ( | ) | ((joystick_status & JOYSTICK_STATUS_RELEASED_UP) & JOYSTICK_STATUS_RELEASED_MASK) |
Referenced by is_joystick_released_up().
#define IS_JOYSTICK_RELEASED_KEY_DOWN | ( | ) | (joystick_status & JOYSTICK_STATUS_RELEASED_DOWN) |
Referenced by controller_key_released().
#define IS_JOYSTICK_RELEASED_KEY_LEFT | ( | ) | (joystick_status & JOYSTICK_STATUS_RELEASED_LEFT) |
Referenced by controller_key_released().
#define IS_JOYSTICK_RELEASED_KEY_PRESSED | ( | ) | (joystick_status & JOYSTICK_STATUS_RELEASED_PRESSED) |
Referenced by controller_key_released().
#define IS_JOYSTICK_RELEASED_KEY_RIGHT | ( | ) | (joystick_status & JOYSTICK_STATUS_RELEASED_RIGHT) |
Referenced by controller_key_released().
#define IS_JOYSTICK_RELEASED_KEY_UP | ( | ) | (joystick_status & JOYSTICK_STATUS_RELEASED_UP) |
Referenced by controller_key_released().
#define JOYSTICK_KEY_DEBOUNCE_MS 200 |
enum joystick_status_t |
void controller_init | ( | int | cpu_hz, |
int | hsb_hz, | ||
int | pba_hz, | ||
int | pbb_hz | ||
) |
References cpu_hz, cpu_ms_2_cy(), cpu_set_timeout(), Disable_global_interrupt, Enable_global_interrupt, gpio_enable_pin_interrupt(), GPIO_PIN_CHANGE, INTC_register_interrupt(), JOYSTICK_KEY_DEBOUNCE_MS, QT1081_TOUCH_SENSOR_DOWN, QT1081_TOUCH_SENSOR_ENTER, QT1081_TOUCH_SENSOR_LEFT, QT1081_TOUCH_SENSOR_RIGHT, QT1081_TOUCH_SENSOR_UP, static_fcpu_hz, and touch_button_isr().
Referenced by main().
bool controller_key_back | ( | void | ) |
References cpu_is_timeout(), cpu_ms_2_cy(), cpu_set_timeout(), gpio_clr_gpio_pin(), gpio_set_gpio_pin(), IS_JOYSTICK_KEY_PRESSED, LED0_GPIO, no_store, and static_fcpu_hz.
Referenced by state_machine_task().
bool controller_key_fct1 | ( | void | ) |
References is_joystick_released_up().
Referenced by state_machine_task().
bool controller_key_fct1_pressed | ( | void | ) |
bool controller_key_fct2 | ( | void | ) |
References is_joystick_released_pressed().
Referenced by state_machine_task().
bool controller_key_fct2_pressed | ( | void | ) |
bool controller_key_fct3 | ( | void | ) |
References is_joystick_released_down().
Referenced by state_machine_task().
bool controller_key_fct3_pressed | ( | void | ) |
References IS_JOYSTICK_KEY_DOWN.
Referenced by state_machine_task().
bool controller_key_pressed | ( | void | ) |
References IS_JOYSTICK_KEY_DOWN, IS_JOYSTICK_KEY_LEFT, IS_JOYSTICK_KEY_PRESSED, IS_JOYSTICK_KEY_RIGHT, and IS_JOYSTICK_KEY_UP.
Referenced by controller_wheel_pressed().
bool controller_key_released | ( | void | ) |
bool controller_key_reset | ( | void | ) |
Referenced by state_machine_task().
void controller_reset | ( | void | ) |
Referenced by state_machine_filter(), state_machine_signal(), state_machine_source(), and state_machine_task().
void controller_task | ( | void | ) |
Referenced by main().
bool controller_wheel_left | ( | int | wheel_inc | ) |
References is_joystick_left().
Referenced by state_machine_filter(), state_machine_idle(), state_machine_signal(), and state_machine_source().
bool controller_wheel_pressed | ( | void | ) |
References controller_key_pressed().
bool controller_wheel_right | ( | int | wheel_inc | ) |
References is_joystick_right().
Referenced by state_machine_filter(), state_machine_idle(), state_machine_signal(), and state_machine_source().
|
static |
References cpu_is_timeout(), cpu_ms_2_cy(), cpu_set_timeout(), IS_JOYSTICK_KEY_LEFT, JOYSTICK_KEY_DEBOUNCE_MS, and static_fcpu_hz.
Referenced by controller_wheel_left().
|
static |
References CLEAR_JOYSTICK_RELEASED_KEY_DOWN, cpu_is_timeout(), cpu_ms_2_cy(), cpu_set_timeout(), IS_JOYSTICK_ONLY_RELEASED_KEY_DOWN, JOYSTICK_KEY_DEBOUNCE_MS, and static_fcpu_hz.
Referenced by controller_key_fct3().
|
static |
|
static |
|
static |
|
static |
References CLEAR_JOYSTICK_RELEASED_KEY_UP, cpu_is_timeout(), cpu_ms_2_cy(), cpu_set_timeout(), IS_JOYSTICK_ONLY_RELEASED_KEY_UP, JOYSTICK_KEY_DEBOUNCE_MS, and static_fcpu_hz.
Referenced by controller_key_fct1().
|
static |
References cpu_is_timeout(), cpu_ms_2_cy(), cpu_set_timeout(), IS_JOYSTICK_KEY_RIGHT, JOYSTICK_KEY_DEBOUNCE_MS, and static_fcpu_hz.
Referenced by controller_wheel_right().
|
inlinestatic |
References gpio_clear_pin_interrupt_flag(), gpio_get_pin_interrupt_flag(), gpio_get_pin_value(), joystick_status, and no_store.
Referenced by touch_button_isr().
void touch_button_isr | ( | void | ) |
References gpio_clr_gpio_pin(), gpio_set_gpio_pin(), IS_JOYSTICK_KEY_DOWN, IS_JOYSTICK_KEY_PRESSED, IS_JOYSTICK_KEY_UP, JOYSTICK_STATUS_DOWN, JOYSTICK_STATUS_LEFT, JOYSTICK_STATUS_PRESSED, JOYSTICK_STATUS_RELEASED_DOWN, JOYSTICK_STATUS_RELEASED_LEFT, JOYSTICK_STATUS_RELEASED_PRESSED, JOYSTICK_STATUS_RELEASED_RIGHT, JOYSTICK_STATUS_RELEASED_UP, JOYSTICK_STATUS_RIGHT, JOYSTICK_STATUS_UP, LED1_GPIO, LED2_GPIO, LED3_GPIO, manage_button_isr(), QT1081_TOUCH_SENSOR_DOWN, QT1081_TOUCH_SENSOR_ENTER, QT1081_TOUCH_SENSOR_LEFT, QT1081_TOUCH_SENSOR_RIGHT, and QT1081_TOUCH_SENSOR_UP.
Referenced by controller_init().
|
static |
|
static |
Referenced by manage_button_isr().
Referenced by controller_key_back(), and manage_button_isr().
|
static |