KallistiOS git master
Independent SDK for the Sega Dreamcast
|
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. | |
Maple driver for the DreamEye peripheral
#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.
#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.
#define DREAMEYE_IMAGEREQ_CONTINUE 0x00 |
Continue transferring an image.
#define DREAMEYE_IMAGEREQ_START 0x40 |
Start transferring an image from its start.
#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.
#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.
#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.
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.
dev | The device to erase from. |
image | The image number to erase (0xFF to erase all). |
block | Set to 1 to wait for the Dreameye to respond. |
MAPLE_EOK | On success. |
MAPLE_EAGAIN | Couldn't send the command, try again. |
MAPLE_ETIMEOUT | Timeout on blocking. |
MAPLE_EINVALID | Invalid image number specified. |
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.
dev | The device to get an image from. |
image | The image number to download. |
data | A 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_sz | A pointer to storage for the size of the image, in bytes. |
MAPLE_EOK | On success. |
MAPLE_EFAIL | On error. |
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.
dev | The device to query. |
block | Set to 1 to wait for the Dreameye to respond. |
MAPLE_EOK | On success. |
MAPLE_ETIMEOUT | The command timed out while blocking. |
MAPLE_EAGAIN | Could not send the command to the device, try again. |