KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches

Maple driver for the DreamEye peripheral More...

Files

file  dreameye.h
 Definitions for using the Dreameye Camera device.
 

Data Structures

struct  dreameye_state_t
 Dreameye status structure. More...
 

Macros

#define DREAMEYE_GETCOND_NUM_IMAGES   0x81
 Get the number of images on the device.
 
#define DREAMEYE_GETCOND_TRANSFER_COUNT   0x83
 Get the number of transfers to copy an image.
 
#define DREAMEYE_SUBCOMMAND_IMAGEREQ   0x04
 Get an image from the device.
 
#define DREAMEYE_SUBCOMMAND_ERASE   0x05
 Erase an image from the device.
 
#define DREAMEYE_SUBCOMMAND_ERROR   0xFF
 Error return command.
 
#define DREAMEYE_IMAGEREQ_CONTINUE   0x00
 Continue transferring an image.
 
#define DREAMEYE_IMAGEREQ_START   0x40
 Start transferring an image from its start.
 

Functions

int dreameye_get_image_count (maple_device_t *dev, int block)
 Get the number of images on the Dreameye.
 
int dreameye_get_image (maple_device_t *dev, uint8 image, uint8 **data, int *img_sz)
 Transfer an image from the Dreameye.
 
int dreameye_erase_image (maple_device_t *dev, uint8 image, int block)
 Erase an image from the Dreameye.
 

Detailed Description

Maple driver for the DreamEye peripheral

Macro Definition Documentation

◆ DREAMEYE_GETCOND_NUM_IMAGES

#define DREAMEYE_GETCOND_NUM_IMAGES   0x81

Get the number of images on the device.

This constant is used with the MAPLE_COMMAND_GETCOND command to fetch the number of images on the device.

◆ DREAMEYE_GETCOND_TRANSFER_COUNT

#define DREAMEYE_GETCOND_TRANSFER_COUNT   0x83

Get the number of transfers to copy an image.

This constant is used with the MAPLE_COMMAND_GETCOND command to fetch the number of times a transfer command must be sent to get the image specified.

◆ DREAMEYE_IMAGEREQ_CONTINUE

#define DREAMEYE_IMAGEREQ_CONTINUE   0x00

Continue transferring an image.

◆ DREAMEYE_IMAGEREQ_START

#define DREAMEYE_IMAGEREQ_START   0x40

Start transferring an image from its start.

◆ DREAMEYE_SUBCOMMAND_ERASE

#define DREAMEYE_SUBCOMMAND_ERASE   0x05

Erase an image from the device.

This subcommand is used with the MAPLE_COMMAND_CAMCONTROL command to remove an image from the device.

◆ DREAMEYE_SUBCOMMAND_ERROR

#define DREAMEYE_SUBCOMMAND_ERROR   0xFF

Error return command.

This subcommand is used by the dreameye with the MAPLE_COMMAND_CAMCONTROL command to indicate an error occurred in a subcommand.

◆ DREAMEYE_SUBCOMMAND_IMAGEREQ

#define DREAMEYE_SUBCOMMAND_IMAGEREQ   0x04

Get an image from the device.

This subcommand is used with the MAPLE_COMMAND_CAMCONTROL command to fetch part of image data from the specified image.

Function Documentation

◆ dreameye_erase_image()

int dreameye_erase_image ( maple_device_t * dev,
uint8 image,
int block )

Erase an image from the Dreameye.

This function erases the specified image from the Dreameye device. This command can be sent to any of the subdevices of the MAPLE_FUNC_CONTROLLER root device of the Dreameye.

Parameters
devThe device to erase from.
imageThe image number to erase (0xFF to erase all).
blockSet to 1 to wait for the Dreameye to respond.
Return values
MAPLE_EOKOn success.
MAPLE_EAGAINCouldn't send the command, try again.
MAPLE_ETIMEOUTTimeout on blocking.
MAPLE_EINVALIDInvalid image number specified.

◆ dreameye_get_image()

int dreameye_get_image ( maple_device_t * dev,
uint8 image,
uint8 ** data,
int * img_sz )

Transfer an image from the Dreameye.

This function fetches a single image from the specified Dreameye device. This function will block, and can take a little while to execute. You must use the first subdevice of the MAPLE_FUNC_CONTROLLER root device of the Dreameye as the dev parameter.

Parameters
devThe device to get an image from.
imageThe image number to download.
dataA pointer to a buffer to store things in. This will be allocated by the function and you are responsible for freeing the data when you are done.
img_szA pointer to storage for the size of the image, in bytes.
Return values
MAPLE_EOKOn success.
MAPLE_EFAILOn error.

◆ dreameye_get_image_count()

int dreameye_get_image_count ( maple_device_t * dev,
int block )

Get the number of images on the Dreameye.

This function fetches the number of saved images on the specified Dreameye device. It can be sent to any of the subdevices of the MAPLE_FUNC_CONTROLLER root device of the Dreameye. When the response comes from the device, the image_count field of the dreameye_state_t for the specified device will have the number of images on the device, and image_count_valid will be set to 1.

Parameters
devThe device to query.
blockSet to 1 to wait for the Dreameye to respond.
Return values
MAPLE_EOKOn success.
MAPLE_ETIMEOUTThe command timed out while blocking.
MAPLE_EAGAINCould not send the command to the device, try again.