本文整理汇总了C++中TExaS_Init函数的典型用法代码示例。如果您正苦于以下问题:C++ TExaS_Init函数的具体用法?C++ TExaS_Init怎么用?C++ TExaS_Init使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TExaS_Init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(void){
TExaS_Init(SSI0_Real_Nokia5110_Scope); // set system clock to 80 MHz
Random_Init(1);
Output_Init();
ST7735_FillScreen(0x0000); // set screen to black
ST7735_DrawBitmap(52, 159, PlayerShip0, 18,8); // player ship middle bottom
ST7735_DrawBitmap(53, 151, Bunker0, 18,5);
ST7735_DrawBitmap(0, 9, SmallEnemy10pointA, 16,10);
ST7735_DrawBitmap(20,9, SmallEnemy10pointB, 16,10);
ST7735_DrawBitmap(40, 9, SmallEnemy20pointA, 16,10);
ST7735_DrawBitmap(60, 9, SmallEnemy20pointB, 16,10);
ST7735_DrawBitmap(80, 9, SmallEnemy30pointA, 16,10);
ST7735_DrawBitmap(100, 9, SmallEnemy30pointB, 16,10);
Delay100ms(50); // delay 5 sec at 80 MHz
ST7735_FillScreen(0x0000); // set screen to black
ST7735_SetCursor(1, 1);
ST7735_OutString("GAME OVER");
ST7735_SetCursor(1, 2);
ST7735_OutString("Nice try,");
ST7735_SetCursor(1, 3);
ST7735_OutString("Earthling!");
ST7735_SetCursor(2, 4);
LCD_OutDec(1234);
while(1){
}
}
示例2: main
int main(void){// activate grader and set system clock to 80 MHz
unsigned long NumberOfPresses = 0; // store the number of presses
unsigned long LastInput = 0; // store the last input of Switch here
TExaS_Init(SW_PIN_PA3, HEADPHONE_PIN_PA2,ScopeOn);
Sound_Init();
EnableInterrupts(); // enable after all initialization are done
while(1){
// main program is free to perform other tasks
// do not use WaitForInterrupt() here, it may cause the TExaS to crash
// perform other tasks - Read the input over and over again:
Switch = GPIO_PORTA_DATA_R & 0x08; // read the switch from PA3
if (Switch != 0 && Switch != LastInput) {
// if the switch is pressed, and last time it was released:
NumberOfPresses++;
// the number of the ACTUAL press increase by 1
}
LastInput = Switch; // save the current input for next time
if (NumberOfPresses%2 == 0) {
// if the number of press is even
// (those presses at the 0, 2nd, 4th, 6th,... time)
GPIO_PORTA_DATA_R &= ~0x04;
// then turn off PA2
} else {
// if the number of press is odd
// (those presses at the 1st, 3rd, 5th, 7th,... time)
WaitForInterrupt();
// then periodically interrupt the system each 880 Hz
// the SysTick will automatically
// trigger itself every (1 s)/(880 Hz) = 1.13636 ms
}
}
}
开发者ID:Zhanglulucat,项目名称:Study-Code-for-UTAustinX-UT.6.03x-Embedded-Systems---Shape-the-World,代码行数:34,代码来源:Lab12_TuningFork.c
示例3: main
int main(void){ unsigned long i,last,now, SW1, SW2;
TExaS_Init(SW_PIN_PF40, LED_PIN_PF1); // activate grader and set system clock to 16 MHz
PortF_Init(); // initialize PF1 to output
SysTick_Init(); // initialize SysTick, runs at 16 MHz
i = 0; // array index
last = NVIC_ST_CURRENT_R;
EnableInterrupts(); // enable interrupts for the grader
while(1){
SW1= GPIO_PORTF_DATA_R & 0x01;
SW2= GPIO_PORTF_DATA_R & 0x10;
if(!SW1 || !SW2)
{
Led = GPIO_PORTF_DATA_R; // read previous
Led = Led^0x02; // toggle red LED
GPIO_PORTF_DATA_R = Led; // output
if(i<50){
now = NVIC_ST_CURRENT_R;
Time[i] = (last-now)&0x00FFFFFF; // 24-bit time difference
//Data[i] = GPIO_PORTF_DATA_R&0x02; // record PF1
Data[i] = GPIO_PORTF_DATA_R&0x13; // record PF1
last = now;
i++;
}
Delay();
}
else
{
GPIO_PORTF_DATA_R &=~0x02 ; // output
}
}
}
示例4: main
int main(void){
unsigned long volatile delay;
unsigned long In;
TExaS_Init(SW_PIN_PF4, LED_PIN_PF2); // activate grader and set system clock to 80 MHz
// initialization goes here
PortF_Init();
EnableInterrupts(); // enable interrupts for the grader
GPIO_PORTF_DATA_R = 0x04;
while(1){
// body goes here
Delay100ms(1);
In = GPIO_PORTF_DATA_R&0x10;
if(In == 0x00)
{
//Switch is pressed toggel PF2
GPIO_PORTF_DATA_R = GPIO_PORTF_DATA_R ^ (1 << 2);
}
else
{
//Switch is not pressed, set PF2 to on
GPIO_PORTF_DATA_R = 0x04;
}
}
}
示例5: main
int main(void){ unsigned long volatile delay;
TExaS_Init(SW_PIN_PF4, LED_PIN_PF2); // activate grader and set system clock to 80 MHz
// initialization goes here
SYSCTL_RCGC2_R |= 0x00000020; // 1) activate clock for Port F
delay = SYSCTL_RCGC2_R; // allow time for clock to start
// GPIO_PORTF_LOCK_R = 0x4C4F434B; // 2) unlock GPIO Port F
// GPIO_PORTF_CR_R = 0x1F; // allow changes to PF4-0
// only PF0 needs to be unlocked, other bits can't be locked
GPIO_PORTF_AMSEL_R &= ~0x14; // 3) disable analog on PF2,4
GPIO_PORTF_PCTL_R &= ~0x000F0F00; // 4) PCTL GPIO on PF2,4
GPIO_PORTF_DIR_R &= ~0x10; // 5) PF4 in,
GPIO_PORTF_DIR_R |= 0x04; // PF2 out
GPIO_PORTF_AFSEL_R &= ~0x14; // 6) disable alt funct on PF7-0
GPIO_PORTF_PUR_R |= 0x10; // enable pull-up on PF4
GPIO_PORTF_DEN_R = 0x14; // 7) enable digital I/O on PF2,4
GPIO_PORTF_DATA_R |= 0x04; // set pf2 on
EnableInterrupts(); // enable interrupts for the grader
while(1){
// body goes
Delay100ms(1);
if(GPIO_PORTF_DATA_R&0x10) GPIO_PORTF_DATA_R |= 0x04;
if(!(GPIO_PORTF_DATA_R&0x10)) GPIO_PORTF_DATA_R ^= 0x04;
}
}
开发者ID:jeromeshi,项目名称:UTAustinX--UT.6.03x-Embedded-Systems--Shape-the-World,代码行数:28,代码来源:BranchingFunctionsDelays.c
示例6: main
// *************************** Capture image dimensions out of BMP**********
int main(void){
TExaS_Init(SSI0_Real_Nokia5110_Scope); // set system clock to 80 MHz
Random_Init(69);
Output_Init();
ADC0_Init();
ST7735_InvertDisplay(0);
ST7735_SetRotation(0);
AI_Init(0x07);
Player_Init();
player.potato=1;
Timer0_Init(Master_Funk, 30);
ST7735_DrawBitmap(53, 151, Bunker0, 18,5);
// Delay100ms(1); // delay 5 sec at 80 MHz
/* ST7735_FillScreen(0x0000); // set screen to black
ST7735_SetCursor(1, 1);
ST7735_OutString("GAME OVER");
ST7735_SetCursor(1, 2);
ST7735_OutString("Nice try,");
ST7735_SetCursor(1, 3);
ST7735_OutString("Earthling!");
ST7735_SetCursor(2, 4);
LCD_OutDec(1234); */
while(1){
}
}
示例7: main1
int main1(void){ // single step this program and look at Data
TExaS_Init(); // Bus clock is 80 MHz
ADC_Init(); // turn on ADC, set channel to 1
while(1){
Data = ADC_In(); // sample 12-bit channel 1
}
}
示例8: main
int main(void){
DisableInterrupts();
TExaS_Init(SSI0_Real_Nokia5110_Scope); // set system clock to 80 MHz
Random_Init(1);
Nokia5110_Init();
PF1Init();
//SysTick_Init(2666666); //Initialize SysTick with 30 Hz interrupts
SysTick_Init(2666666*4); //Increased period by 4 for actual hardware to make the game run at a playable speed
Nokia5110_ClearBuffer();
Nokia5110_DisplayBuffer(); // draw buffer
ADC0_Init();
Game_Init();
SwitchLed_Init();
Sound_Init();
Timer2_Init(&Sound_Play,7256); //11.025 kHz. 80,000,000/11,025 cycles, which is about 7256
GameOverFlag = 0;
EnableInterrupts();
while(1){
while(Semaphore==0){};
Semaphore = 0;
if(GameOverFlag){
State_GameOver();
}
else{
Draw_GameFrame(); // update the LCD
}
if((GameOverFlag == 0) && (Check_GameOver())){ //just detected game over
Delay100ms(2);//Delay 200ms
GameOverFlag = Check_GameOver();
//SysTick_Init(2666666);//Re-initialize with 30 Hz interrupt
SysTick_Init(2666666*4); //Increased period by 4 for actual hardware to make the game run at a playable speed
}
}
}
示例9: main
int main(void){
TExaS_Init(SSI0_Real_Nokia5110_Scope); // set system clock to 80 MHz
Random_Init(1);
Nokia5110_Init();
Nokia5110_ClearBuffer();
Nokia5110_DisplayBuffer(); // draw buffer
Nokia5110_PrintBMP(32, 47, PlayerShip0, 0); // player ship middle bottom
Nokia5110_PrintBMP(33, 47 - PLAYERH, Bunker0, 0);
Nokia5110_PrintBMP(0, ENEMY10H - 1, SmallEnemy10PointA, 0);
Nokia5110_PrintBMP(16, ENEMY10H - 1, SmallEnemy20PointA, 0);
Nokia5110_PrintBMP(32, ENEMY10H - 1, SmallEnemy20PointA, 0);
Nokia5110_PrintBMP(48, ENEMY10H - 1, SmallEnemy30PointA, 0);
Nokia5110_PrintBMP(64, ENEMY10H - 1, SmallEnemy30PointA, 0);
Nokia5110_DisplayBuffer(); // draw buffer
Delay100ms(50); // delay 5 sec at 50 MHz
Nokia5110_Clear();
Nokia5110_SetCursor(1, 1);
Nokia5110_OutString("GAME OVER");
Nokia5110_SetCursor(1, 2);
Nokia5110_OutString("Nice try,");
Nokia5110_SetCursor(1, 3);
Nokia5110_OutString("Earthling!");
Nokia5110_SetCursor(2, 4);
Nokia5110_OutUDec(1234);
while(1){
}
}
示例10: main
int main(void){
volatile unsigned long delay;
//TExaS_Init(ADC0_AIN1_PIN_PE2, SSI0_Real_Nokia5110_NoScope);
TExaS_Init(ADC0_AIN1_PIN_PE2, SSI0_Real_Nokia5110_Scope);
ADC0_Init(); // initialize ADC0, channel 1, sequencer 3
Nokia5110_Init(); // initialize Nokia5110 LCD
SysTick_Init(1999999); // initialize SysTick for 40 Hz interrupts
// initialize profiling on PF1 (optional)
// wait for clock to stabilize
SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOF; // activate port F
delay = SYSCTL_RCGC2_R;
GPIO_PORTF_DIR_R |= 0x04; // make PF2 out (built-in LED)
GPIO_PORTF_AFSEL_R &= ~0x04; // disable alt funct on PF2
GPIO_PORTF_DEN_R |= 0x04; // enable digital I/O on PF2
// configure PF2 as GPIO
GPIO_PORTF_PCTL_R = (GPIO_PORTF_PCTL_R&0xFFFFF0FF)+0x00000000;
GPIO_PORTF_AMSEL_R = 0; // disable analog functionality on PF
EnableInterrupts();
Nokia5110_Clear();
Nokia5110_OutString((unsigned char *)"UT.6.01x Lab 14 Start");
while(1){
if(Flag) {
UART_ConvertDistance(Distance);
Nokia5110_SetCursor(0, 3);
Nokia5110_OutString(String);
Flag = 0;
}
}
}
示例11: main
int main(void){
//Initialize all below:
TExaS_Init(); // Bus clock is 80 MHz
ADC_Init(); // initialize to sample ADC1
ST7735_InitR(INITR_REDTAB);
SysTick_Init();
UART_Init();
FiFo_Init();
PortF_Init();
EnableInterrupts();
while(1){
while(ADCStatus == 0){}; //Poll ADCStatus flag
ADCStatus = 0; //clear flag
//Prints from a full FIFO --> BUT must know when
//we get to the end --> uses while loop to check this condition,
//and a for loop to print 5 times
ST7735_SetCursor(6,5);
//Infinite loop if the fifo is empty / if returns fail
while (FiFo_Get(&data) == 0) {};
FiFo_Get(&data);
for(int i = 1; i <= 5; i++){
ST7735_OutChar(data);
FiFo_Get(&data);
}
FiFo_Get(&data);
FiFo_Get(&data);
ST7735_SetCursor(12,5);
ST7735_OutString(" cm"); // print " cm"
}
}
示例12: main
int main(void){
TExaS_Init(SW_PIN_PE3210,DAC_PIN_PB3210,ScopeOn); // bus clock at 80 MHz
//Timer0A_Init(&songTask, F80HZ);
Piano_Init();
Sound_Init(0);
DAC_Init();
Heartbeat_Init();
// other initialization
EnableInterrupts();
uint32_t input;
while(1){
GPIO_PORTF_DATA_R ^= 0x04;
input = Piano_In();
if (input == 0x04){
Sound_Play(A);
}
else if (input == 0x02){
Sound_Play(C);
}
else if (input == 0x01){
Sound_Play(Eb);
}
else if (input == 0x07){
Sound_Play(A);
}
else {
Sound_Play(0);
}
}
}
示例13: main
int main(void){
TExaS_Init(); // Bus clock is 80 MHz
ST7735_InitR(INITR_REDTAB);
PortF_Init();
ADC_Init(); // turn on ADC, set channel to 1
SysTick_Init(); //Initialize SysTick
for(;;){
while(ADCStatus == 0){} //Poll ADCStatus flag
uint32_t x = ADCMail; //read ADCMail (input)
ADCStatus = 0; //clear flag
x = Convert(x); //convert the input
ST7735_SetCursor(1,7);
ST7735_OutString("D = "); //print "D = "
ST7735_SetCursor(5,7);
LCD_OutFix(x); // print the fixed point value
ST7735_SetCursor(10,7);
ST7735_OutString(" cm"); // print " cm"
/////////////////////
ST7735_SetCursor(1,2);
ST7735_OutString("Lab 8:");
ST7735_SetCursor(1,3);
ST7735_OutString("Measurment of");
ST7735_SetCursor(1,4);
ST7735_OutString("Distance :)");
}
}
示例14: main
int main(void){ // for the real board grader to work, you must connect PD3 to your DAC output
int piano; // to read current piano keys
int prevPiano; // to store piano keys in prev cycle
TExaS_Init(SW_PIN_PE3210, DAC_PIN_PB3210,ScopeOn); // activate grader and set system clock to 80 MHz
Sound_Init(); // initialize SysTick timer and DAC
Piano_Init();
EnableInterrupts(); // enable after all initialization are done
while(1){
piano = Piano_In();
if(piano != prevPiano){ // only react if piano keys pressed
if(piano == 0x00)
Sound_Off();
else if(piano == 0x01)
Sound_Tone(2389);
else if(piano == 0x02)
Sound_Tone(2128);
else if(piano == 0x04)
Sound_Tone(1896);
else if(piano == 0x08)
Sound_Tone(1594);
delay(10);
}
prevPiano = piano;
}
}
示例15: main
// 3. Subroutines Section
// MAIN: Mandatory for a C Program to be executable
int main(void){
TExaS_Init(SW_PIN_PF40, LED_PIN_PF31,ScopeOn); // activate grader and set system clock to 80 MHz
PortF_Init(); // Init port PF4 PF3 PF1
EnableInterrupts(); // enable interrupts for the grader
while(1){
SetReady();
WaitForASLow();
ClearReady();
Delay1ms(10);
WaitForASHigh();
Delay1ms(250);
SetVT();
Delay1ms(250);
ClearVT();
// Follows the nine steps list above
// a) Ready signal goes high
// b) wait for switch to be pressed
// c) Ready signal goes low
// d) wait 10ms
// e) wait for switch to be released
// f) wait 250ms
// g) VT signal goes high
// h) wait 250ms
// i) VT signal goes low
}
}