|
| 1 | +/*------------------------------------------------------------- |
| 2 | +
|
| 3 | +si_steering.h -- Steering wheel support |
| 4 | +
|
| 5 | +Copyright (C) 2017 - 2026 Extrems' Corner.org |
| 6 | +
|
| 7 | +This software is provided 'as-is', without any express or implied |
| 8 | +warranty. In no event will the authors be held liable for any |
| 9 | +damages arising from the use of this software. |
| 10 | +
|
| 11 | +Permission is granted to anyone to use this software for any |
| 12 | +purpose, including commercial applications, and to alter it and |
| 13 | +redistribute it freely, subject to the following restrictions: |
| 14 | +
|
| 15 | +1. The origin of this software must not be misrepresented; you |
| 16 | +must not claim that you wrote the original software. If you use |
| 17 | +this software in a product, an acknowledgment in the product |
| 18 | +documentation would be appreciated but is not required. |
| 19 | +
|
| 20 | +2. Altered source versions must be plainly marked as such, and |
| 21 | +must not be misrepresented as being the original software. |
| 22 | +
|
| 23 | +3. This notice may not be removed or altered from any source |
| 24 | +distribution. |
| 25 | +
|
| 26 | +-------------------------------------------------------------*/ |
| 27 | + |
| 28 | +#ifndef __OGC_SI_STEERING_H__ |
| 29 | +#define __OGC_SI_STEERING_H__ |
| 30 | + |
| 31 | +#include <gctypes.h> |
| 32 | + |
| 33 | +#define SI_STEERING_ERR_READY 0 |
| 34 | +#define SI_STEERING_ERR_NO_CONTROLLER -1 |
| 35 | +#define SI_STEERING_ERR_BUSY -2 |
| 36 | +#define SI_STEERING_ERR_TRANSFER -3 |
| 37 | + |
| 38 | +#define SI_STEERING_STATUS_MTR_EN 0x01 |
| 39 | +#define SI_STEERING_STATUS_MTR_BK 0x02 |
| 40 | +#define SI_STEERING_STATUS_POWER 0x04 |
| 41 | +#define SI_STEERING_STATUS_PEDAL 0x08 |
| 42 | + |
| 43 | +#define SI_STEERING_BUTTON_LEFT 0x0001 |
| 44 | +#define SI_STEERING_BUTTON_RIGHT 0x0002 |
| 45 | +#define SI_STEERING_BUTTON_DOWN 0x0004 |
| 46 | +#define SI_STEERING_BUTTON_UP 0x0008 |
| 47 | +#define SI_STEERING_TRIGGER_Z 0x0010 |
| 48 | +#define SI_STEERING_TRIGGER_R 0x0020 |
| 49 | +#define SI_STEERING_TRIGGER_L 0x0040 |
| 50 | +#define SI_STEERING_BUTTON_A 0x0100 |
| 51 | +#define SI_STEERING_BUTTON_B 0x0200 |
| 52 | +#define SI_STEERING_BUTTON_X 0x0400 |
| 53 | +#define SI_STEERING_BUTTON_Y 0x0800 |
| 54 | +#define SI_STEERING_BUTTON_START 0x1000 |
| 55 | + |
| 56 | +#define SI_STEERING_CONTROL_BRAKE 0x000 |
| 57 | +#define SI_STEERING_CONTROL_STANDBY 0x400 |
| 58 | +#define SI_STEERING_CONTROL_DRIVE 0x600 |
| 59 | +#define SI_STEERING_CONTROL_MASK 0x600 |
| 60 | + |
| 61 | +#ifdef __cplusplus |
| 62 | +extern "C" { |
| 63 | +#endif |
| 64 | + |
| 65 | +typedef void (*SISteeringCallback)(s32 chan, s32 result); |
| 66 | +typedef void (*SISteeringSamplingCallback)(void); |
| 67 | + |
| 68 | +typedef struct SISteeringStatus { |
| 69 | + u16 button; |
| 70 | + u8 status; |
| 71 | + s8 steering; |
| 72 | + u8 gas; |
| 73 | + u8 brake; |
| 74 | + u8 left; |
| 75 | + u8 right; |
| 76 | + s8 err; |
| 77 | +} SISteeringStatus; |
| 78 | + |
| 79 | +void SI_InitSteering(void); |
| 80 | +s32 SI_ResetSteering(s32 chan); |
| 81 | +s32 SI_ResetSteeringAsync(s32 chan, SISteeringCallback callback); |
| 82 | +s32 SI_ReadSteering(s32 chan, SISteeringStatus *status); |
| 83 | +SISteeringSamplingCallback SI_SetSteeringSamplingCallback(SISteeringSamplingCallback callback); |
| 84 | +void SI_ControlSteering(s32 chan, u32 control, s32 steering); |
| 85 | + |
| 86 | +#ifdef __cplusplus |
| 87 | +} |
| 88 | +#endif |
| 89 | + |
| 90 | +#endif |
0 commit comments