X-Git-Url: https://git.ao2.it/libam7xxx.git/blobdiff_plain/1caaf22426a7442b45872faf7f9f108d9c66baf0..0dc71915ae5b5abee6b40154e8fd07c4057e7bd4:/src/am7xxx.h diff --git a/src/am7xxx.h b/src/am7xxx.h index 51f9324..d103c22 100644 --- a/src/am7xxx.h +++ b/src/am7xxx.h @@ -1,6 +1,6 @@ /* am7xxx - communication with AM7XXX based USB Pico Projectors and DPFs * - * Copyright (C) 2012 Antonio Ospite + * Copyright (C) 2012-2014 Antonio Ospite * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -105,6 +105,29 @@ typedef enum { } am7xxx_power_mode; /** + * The display zoom modes. + * + * An am7xxx device can display images using several zoom modes. + * + * @note Changing the zoom mode can change the aspect ratio of the displayed + * image. + * + * @note On the zoom test screen the version of the firmware running on the + * device is shown as well (e.g SPI_V21.0.0_2011.03.18). + * + * @note The Tele mode is available only on some PicoPix models, when using it + * the image is distorted like if a different lens was used, but the global + * aspect ratio of the image does not change. + */ +typedef enum { + AM7XXX_ZOOM_ORIGINAL = 0, /**< Original Size, as retrieved via #am7xxx_device_info. */ + AM7XXX_ZOOM_H = 1, /**< Zoom 1: H Scale (changes aspect ratio). */ + AM7XXX_ZOOM_H_V = 2, /**< Zoom 2: H/V Scale (changes aspect ratio). */ + AM7XXX_ZOOM_TEST = 3, /**< Zoom test screen, the firmware version is shown as well. */ + AM7XXX_ZOOM_TELE = 4, /**< Zoom Tele: available on some PicoPix models. */ +} am7xxx_zoom_mode; + +/** * Initialize the library context and data structures, and scan for devices. * * @param[out] ctx A pointer to the context the library will be used in. @@ -201,7 +224,7 @@ int am7xxx_calc_scaled_image_dimensions(am7xxx_device *dev, unsigned int *scaled_width, unsigned int *scaled_height); /** - * Send an image for display on a am7xxx device. + * Send an image for display on an am7xxx device. * * This is the function that actually makes the device display something. * Static pictures can be sent just once and the device will keep showing them @@ -224,19 +247,66 @@ int am7xxx_send_image(am7xxx_device *dev, unsigned int image_size); /** - * Set the power mode of an am7xxx device. + * Queue transfer of an image for display on an am7xxx device and return immediately. * - * \note If we set the mode to AM7XXX_POWER_OFF we can't turn the - * display on again by using only am7xxx_set_power_mode(). This needs to be - * investigated, maybe some other command can reset the device. + * This is the function that actually makes the device display something. + * Static pictures can be sent just once and the device will keep showing them + * until another image get sent or some command resets or turns off the display. + * + * @note This _async() variant makes a copy of the image buffer, so the caller + * is free to reuse the buffer just after the function returns. * * @param[in] dev A pointer to the structure representing the device to get info of - * @param[in] mode The power mode to put the device in (see @link am7xxx_power_mode @endlink enum) + * @param[in] format The format the image is in (see @link am7xxx_image_format @endlink enum) + * @param[in] width The width of the image + * @param[in] height The height of the image + * @param[in] image A buffer holding data in the format specified by the format parameter + * @param[in] image_size The size in bytes of the image buffer + * + * @return 0 on success, a negative value on error + */ +int am7xxx_send_image_async(am7xxx_device *dev, + am7xxx_image_format format, + unsigned int width, + unsigned int height, + unsigned char *image, + unsigned int image_size); + +/** + * Set the power mode of an am7xxx device. + * + * @note When setting the mode to AM7XXX_POWER_OFF the display can't be turned + * on again by using only am7xxx_set_power_mode(), am7xxx_set_zoom_mode() has + * to be called first, the current guess is that the latter performs some + * other resets beside setting the zoom mode. + * + * @param[in] dev A pointer to the structure representing the device to set power mode to + * @param[in] power The power mode to put the device in (see #am7xxx_power_mode enum) + * + * @return 0 on success, a negative value on error + * + */ +int am7xxx_set_power_mode(am7xxx_device *dev, am7xxx_power_mode power); + +/** + * Set the zoom mode of an am7xxx device. + * + * @note When setting the mode to AM7XXX_ZOOM_TEST, the calling program might + * want to skip displaying actual images. + * + * @note It looks like that power mode and zoom mode are related somehow wrt. + * resetting the operational mode after AM7XXX_POWER_OFF, applications can + * restore the display properly using this combination: + * - Off: power mode 0, zoom mode 3 + * - On: power mode != 0, zoom mode != 3 + * + * @param[in] dev A pointer to the structure representing the device to set zoom mode to + * @param[in] zoom The zoom mode to put the device in (see #am7xxx_zoom_mode enum) * * @return 0 on success, a negative value on error * */ -int am7xxx_set_power_mode(am7xxx_device *dev, am7xxx_power_mode mode); +int am7xxx_set_zoom_mode(am7xxx_device *dev, am7xxx_zoom_mode zoom); #ifdef __cplusplus }