This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/DLPLIGHTCRAFTER: How to use the function API_DefinePatternPix declared in LCR_API.h on DLP Lightcrafter ?

Part Number: DLPLIGHTCRAFTER

Tool/software: Linux

Dear Engineers:

    I have a problem about how to use the API_DefinePatternPix on the DLP Lightcrafter (DM365) Platform. The function is  declared in the file LCR_API.h.

    The function prototype is listed bellow:                             

ErrorCode_t API_DefinePatternPix(PatternCount_t PatternNum, uint32 X, uint32 Y,
uint8 *Data, uint32 Count);

    Could you tell me the meanings of the parameters. And how to use the API_DefinePatternPix function. Can I use the function to generate more than 96 images/patterns?

    Thank you for your time!

Dong Cai

  • Hello,

    From the source code for the function itself:

    **
    * Sets the pattern value for the given pixels
    *
    * @param PatternNum - Pattern number to be set
    * @param X - X position of the pixel
    * @param Y - Y position of the pixel
    * @param Data - Pixel Data
    * @param PixCount - Number of pixels
    *
    * return SUCCESS, FAIL
    */

    Can you describe how you are trying to use this function? It is likely not possible to use it to generate more than 96 patterns, that is the buffer limit of the Lightcrafter.

    -Paul

  • Hi Paul

    Thank you for your answers and time. I am trying to use the Lightcrafter EVM to display at least 1000 patterns in pattern sequences mode. Is there any way to achieve this?

    By the way,are source codes of  functions in LCR_API.h open sources?

    -Dong

  • Hi Dong,

    The source codes for the functions in LCR_API.h are open source, you should be able to find them in the software bundle that is provided on the DLPLIGHTCRAFTER page.

    http://www.ti.com/lcrfw3_win

    Let me know if you can't find the files.

    As for your question on a pattern sequence with 1000 patterns, the Lightcrafter has a limit of 96 bit total planes for internal patterns, so you won't be able to do 1000. You'll have to use streaming mode with video input.


    -Paul

  • Hi Paul

    Thank you for your reply. I have installed the software bundle, but I couldn't find the source codes of functions in LCR_API.h. Could you tell me the location of these codes in software bundle?

    According to your answer, can I take it that the function listed below can only define at most 96 patterns?

    ErrorCode_t API_DefinePatternBMP(PatternCount_t PatternNum, uint16 XOffset, uint16 YOffset, API_DataFunc_t *GetData, void *DataParam);  // declared in LCR_API.h

    Can I use the function to define patterns from BMP files stored in a micro-SD card? The micro-SD card is installed in the Lightcrafter EVM.

    - Dong

  • My apologies - the DM365 source code is somewhere else.

    Please read these threads on how to get it:
    e2e.ti.com/.../1955482

    e2e.ti.com/.../220356

    It may be possible to use define patterns in that way, but you'll have to try it yourself.

    -Paul
  • Hi Paul

    Thank you for your reply. According to threads you mentioned, the source code of functions declared in LCR_API.h is not public. So could you tell me the details about how to use function API_DefinePatternPix ?

    ErrorCode_t API_DefinePatternPix(PatternCount_t PatternNum, uint32 X, uint32 Y, uint8 *Data, uint32 Count);

    I am trying to use the funtion to set all pixels of  a pattern as 1. The bit depth of the pattern is 1. Can the following codes in file cmdh.c do the work?

    int main(void)

    {

    uint8 data = 1;

    API_InitLCr(API_DISP_MODE_SAME); /*Initialize the device and load the default solution*/

    API_InitCmdHandler();

    API_ManageSolution(API_SOL_LOAD, "S99"); //Load Solution

    API_SetDisplayMode(API_DISP_MODE_PTN_SEQ); /*Change Display mode to Pattern Sequence*/

    API_PatternSeqSetting_t Setting; //Define the pattern sequence settings

    Setting.BitDepth = 1;

    Setting.NumPatterns = 2;

    Setting.PatternType = API_PTN_TYPE_NORMAL;

    Setting.InputTriggerType = API_TRIGGER_TYPE_SW;

    Setting.InputTriggerDelay = 0;

    Setting.AutoTriggerPeriod = 1000000 ;

    Setting.ExposureTime = 1500000;

    Setting.LEDSelect = API_LED_GREEN;

    Setting.Playing = 0;

    Setting.Repeat = 1;

    Setting.ExposureRepeat = 0;

    API_SetPatternSeqSetting(&Setting); //Equivalent to 'Set' in GUI

    API_StartPatternSeq(1);

    API_AdvancePatternSeq(); // Display patterns once

    sleep(3);

    API_DefinePatternPix(1, 0, 0, &data, 608*684);

    sleep(2);

    API_AdvancePatternSeq(); // Display patterns again

    API_WaitLoop();

    return 0;

    }

    I have run the codes. The codes can display the patterns two times as expected but there is no difference between two times(i.e. the function didn't change the pattern). Could you tell me the right way to use the function?

    - Dong

  • Hi Dong,

    Sorry for the delay.  This code was written some time back and I'm having trouble finding the usages of the function and what the proper use is. The closest I can find is the following:

    static ErrorCode_t TestPatternSeq(API_TriggerType_t Trigger)
    {
    	PatternCount_t i;
    	int y;
    	uint8 Buffer[CFG_DMD_WIDTH];
    	API_PatternSeqSetting_t Setting = { 0 };
    	API_CamTriggerSetting_t CamSetting = { 0 };
    
    
    	Setting.InvertPatterns = 0;
    	Setting.BitDepth = 1;
    	Setting.ExposureTime = 0;
    	Setting.InputTriggerDelay = 10000;
    	Setting.LEDSelect = API_LED_GREEN;
    	Setting.NumPatterns = 24 * 2;
    	Setting.InputTriggerType = Trigger;
    	Setting.AutoTriggerPeriod = 0;
    
    	if(API_SetPatternSeqSetting(&Setting))
    		THROW(FAIL);
    
    	for(i = 0; i < Setting.NumPatterns; i++)
    	{
    		memset(Buffer, 0, sizeof(Buffer));
    		memset(Buffer + (i * CFG_DMD_WIDTH)/Setting.NumPatterns, 0x1,
    									CFG_DMD_WIDTH/Setting.NumPatterns);
    		for(y = 0; y < CFG_DMD_HEIGHT; y++)
    		{
    			API_DefinePatternPix(i, 0, y, Buffer, CFG_DMD_WIDTH);
    		}
    	}
    
    	if(API_SetDisplayMode(API_DISP_MODE_PTN_SEQ))
    		THROW(FAIL);
    
    	if(API_SetCamTriggerSetting(&CamSetting))
    		THROW(FAIL);
    
    	if(API_StartPatternSeq(1))
    		THROW(FAIL);
    
    	if(Setting.InputTriggerType == API_TRIGGER_TYPE_SW)
    	{
    		for(i = 0; i < Setting.NumPatterns; i++)
    		{
    			if(API_AdvancePatternSeq())
    				THROW(FAIL);
    
    			RTOS_MicroDelay(1000000);
    		}
    	}
    	else if(Setting.InputTriggerType == API_TRIGGER_TYPE_EXTRNAL)
    	{
    		CamSetting.Enable = 1;
    		CamSetting.Polarity = 1;
    		CamSetting.Delay = 50000;
    		CamSetting.PulseWidth = 100;
    		API_SetCamTriggerSetting(&CamSetting);
    
    		RTOS_MicroDelay(10000);
    
    		if(Setting.NumPatterns > 24)
    		{
    			uint32 Period = CamSetting.PulseWidth + 
    								SEQ_MIN_LOAD_TIME + 
    								CamSetting.Delay + 
    								Setting.InputTriggerDelay;
    
    			if(CheckBufSwap(Period * 24, 1000))
    				THROW(FAIL);
    		}
    	}
    
    	return SUCCESS;
    }

    Maybe that will help you out. This function turns out to be rarely used in the API. Just 3 times in fact - once to define the function, once in the header, and once in this function here. Otherwise, we have typically used the DefintePatternBMP function, as shown in the attached file from DM365 example code.

    main.c.txt
    /**************************************************************************************************************************************************
    *                                 Copyright � 2012 Texas Instruments Incorporated - http://www.ti.com/                                            *
    ***************************************************************************************************************************************************
    *  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: *
    *                                                                                                                                                 *
    *    Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.                 *
    *                                                                                                                                                 *
    *    Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the        *
    *    documentation and/or other materials provided with the distribution.                                                                         *
    *                                                                                                                                                 *
    *    Neither the name of Texas Instruments Incorporated nor the names of its contributors may be used to endorse or promote products derived      *
    *    from this software without specific prior written permission.                                                                                *
    *                                                                                                                                                 *
    *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT          *
    *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT     *
    *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT         *
    *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY    *
    *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE      *
    *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                                                                           *
    ***************************************************************************************************************************************************/
    /**
    *
    * @file    main.c
    *
    * @brief	This file contains main() function from where the DM365 Command Interfaces can be called.
    *			This file also contain demo example functions which shows how the APIs can be called in sequence.
    **/
    /**************************************************************************************************************************************************/
    
    #include "common.h"
    #include "error.h"
    #include "lcr_cmd.h"
    
    static void mSleep(unsigned long int mSeconds);
    
    //Demo code show how the DM365 command interfaces can be called.
    static void Demo_1_ReadLightCrafterVersion();
    static void Demo_2_AdjustLEDCurrent();
    static void Demo_3_StaticImageDownload();
    static void Demo_4_DisplayModeChange();
    static void Demo_5_1BppPatternSeqDemo();
    static void Demo_6_8BppPatternSeqDemo();
    static void Demo_7_SolutionDemo();
    
    /* main() function */
    int main(int argc, char *argv[])
    {
        uint8 ch;
    
        //Connect to the LCr H/W via TCP interface
        if(LCR_CMD_Open())
        {
            printf("Unable to connect to the DLP LCr\n");
            return -1;
        }
    
        printf("**********************************************************************************\n");
        printf("Select '1' thru '7' to run a demo, Select '8' to run 'All' demo, and '0' to 'exit'\n");
        printf("**********************************************************************************\n");
        printf("Demo#1 - Reading DLP LightCrafter Version information\n");
        printf("Demo#2 - Adjusting LED Currents\n");
        printf("Demo#3 - Downloading 24bpp image\n");
        printf("Demo#4 - Switching between Display modes - StaticImage/InternalTestPattern/ExternVideo/PatternSequence\n");
        printf("Demo#5 - Configuring 1bpp pattern Sequence\n");
        printf("Demo#6 - Configuring 8bpp pattern Sequence\n");
        printf("Demo#7 - Saving a configuration and then loading them back\n\n");
    
        while((ch=getchar()) != '0')
        {
    
            switch(ch)
            {
            case '1':
                Demo_1_ReadLightCrafterVersion();
                break;
            case '2':
                Demo_2_AdjustLEDCurrent();
                break;
            case '3':
                Demo_3_StaticImageDownload();
                break;
            case '4':
                Demo_4_DisplayModeChange();
                break;
            case '5':
                Demo_5_1BppPatternSeqDemo();
                break;
            case '6':
                Demo_6_8BppPatternSeqDemo();
                break;
            case '7':
                Demo_7_SolutionDemo();
                break;
            case '8':
                Demo_1_ReadLightCrafterVersion();
                Demo_2_AdjustLEDCurrent();
                Demo_3_StaticImageDownload();
                Demo_4_DisplayModeChange();
                Demo_5_1BppPatternSeqDemo();
                Demo_6_8BppPatternSeqDemo();
                Demo_7_SolutionDemo();
                break;
            default:
                break;
            }
    
            printf("*****************************************************\n");
            printf("Select '1' thru '8' to run the demo and '0' to 'exit'\n");
            printf("*****************************************************\n");
    
        }
    
        LCR_CMD_Close();
    
        return 0;
    }
    
    /*Demo-1: How to read the LightCrafter Version */
    static void Demo_1_ReadLightCrafterVersion()
    {
        char verName[LCR_CMD_VERSION_STR_LEN];
    
        printf("\n\n****Running Demo #1 - Reading DLP LightCrafter(TM) Software version(s)****\n\n");
    
        LCR_CMD_GetRevision(REV_DM365,&verName[0]);
        printf("DM365 Revision: %s\n",verName);
    
        LCR_CMD_GetRevision(REV_FPGA,&verName[0]);
        printf("FPGA Revision: %s\n",verName);
    
        LCR_CMD_GetRevision(REV_MSP430,&verName[0]);
        printf("MSP430 Revision: %s\n",verName);
    
    }
    
    
    /*Demo-2: How to adjust LED currents */
    static void Demo_2_AdjustLEDCurrent()
    {
        //Test for LED current update
        LCR_LEDCurrent_t LEDSetting;
        LCR_LEDCurrent_t tempLEDSetting;
    
        printf("\n\n****Running Demo #2 - Adjusting LED Currents****\n\n");
    
        if(LCR_CMD_GetLEDCurrent(&LEDSetting))
        {
            printf("Couldn't read the LED Current setting\n");
        }
        else
        {
            printf("Existing LED Current setting Red = %d\tGreen = %d\tBlue = %d\n",LEDSetting.Red,LEDSetting.Green,LEDSetting.Blue);
            printf("Set MIN 0x00 LED setting\n");
            tempLEDSetting.Red = 0;
            tempLEDSetting.Green = 0;
            tempLEDSetting.Blue = 0;
            if(LCR_CMD_SetLEDCurrent(&tempLEDSetting))
            {
                printf("Couldn't set the LED Currents\n");
            }
            else
            {
                mSleep(3000);
                printf("Set MAX 0x3FF LED setting\n");
                tempLEDSetting.Red = 0x3FF;
                tempLEDSetting.Green = 0x3FF;
                tempLEDSetting.Blue = 0x3FF;
                if(LCR_CMD_SetLEDCurrent(&tempLEDSetting))
                {
                    printf("Couldn't set the LED Currents\n");
                }
                else
                {
                    mSleep(3000);
                    printf("Set default values of LED setting\n");
                    LCR_CMD_SetLEDCurrent(&LEDSetting);
                }
            }
    
        }
    }
    
    /* Demo-3: How to download a 24bpp static image */
    static void Demo_3_StaticImageDownload()
    {
        printf("\n\n****Running Demo #3 - Downloading 24bpp static image****\n\n");
        //Set display mode to 0x00 - static image
        LCR_CMD_SetDisplayMode((LCR_DisplayMode_t)(0x00));
    
        printf("Downloading RGB888 Color Ramp Image \n");
        LCR_CMD_DisplayStaticImage("..\\Images\\StaticImages\\Color_RGB888.bmp");
        mSleep(3000);
    
        printf("Downloading LightCrafter image\n");
        LCR_CMD_DisplayStaticImage("..\\Images\\StaticImages\\LightCrafter.bmp");
        mSleep(3000);
    
        printf("Downloading Mangrove\n");
        LCR_CMD_DisplayStaticImage("..\\Images\\StaticImages\\Mangrove.bmp");
        mSleep(3000);
    
        printf("Displaying static pleasing color...\n");
        uint32 color;
        color = 0x00FFFFFF;
        LCR_CMD_DisplayStaticColor(color);
        mSleep(3000);
    
        printf("Downloading RGB888 ramp again...\n");
        LCR_CMD_DisplayStaticImage("..\\Images\\StaticImages\\Color_RGB888.bmp");
    }
    
    /* Demo-4: Cycle through Display Modes */
    static void Demo_4_DisplayModeChange()
    {
        printf("\n\n****Running Demo #4 - Display Mode changine****\n\n");
    
        LCR_DisplayMode_t Mode;
        Mode = LCR_CMD_GetDisplayMode();
        printf("Default display Mode: %d\n",Mode);
    
        printf("Setting Display Mode = Static Image\n");
        LCR_CMD_SetDisplayMode((LCR_DisplayMode_t)(0x00));
        mSleep(3000);
    
        printf("Setting Display Mode = Internal Test Pattern\n");
        LCR_CMD_SetDisplayMode((LCR_DisplayMode_t)(0x01));
        mSleep(3000);
    
        printf("Setting Display Mode = HDMI Video, if HDMI is connected to a source you will get video\n");
        LCR_CMD_SetDisplayMode((LCR_DisplayMode_t)(0x02));
        mSleep(3000);
    
        printf("Setting Display Mode = Pattern Seq Mode\n");
        Demo_5_1BppPatternSeqDemo();
        LCR_CMD_SetDisplayMode((LCR_DisplayMode_t)(0x04));
        mSleep(3000);
    
        LCR_CMD_SetDisplayMode((LCR_DisplayMode_t)(Mode));
    }
    
    /* Demo-5: Pattern Sequence Demo (1BPP) */
    static void Demo_5_1BppPatternSeqDemo()
    {
        uint8 i;
        LCR_PatternSeqSetting_t patSeqSet;
    
        printf("\n\n****Running Demo #5 - 1bpp Pattern Sequence ****\n\n");
    
        LCR_CMD_SetDisplayMode((LCR_DisplayMode_t)(0x04));
    
        printf("Selecting BIT_DEPTH = 1, NUM_PAT = 8, TRIGGER_TYPE = AUTO, AUTO_TRIG_PEIORD = 16667uSec, EXPOSURE = 16000, LED = GREEN\n");
        patSeqSet.BitDepth = 1;
        patSeqSet.NumPatterns = 8;
        patSeqSet.InvertPatterns = 0;
        patSeqSet.InputTriggerDelay = 0;
        patSeqSet.InputTriggerType = 1;
        patSeqSet.AutoTriggerPeriod = 16667;
        patSeqSet.ExposureTime = 16000;
        patSeqSet.LEDSelect = 1;
        LCR_CMD_SetPatternSeqSetting(&patSeqSet);
    
        printf("Downloading pat0\n");
        LCR_CMD_DefinePatternBMP(0,"..\\Images\\PatSeqImages\\pattern_1_00.bmp");
    
        printf("Downloading pat1...\n");
        LCR_CMD_DefinePatternBMP(1,"..\\Images\\PatSeqImages\\pattern_1_01.bmp");
    
        printf("Downloading pat2...\n");
        LCR_CMD_DefinePatternBMP(2,"..\\Images\\PatSeqImages\\pattern_1_02.bmp");
    
        printf("Downloading pat3...\n");
        LCR_CMD_DefinePatternBMP(3,"..\\Images\\PatSeqImages\\pattern_1_03.bmp");
    
        printf("Downloading pat4...\n");
        LCR_CMD_DefinePatternBMP(4,"..\\Images\\PatSeqImages\\pattern_1_04.bmp");
    
        printf("Downloading pat5...\n");
        LCR_CMD_DefinePatternBMP(5,"..\\Images\\PatSeqImages\\pattern_1_05.bmp");
    
        printf("Downloading pat6...\n");
        LCR_CMD_DefinePatternBMP(6,"..\\Images\\PatSeqImages\\pattern_1_06.bmp");
    
        printf("Downloading pat7...\n");
        LCR_CMD_DefinePatternBMP(7,"..\\Images\\PatSeqImages\\pattern_1_07.bmp");
    
        printf("Starting Pattern Sequence...\n");
        LCR_CMD_StartPatternSeq(1);
        mSleep(10000);
        LCR_CMD_StartPatternSeq(0); //Stop pattern sequence
    
        printf("Changing Exposure Time and Trigger time AUTO_TRIG_PEIORD = 500uSec, EXPOSURE = 250uSec ...\n");
        LCR_CMD_GetPatternSeqSetting(&patSeqSet);
        patSeqSet.AutoTriggerPeriod = 500; //500uSec
        patSeqSet.ExposureTime = 250; //250uSec
        LCR_CMD_SetPatternSeqSetting(&patSeqSet);
    
        printf("Starting Pattern Sequence...\n");
        LCR_CMD_StartPatternSeq(1);
        mSleep(5000);
    
        printf("Changing Auto Trigger -> SW Trigger Mode\n");
        LCR_CMD_GetPatternSeqSetting(&patSeqSet);
        patSeqSet.AutoTriggerPeriod = 20000;
        patSeqSet.ExposureTime = 20000;
        patSeqSet.InputTriggerType = 0x00;//Change input trigger to SW
        LCR_CMD_SetPatternSeqSetting(&patSeqSet);
    
        printf("Starting Pattern Sequence...\n");
        LCR_CMD_StartPatternSeq(1);
    
        i = 8;
        while(i--)
        {
            LCR_CMD_AdvancePatternSeq();
            mSleep(1000); //wait for 1Second
        }
    
        LCR_CMD_SetDisplayMode((LCR_DisplayMode_t)(0x00)); //Setting back to static display mode
    }
    
    /* Demo-6: Pattern Sequence Demo (1BPP)  */
    static void Demo_6_8BppPatternSeqDemo()
    {
        uint8 i;
        LCR_PatternSeqSetting_t patSeqSet;
    
        printf("\n\n****Running Demo #6 - 8bpp Pattern Sequence ****\n\n");
    
        LCR_CMD_SetDisplayMode((LCR_DisplayMode_t)(0x04));
    
        printf("Selecting BIT_DEPTH = 8, NUM_PAT = 8, TRIGGER_TYPE = AUTO, AUTO_TRIG_PEIORD = 8334uSec, EXPOSURE = 8000, LED = BLUE\n");
        patSeqSet.BitDepth = 8;
        patSeqSet.NumPatterns = 8;
        patSeqSet.InvertPatterns = 0;
        patSeqSet.InputTriggerDelay = 0;
        patSeqSet.InputTriggerType = 1;
        patSeqSet.AutoTriggerPeriod = 8334;
        patSeqSet.ExposureTime = 8000;
        patSeqSet.LEDSelect = 2;
        LCR_CMD_SetPatternSeqSetting(&patSeqSet);
    
        printf("Downloading pat0\n");
        LCR_CMD_DefinePatternBMP(0,"..\\Images\\PatSeqImages\\pattern_8_00.bmp");
    
        printf("Downloading pat1...\n");
        LCR_CMD_DefinePatternBMP(1,"..\\Images\\PatSeqImages\\pattern_8_01.bmp");
    
        printf("Downloading pat2...\n");
        LCR_CMD_DefinePatternBMP(2,"..\\Images\\PatSeqImages\\pattern_8_02.bmp");
    
        printf("Downloading pat3...\n");
        LCR_CMD_DefinePatternBMP(3,"..\\Images\\PatSeqImages\\pattern_8_03.bmp");
    
        printf("Downloading pat4...\n");
        LCR_CMD_DefinePatternBMP(4,"..\\Images\\PatSeqImages\\pattern_8_04.bmp");
    
        printf("Downloading pat5...\n");
        LCR_CMD_DefinePatternBMP(5,"..\\Images\\PatSeqImages\\pattern_8_05.bmp");
    
        printf("Downloading pat6...\n");
        LCR_CMD_DefinePatternBMP(6,"..\\Images\\PatSeqImages\\pattern_8_06.bmp");
    
        printf("Downloading pat7...\n");
        LCR_CMD_DefinePatternBMP(7,"..\\Images\\PatSeqImages\\pattern_8_07.bmp");
    
        printf("Starting Pattern Sequence...\n");
        LCR_CMD_StartPatternSeq(1);
        mSleep(10000);
        LCR_CMD_StartPatternSeq(0); //Stop pattern sequence
    
        printf("Changing Exposure Time and Trigger time AUTO_TRIG_PEIORD = 16667uSec, EXPOSURE = 16000uSec ...\n");
        LCR_CMD_GetPatternSeqSetting(&patSeqSet);
        patSeqSet.AutoTriggerPeriod = 16667; //uSec
        patSeqSet.ExposureTime = 16000; //uSec
        LCR_CMD_SetPatternSeqSetting(&patSeqSet);
    
        printf("Starting Pattern Sequence...\n");
        LCR_CMD_StartPatternSeq(1);
        mSleep(5000);
    
        printf("Changing Auto Trigger -> SW Trigger Mode\n");
        LCR_CMD_GetPatternSeqSetting(&patSeqSet);
        patSeqSet.AutoTriggerPeriod = 20000;
        patSeqSet.ExposureTime = 20000;
        patSeqSet.InputTriggerType = 0x00;//Change input trigger to SW
        LCR_CMD_SetPatternSeqSetting(&patSeqSet);
    
        printf("Starting Pattern Sequence...\n");
        LCR_CMD_StartPatternSeq(1);
    
        i = 8;
        while(i--)
        {
            LCR_CMD_AdvancePatternSeq();
            mSleep(1000);
        }
    
        LCR_CMD_SetDisplayMode((LCR_DisplayMode_t)(0x00)); //Setting back to static display mode
    }
    
    /* Demo-7: Demonstrated saving, loading and deleting a solution */
    static void Demo_7_SolutionDemo()
    {
        //Create a 1bpp pat sequence and store it as a solution
        LCR_PatternSeqSetting_t patSeqSet;
    
        printf("\n\n****Running Demo #7 - Solution Load, Save and Delete ****\n\n");
    
        printf("Configuring 2bpp pattern sequence mode...\n");
        LCR_CMD_SetDisplayMode((LCR_DisplayMode_t)(0x04));
        LCR_CMD_GetPatternSeqSetting(&patSeqSet);
        patSeqSet.BitDepth = 2;
        patSeqSet.NumPatterns = 2;
        patSeqSet.InvertPatterns = 0;
        patSeqSet.InputTriggerDelay = 0;
        patSeqSet.InputTriggerType = 1;
        patSeqSet.AutoTriggerPeriod = 16667;
        patSeqSet.ExposureTime = 16000;
        patSeqSet.LEDSelect = 2; //Blue LED
        LCR_CMD_SetPatternSeqSetting(&patSeqSet);
        LCR_CMD_DefinePatternBMP(0,"..\\Images\\PatSeqImages\\pattern_2_00.bmp");
        LCR_CMD_DefinePatternBMP(1,"..\\Images\\PatSeqImages\\pattern_2_01.bmp");
        LCR_CMD_StartPatternSeq(1);
    
        //Saving this configuration as solution-1
        printf("Saving it as \"SOLUTION_1\"...\n");
        LCR_CMD_SaveSolution("SOLUTION_1");
    
        LCR_CMD_StartPatternSeq(0);
        printf("Configuring 7bpp pattern sequence mode...\n");
        LCR_CMD_SetDisplayMode((LCR_DisplayMode_t)(0x04));
        LCR_CMD_GetPatternSeqSetting(&patSeqSet);
        patSeqSet.BitDepth = 7;
        patSeqSet.NumPatterns = 2;
        patSeqSet.InvertPatterns = 0;
        patSeqSet.InputTriggerDelay = 0;
        patSeqSet.InputTriggerType = 1;
        patSeqSet.AutoTriggerPeriod = 20000;
        patSeqSet.ExposureTime = 20000;
        patSeqSet.LEDSelect = 1; //Green LED
        LCR_CMD_SetPatternSeqSetting(&patSeqSet);
        LCR_CMD_DefinePatternBMP(0,"..\\Images\\PatSeqImages\\pattern_7_00.bmp");
        LCR_CMD_DefinePatternBMP(1,"..\\Images\\PatSeqImages\\pattern_7_01.bmp");
        LCR_CMD_StartPatternSeq(1);
    
        //Saving this configuration as solution-2
        printf("Saving it as \"SOLUTION_2\"...\n");
        LCR_CMD_SaveSolution("SOLUTION_2");
    
        printf("Switching to static display mode\n");
        LCR_CMD_SetDisplayMode((LCR_DisplayMode_t)(0x04));
        mSleep(5000);
    
        printf("Switching to SOLUTION_1...\n");
        LCR_CMD_ManageSolution(SOL_LOAD, "SOLUTION_1");
        LCR_CMD_StartPatternSeq(1);
        mSleep(5000);
    
        printf("Switching to SOLUTION_2...\n");
        LCR_CMD_ManageSolution(SOL_LOAD, "SOLUTION_2");
        LCR_CMD_StartPatternSeq(1);
        mSleep(5000);
    
        printf("Switching back to SOLUTION_1...\n");
        LCR_CMD_ManageSolution(SOL_LOAD, "SOLUTION_2");
        LCR_CMD_StartPatternSeq(1);
        mSleep(5000);
    
        printf("Printing stored solutions names in the LightCrafter\n");
        uint8 Count;
        uint8 DefaultSolution;
        char SolutionName[LCR_CMD_SOLUTION_NAME_LEN*255];
        LCR_CMD_GetSolutionNames(&Count, &DefaultSolution, &SolutionName[0]);
        int i = 0;
        while(i<(Count*LCR_CMD_SOLUTION_NAME_LEN))
        {
            putchar(SolutionName[i]);
            i++;
        }
        printf("\n");
    
        printf("Deleting solutions SOLUTION_1 & SOLUTION_2\n");
    
        LCR_CMD_ManageSolution(SOL_DELETE,"SOLUTION_1");
    
        LCR_CMD_ManageSolution(SOL_DELETE,"SOLUTION_2");
    
        LCR_CMD_SetDisplayMode((LCR_DisplayMode_t)(0x00)); //Setting back to static display mode
    }
    
    /*Function is used to create delay in mSeconds */
    /* This is used in demo code to show code flow */
    static void mSleep(unsigned long int mSeconds)
    {
        /*Add logic and call system function that will create mSeconds millisecond delay */
        ;
    }
    

    Best,

    Paul

  • Hi Paul,

    Thank you for your reply and time. Your answers are very helpful.

    Best,

    Dong