You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

52 lines
1.4 KiB

/* Copyright 2023 9R
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "analog.h"
#include "debug.h"
#include "math.h"
#include "quantum.h"
#include "state.h"
int16_t xPos;
int16_t yPos;
typedef struct {
uint16_t angle;
uint16_t distance;
} thumbstick_polar_position_t;
typedef struct {
bool w;
bool a;
bool s;
bool d;
bool shift;
} wasd_state_t;
thumbstick_polar_position_t thumbstick_polar_position ;
wasd_state_t wasd_state;
void init_wasd_state(void);
thumbstick_polar_position_t get_thumbstick_polar_position(int16_t x, int16_t y);
bool update_keystate(uint16_t angle_from, uint16_t angle_to, uint16_t angle);
void update_keycode(uint16_t keycode, bool keystate);
void thumbstick(controller_state_t controller_state);