llvm-mos-sdk
Macros | Functions
joypad.h File Reference
#include <stdbool.h>
#include <stdint.h>
Include dependency graph for joypad.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define KEY_LEFT   0x80
 
#define KEY_DOWN   0x40
 
#define KEY_RIGHT   0x20
 
#define KEY_UP   0x10
 
#define KEY_RUN   0x08
 
#define KEY_SELECT   0x04
 
#define KEY_2   0x02
 
#define KEY_1   0x01
 

Functions

uint8_t pce_joypad_wr (uint8_t value)
 Write a value to the joypad I/O port, then read the result. More...
 
uint8_t pce_joypad_read (void)
 Read the first joypad controller's pressed buttons. More...
 
uint8_t pce_joypad_next (void)
 Read the next joypad controller's pressed buttons. More...
 

Detailed Description

Functionality related to the joypad.

Macro Definition Documentation

◆ KEY_1

#define KEY_1   0x01

◆ KEY_2

#define KEY_2   0x02

◆ KEY_DOWN

#define KEY_DOWN   0x40

◆ KEY_LEFT

#define KEY_LEFT   0x80

◆ KEY_RIGHT

#define KEY_RIGHT   0x20

◆ KEY_RUN

#define KEY_RUN   0x08

◆ KEY_SELECT

#define KEY_SELECT   0x04

◆ KEY_UP

#define KEY_UP   0x10

Function Documentation

◆ pce_joypad_next()

uint8_t pce_joypad_next ( void  )

Read the next joypad controller's pressed buttons.

If a multitap is to be used, one should use this function for all controllers after the first one (which should use pce_joypad_read instead).

Returns
uint8_t Buttons currently pressed.

◆ pce_joypad_read()

uint8_t pce_joypad_read ( void  )

Read the first joypad controller's pressed buttons.

Returns
uint8_t Buttons currently pressed.

◆ pce_joypad_wr()

uint8_t pce_joypad_wr ( uint8_t  value)

Write a value to the joypad I/O port, then read the result.

Parameters
valueThe value to write.
Returns
uint8_t The value read.