From a21430078f3a4efeea783ddaa271097e25950bd6 Mon Sep 17 00:00:00 2001 From: Kai Lauterbach Date: Sun, 25 Dec 2011 13:50:54 +0100 Subject: [PATCH] Parameter added to the saveFrame function and documentation changed. --- client/demo.c | 2 +- client/ledcube.c | 17 ++--------------- client/ledcube.h | 2 +- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/client/demo.c b/client/demo.c index 7ecc271..0858a51 100644 --- a/client/demo.c +++ b/client/demo.c @@ -84,7 +84,7 @@ void sinus1(int max) // or save the frame to eeprom //tmp = tmp + (k << 27); //if (k < 32) - //lc_saveFrame(tmp, k); + //lc_saveFrame(tmp, k, k); usleep(2500); k++; diff --git a/client/ledcube.c b/client/ledcube.c index 66d1896..fff2da8 100644 --- a/client/ledcube.c +++ b/client/ledcube.c @@ -42,21 +42,6 @@ int lc_setMode(int mode) return usb_control_msg(_lc_handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, CUSTOM_RQ_SET_MODE, mode, 0, _lc_buffer, 0, 300); } -/*! \brief The saveFrame function. - * \param frame The 32bit frame data. Bit 0-8 equals layer one; bit 9 - 17 euqals layer two; bit 18 - 26 equals layer three. the 5 MSB is the lifetime of the current frame in ISR calls (300Hz). - * \param index The position in the EEPROM (0 to 31) of the internal animation content. - * \return NOT_CONNECTED_ERROR or the return value of the usb_control_msg function. - */ -int lc_saveFrame(unsigned long frame, int index) -{ - if (_lc_handle == NULL) - return NOT_CONNECTED_ERROR; - - lc_setFrame(frame); - - return usb_control_msg(_lc_handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, CUSTOM_RQ_EEPROM_STORE_FRAME, 0, index, _lc_buffer, 0, 300); -} - /*! \brief The saveFrame function. * \param frame The 32bit frame data. Bit 0-8 equals layer one; bit 9 - 17 euqals layer two; bit 18 - 26 equals layer three. The 5 MSB is the lifetime of the current frame in ISR calls (300Hz) multiplied by 8. * \param deay The lifetime (onyl 5 bits) of the given frame in ISR calls multiplied by 8. @@ -68,6 +53,8 @@ int lc_saveFrame(unsigned long frame, int delay, int index) if (_lc_handle == NULL) return NOT_CONNECTED_ERROR; + frame = frame + (delay << 27); + lc_setFrame(frame); return usb_control_msg(_lc_handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, CUSTOM_RQ_EEPROM_STORE_FRAME, 0, index, _lc_buffer, 0, 300); diff --git a/client/ledcube.h b/client/ledcube.h index a6e1948..3296b8b 100644 --- a/client/ledcube.h +++ b/client/ledcube.h @@ -41,7 +41,7 @@ int _lc_vid, int lc_setFrame(unsigned long); int lc_setMode(int); -int lc_saveFrame(unsigned long, int); +int lc_saveFrame(unsigned long, int, int); int lc_init(void); int lc_close(void);