void vOLEDTask( void *pvParameters ) { xOLEDMessage xMessage; unsigned portLONG ulY, ulMaxY; static portCHAR cMessage[ mainMAX_MSG_LEN ]; extern volatile unsigned portLONG ulMaxJitter; unsigned portBASE_TYPE uxUnusedStackOnEntry; const unsigned portCHAR *pucImage; // Functions to access the OLED. void ( *vOLEDInit )( unsigned portLONG ) = NULL; void ( *vOLEDStringDraw )( const portCHAR *, unsigned portLONG, unsigned portLONG, unsigned portCHAR ) = NULL; void ( *vOLEDImageDraw )( const unsigned portCHAR *, unsigned portLONG, unsigned portLONG, unsigned portLONG, unsigned portLONG ) = NULL; void ( *vOLEDClear )( void ) = NULL; vOLEDInit = RIT128x96x4Init; vOLEDStringDraw = RIT128x96x4StringDraw; vOLEDImageDraw = RIT128x96x4ImageDraw; vOLEDClear = RIT128x96x4Clear; ulMaxY = mainMAX_ROWS_96; pucImage = pucBasicBitmap; // Just for demo purposes. uxUnusedStackOnEntry = uxTaskGetStackHighWaterMark( NULL ); ulY = ulMaxY; /* Initialise the OLED */ vOLEDInit( ulSSI_FREQUENCY ); while( 1 ) { // Wait for a message to arrive that requires displaying. xQueueReceive( xOLEDQueue, &xMessage, portMAX_DELAY ); // Write the message on the next available row. ulY += mainCHARACTER_HEIGHT; if( ulY >= ulMaxY ) { ulY = mainCHARACTER_HEIGHT; vOLEDClear(); } // Display the message sprintf( cMessage, "%s", xMessage.pcMessage); vOLEDStringDraw( cMessage, 0, ulY, mainFULL_SCALE ); } }
void vOLEDTask( void *pvParameters ) { xOLEDMessage xMessage; unsigned portLONG ulY, ulMaxY; static portCHAR cMessage[ mainMAX_MSG_LEN ]; extern volatile unsigned portLONG ulMaxJitter; unsigned portBASE_TYPE uxUnusedStackOnEntry, uxUnusedStackNow; const unsigned portCHAR *pucImage; /* Functions to access the OLED. The one used depends on the dev kit being used. */ /* tBoolean is defined as a unsigned char in hw_types.h */ void ( *vOLEDInit )( unsigned portCHAR ) = NULL; void ( *vOLEDStringDraw )( const portCHAR *, unsigned portLONG, unsigned portLONG ) = NULL; void ( *vOLEDImageDraw )( const unsigned portCHAR *, unsigned portLONG, unsigned portLONG, unsigned portLONG, unsigned portLONG ) = NULL; void ( *vOLEDClear )( void ) = NULL; /* Just for demo purposes. */ uxUnusedStackOnEntry = uxTaskGetStackHighWaterMark( NULL ); /* Point display functions to SSD driver functions */ vOLEDInit = Display96x16x1Init; vOLEDStringDraw = Display96x16x1StringDraw; vOLEDImageDraw = Display96x16x1ImageDraw; vOLEDClear = Display96x16x1Clear; ulMaxY = mainMAX_ROWS_16; pucImage = pucBasicBitmap; ulY = ulMaxY; /* Initialise the OLED and display a startup message. */ vOLEDInit( 1 ); vOLEDStringDraw( "POWERED BY FreeRTOS", 0, 0 ); vOLEDImageDraw( pucImage, 0, mainCHARACTER_HEIGHT + 1, bmpBITMAP_WIDTH, bmpBITMAP_HEIGHT ); for( ;; ) { /* Wait for a message to arrive that requires displaying. */ xQueueReceive( xOLEDQueue, &xMessage, portMAX_DELAY ); /* Write the message on the next available row. */ ulY += mainCHARACTER_HEIGHT; if( ulY >= ulMaxY ) { ulY = mainCHARACTER_HEIGHT; vOLEDClear(); vOLEDStringDraw( pcWelcomeMessage, 0, 0 ); } /* Display the message along with the maximum jitter time from the high priority time test. */ sprintf( cMessage, "%s [%uns]", xMessage.pcMessage, ulMaxJitter * mainNS_PER_CLOCK ); vOLEDStringDraw( cMessage, 0, ulY ); } }
void vOLEDTask( void *pvParameters ) { xOLEDMessage xMessage; unsigned portLONG ulY, ulMaxY; static portCHAR cMessage[ mainMAX_MSG_LEN ]; extern volatile unsigned portLONG ulMaxJitter; unsigned portBASE_TYPE uxUnusedStackOnEntry; const unsigned portCHAR *pucImage; /* Functions to access the OLED. The one used depends on the dev kit being used. */ void ( *vOLEDInit )( unsigned portLONG ) = NULL; void ( *vOLEDStringDraw )( const portCHAR *, unsigned portLONG, unsigned portLONG, unsigned portCHAR ) = NULL; void ( *vOLEDImageDraw )( const unsigned portCHAR *, unsigned portLONG, unsigned portLONG, unsigned portLONG, unsigned portLONG ) = NULL; void ( *vOLEDClear )( void ) = NULL; /* Just for demo purposes. */ uxUnusedStackOnEntry = uxTaskGetStackHighWaterMark( NULL ); /* Map the OLED access functions to the driver functions that are appropriate for the evaluation kit being used. */ switch( HWREG( SYSCTL_DID1 ) & SYSCTL_DID1_PRTNO_MASK ) { case SYSCTL_DID1_PRTNO_6965 : case SYSCTL_DID1_PRTNO_2965 : vOLEDInit = OSRAM128x64x4Init; vOLEDStringDraw = OSRAM128x64x4StringDraw; vOLEDImageDraw = OSRAM128x64x4ImageDraw; vOLEDClear = OSRAM128x64x4Clear; ulMaxY = mainMAX_ROWS_64; pucImage = pucBasicBitmap; break; case SYSCTL_DID1_PRTNO_1968 : case SYSCTL_DID1_PRTNO_8962 : vOLEDInit = RIT128x96x4Init; vOLEDStringDraw = RIT128x96x4StringDraw; vOLEDImageDraw = RIT128x96x4ImageDraw; vOLEDClear = RIT128x96x4Clear; ulMaxY = mainMAX_ROWS_96; pucImage = pucBasicBitmap; break; default : vOLEDInit = vFormike128x128x16Init; vOLEDStringDraw = vFormike128x128x16StringDraw; vOLEDImageDraw = vFormike128x128x16ImageDraw; vOLEDClear = vFormike128x128x16Clear; ulMaxY = mainMAX_ROWS_128; pucImage = pucGrLibBitmap; break; } ulY = ulMaxY; /* Initialise the OLED and display a startup message. */ vOLEDInit( ulSSI_FREQUENCY ); vOLEDStringDraw( "POWERED BY FreeRTOS", 0, 0, mainFULL_SCALE ); vOLEDImageDraw( pucImage, 0, mainCHARACTER_HEIGHT + 1, bmpBITMAP_WIDTH, bmpBITMAP_HEIGHT ); for( ;; ) { /* Wait for a message to arrive that requires displaying. */ xQueueReceive( xOLEDQueue, &xMessage, portMAX_DELAY ); /* Write the message on the next available row. */ ulY += mainCHARACTER_HEIGHT; if( ulY >= ulMaxY ) { ulY = mainCHARACTER_HEIGHT; vOLEDClear(); vOLEDStringDraw( pcWelcomeMessage, 0, 0, mainFULL_SCALE ); } /* Display the message along with the maximum jitter time from the high priority time test. */ sprintf( cMessage, "%s [%uns]", xMessage.pcMessage, ulMaxJitter * mainNS_PER_CLOCK ); vOLEDStringDraw( cMessage, 0, ulY, mainFULL_SCALE ); } }
void vOLEDTask( void *pvParameters ) { xOLEDMessage xMessage; unsigned portLONG ulY, ulMaxY; static portCHAR cMessage[ mainMAX_MSG_LEN ]; extern volatile unsigned portLONG ulMaxJitter; unsigned portBASE_TYPE uxUnusedStackOnEntry; const unsigned portCHAR *pucImage; static int zz=0; // Functions to access the OLED. void ( *vOLEDInit )( unsigned portLONG ) = NULL; void ( *vOLEDStringDraw )( const portCHAR *, unsigned portLONG, unsigned portLONG, unsigned portCHAR ) = NULL; void ( *vOLEDImageDraw )( const unsigned portCHAR *, unsigned portLONG, unsigned portLONG, unsigned portLONG, unsigned portLONG ) = NULL; void ( *vOLEDClear )( void ) = NULL; vOLEDInit = RIT128x96x4Init; vOLEDStringDraw = RIT128x96x4StringDraw; vOLEDImageDraw = RIT128x96x4ImageDraw; vOLEDClear = RIT128x96x4Clear; ulMaxY = mainMAX_ROWS_96; pucImage = pucBasicBitmap; // Just for demo purposes. uxUnusedStackOnEntry = uxTaskGetStackHighWaterMark( NULL ); ulY = ulMaxY; /* Initialise the OLED */ vOLEDInit( ulSSI_FREQUENCY ); long button=0; xMessage.msg=1; while( 1 ) { // RIT128x96x4StringDraw("Oled ", 10, 80, 15); if (Clear){ vOLEDClear();Clear=FALSE;} // Wait for a message to arrive that requires displaying. xQueueReceive( xOLEDQueue, &xMessage, portMAX_DELAY ); // Write the message on the next available row. // ulY += mainCHARACTER_HEIGHT; // button=GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_1); // if( button ==0) // { // if (zz==0){ //ulY = mainCHARACTER_HEIGHT; // vOLEDClear();zz++; // }else if (zz==50){zz=0;} else {zz++;} // } sprintf(cMessage,"%u",GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_1)); vOLEDStringDraw( cMessage, 0, 80, mainFULL_SCALE ); // Display the message // vOLEDClear(); //if (xMessage.msg==1) //{ sprintf( cMessage, "%u", *(xMessage.pIMessage)); vOLEDStringDraw( " ", *xMessage.X_LocI, *xMessage.Y_LocI, mainFULL_SCALE ); vOLEDStringDraw( cMessage, *xMessage.X_LocI, *xMessage.Y_LocI, mainFULL_SCALE ); sprintf( cMessage, "%s", xMessage.pcMessage); vOLEDStringDraw( cMessage, *xMessage.X_Locs, *xMessage.Y_Locs, mainFULL_SCALE ); //} //else { // sprintf( cMessage, "%u", *(xMessage.pIMessage)); // vOLEDStringDraw( " ", *xMessage.X_LocI, *xMessage.Y_LocI, mainFULL_SCALE ); //} // break; } }
// *************** vOLEDTask *************** void vOLEDTask( void *pvParameters ) { xOLEDMessage xMessage; unsigned portLONG ulY, ulMaxY; // unsigned portBASE_TYPE uxUnusedStackOnEntry; /* Functions to access the OLED. The one used depends on the dev kit being used. */ void ( *vOLEDInit )( unsigned portLONG ) = NULL; void ( *vOLEDStringDraw )( const portCHAR *, unsigned portLONG, unsigned portLONG, unsigned portCHAR ) = NULL; void ( *vOLEDImageDraw )( const unsigned portCHAR *, unsigned portLONG, unsigned portLONG, unsigned portLONG, unsigned portLONG ) = NULL; void ( *vOLEDClear )( void ) = NULL; /* Create the queue used by the OLED task. Messages for display on the OLED are received via this queue. */ xOLEDQueue = xQueueCreate( mainOLED_QUEUE_SIZE, sizeof( xOLEDMessage ) ); /* Get the "high water mark" for this thread's stack. This value indicates the smallest amount of unused stack reached for this thread. A value of 0 means the thread has either filled or overflowed its stack. Note that this function call is for demo only and serves no purpose here. */ // uxUnusedStackOnEntry = uxTaskGetStackHighWaterMark( NULL ); /* Map the OLED access functions to the driver functions that are appropriate for the evaluation kit being used. */ switch( HWREG( SYSCTL_DID1 ) & SYSCTL_DID1_PRTNO_MASK ) { // case SYSCTL_DID1_PRTNO_6965 : // case SYSCTL_DID1_PRTNO_2965 : vOLEDInit = OSRAM128x64x4Init; // vOLEDStringDraw = OSRAM128x64x4StringDraw; // vOLEDImageDraw = OSRAM128x64x4ImageDraw; // vOLEDClear = OSRAM128x64x4Clear; // ulMaxY = mainMAX_ROWS_64; // break; // case SYSCTL_DID1_PRTNO_1968 : case SYSCTL_DID1_PRTNO_8962 : default : vOLEDInit = RIT128x96x4Init; vOLEDStringDraw = RIT128x96x4StringDraw; vOLEDImageDraw = RIT128x96x4ImageDraw; vOLEDClear = RIT128x96x4Clear; ulMaxY = mainMAX_ROWS_96; break; // default : vOLEDInit = vFormike128x128x16Init; // vOLEDStringDraw = vFormike128x128x16StringDraw; // vOLEDImageDraw = vFormike128x128x16ImageDraw; // vOLEDClear = vFormike128x128x16Clear; // ulMaxY = mainMAX_ROWS_128; // break; } ulY = ulMaxY; /* Initialise the OLED and display a startup message. */ vOLEDInit( ulSSI_FREQUENCY ); vOLEDStringDraw( "POWERED BY FreeRTOS", 0, 0, mainFULL_SCALE ); for( ;; ) { /* Wait for a message to arrive that requires displaying. */ xQueueReceive( xOLEDQueue, &xMessage, portMAX_DELAY ); /* Write the message on the next available row. */ ulY += mainCHARACTER_HEIGHT; if( ulY >= ulMaxY ) { ulY = mainCHARACTER_HEIGHT; vOLEDClear(); //vOLEDStringDraw( pcWelcomeMessage, 0, 0, mainFULL_SCALE ); } /* Display the message along with the maximum jitter time from the high priority time test. */ vOLEDStringDraw( xMessage.pcMessage, 0, ulY, mainFULL_SCALE ); } }
void vDisplayInit ( void ) { vOLEDInit(); xDisplayQueue = xQueueCreate( 5, 10 ); }