BEEP-8 SDK 1.0.0
|
Human Interface definitions for the BEEP-8 system. More...
Go to the source code of this file.
Classes | |
struct | _b8HifEvent |
Structure representing a single HIF event. More... | |
struct | _b8HifEvents |
Structure representing a collection of HIF events. More... | |
struct | _b8HifMouseStatus |
Structure representing the current mouse or touch panel status. More... | |
Macros | |
#define | B8_HIF_PAD_STATUS_START (1 << 0) |
#define | B8_HIF_PAD_STATUS_SELECT (1 << 1) |
#define | B8_HIF_PAD_STATUS_LEFT (1 << 2) |
#define | B8_HIF_PAD_STATUS_UP (1 << 3) |
#define | B8_HIF_PAD_STATUS_RIGHT (1 << 4) |
#define | B8_HIF_PAD_STATUS_DOWN (1 << 5) |
#define | B8_HIF_PAD_STATUS_BTN_A (1 << 6) |
#define | B8_HIF_PAD_STATUS_BTN_B (1 << 7) |
#define | B8_HIF_PAD_STATUS_BTN_X B8_HIF_PAD_STATUS_BTN_A |
#define | B8_HIF_PAD_STATUS_BTN_Z B8_HIF_PAD_STATUS_BTN_B |
#define | B8_HIF_ADDR (0xffffa000) |
#define | B8_HIF_PAD(n) |
Access the gamepad input register. | |
#define | B8_HIF_PAD0 B8_HIF_PAD(0) |
#define | B8_HIF_PAD1 B8_HIF_PAD(1) |
#define | B8_HIF_PAD2 B8_HIF_PAD(2) |
#define | B8_HIF_PAD3 B8_HIF_PAD(3) |
#define | B8_HIF_TOUCH_CTRL _B8_REG(B8_HIF_ADDR + 0x40) |
#define | B8_HIF_TOUCH_CONNECT _B8_REG(B8_HIF_ADDR + 0x44) |
#define | B8_HIF_KB_ADDR (B8_HIF_ADDR + 0x20) |
#define | B8_HIF_KB_RX _B8_REG(B8_HIF_KB_ADDR + 0x00) |
#define | B8_HIF_KB_LEN _B8_REG(B8_HIF_KB_ADDR + 0x08) |
#define | B8_HIF_KB_STATUS _B8_REG(B8_HIF_KB_ADDR + 0x10) |
#define | B8_HIF_KB_STATUS_ALT (1 << 0) |
#define | B8_HIF_KB_STATUS_SHIFT (1 << 1) |
#define | B8_HIF_KB_STATUS_META (1 << 2) |
#define | B8_HIF_KB_STATUS_CONTROL (1 << 3) |
#define | B8_HIF_KB_CODE_BACKSPACE (8) |
#define | B8_HIF_KB_CODE_TAB (9) |
#define | B8_HIF_KB_CODE_ENTER (10) |
#define | B8_HIF_KB_CODE_ESCAPE (27) |
#define | B8_HIF_KB_CODE_ARROW_LEFT (128) |
#define | B8_HIF_KB_CODE_ARROW_RIGHT (129) |
#define | B8_HIF_KB_CODE_ARROW_UP (130) |
#define | B8_HIF_KB_CODE_ARROW_DOWN (131) |
#define | B8_HIF_MAX_TOUCH_EVENTS (32) |
Typedefs | |
typedef struct _b8HifEvent | b8HifEvent |
Structure representing a single HIF event. | |
typedef struct _b8HifEvents | b8HifEvents |
Structure representing a collection of HIF events. | |
typedef struct _b8HifMouseStatus | b8HifMouseStatus |
Structure representing the current mouse or touch panel status. | |
Enumerations | |
enum | b8HifEventType { B8_HIF_EV_TOUCH_START = 0xf0 , B8_HIF_EV_TOUCH_MOVE , B8_HIF_EV_TOUCH_CANCEL , B8_HIF_EV_TOUCH_END , B8_HIF_EV_MOUSE_DOWN , B8_HIF_EV_MOUSE_MOVE , B8_HIF_EV_MOUSE_UP , B8_HIF_EV_MOUSE_HOVER_MOVE } |
Enumeration of HIF event types. More... | |
Functions | |
int | b8HifGetEvents (b8HifEvents *result) |
Retrieve the current HIF events. | |
const b8HifMouseStatus * | b8HifGetMouseStatus (void) |
Retrieve the current mouse or touch panel status. | |
Human Interface definitions for the BEEP-8 system.
This file contains definitions for the Human Interface (HIF) system, including gamepad, keyboard, touch, and mouse functionalities. It provides macros for accessing various HIF registers and enumerations for handling different HIF events.
The HIF system allows interaction with gamepads, keyboards, and touch/mouse inputs, enabling the detection of button presses, directional inputs, and touch/mouse events.
For more detailed information, please refer to the BEEP-8 data sheet.
#define B8_HIF_PAD | ( | n | ) |
Access the gamepad input register.
Each bit in the register represents the status of a specific button:
B8_HIF_PAD_STATUS_START
: Start buttonB8_HIF_PAD_STATUS_SELECT
: Select buttonB8_HIF_PAD_STATUS_LEFT
: Left buttonB8_HIF_PAD_STATUS_UP
: Up buttonB8_HIF_PAD_STATUS_RIGHT
: Right buttonB8_HIF_PAD_STATUS_DOWN
: Down buttonB8_HIF_PAD_STATUS_BTN_A
: Button AB8_HIF_PAD_STATUS_BTN_B
: Button BB8_HIF_PAD_STATUS_BTN_X
: X button (alias for Button A)B8_HIF_PAD_STATUS_BTN_Z
: O button (alias for Button B)Each bit is active high; a value of '1' indicates the button is pressed.
n | The index of the input register (0 to 3). |
typedef struct _b8HifEvent b8HifEvent |
Structure representing a single HIF event.
This structure defines a single event generated by the HIF system, including the event type, coordinates, and an identifier.
typedef struct _b8HifEvents b8HifEvents |
Structure representing a collection of HIF events.
This structure defines a collection of HIF events, including the number of events and an array of individual event structures.
num
: The number of events currently stored.events
: An array of b8HifEvent
structures. typedef struct _b8HifMouseStatus b8HifMouseStatus |
Structure representing the current mouse or touch panel status.
This structure provides information about the current position and state of the mouse or touch panel. Although the API refers to "mouse," it is also compatible with touch panel inputs. In the case of multiple touch points, the status prioritizes the most recently initiated touch.
For example:
Members:
mouse_x
: The current X coordinate of the mouse or touch panel (16-bit signed fixed-point number with 4 fractional bits).mouse_y
: The current Y coordinate of the mouse or touch panel (16-bit signed fixed-point number with 4 fractional bits).is_dragging
: Indicates whether the mouse or touch is in a dragging state (1: dragging, 0: not dragging).mouse_x
and mouse_y
values are 16-bit signed fixed-point numbers with 4 bits dedicated to the fractional part. To obtain the actual floating-point value, divide by 16. For example, a mouse_x
value of 160
represents 10.0
(160 / 16 = 10.0
). enum b8HifEventType |
Enumeration of HIF event types.
This enumeration defines various event types that can be generated by the HIF system. Events include touch events, mouse events, and other input-related events.
|
extern |
Retrieve the current HIF events.
This function retrieves the current HIF events and stores them in the provided result structure. It safely copies the events from the internal buffer to the user-provided buffer.
result | A pointer to a b8HifEvents structure where the events will be stored. |
0 | Success. |
-EINVAL | Invalid argument (e.g., result is NULL). |
Other | Error codes as returned by semaphore functions. |
|
extern |
Retrieve the current mouse or touch panel status.
This function returns a pointer to the b8HifMouseStatus
structure, which contains the current state of the mouse or touch panel. The API handles both mouse and touch panel input, with a priority on the most recently initiated touch.
Usage:
b8HifMouseStatus
structure.