int main(void) { /* Write your local variable definition here */ uint32 i = 0; /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ /* Write your code here */ //printf ("\n\n"); //printf("********************************************************\n"); //printf("* \n"); //printf("* Running SPI Demo, Master & Slave exchanged messages \n"); //printf("* Before continuing connect SPI0(Master) \n"); //printf("* to SPI1 (Slave) as outlined below \n"); //printf("* \n"); //printf("* MOSI: PTA17 (J2 pin 11) to PTE1 (J2 pin 20) \n"); //printf("* MISO: PTA16 (J2 pin 9) to PTE3 (J9 pin 11) \n"); //printf("* SCK: PTC5 (J1 pin 9) to PTE2 (J9 pin 9) \n"); //printf("* PCS0: PTC4 (J1 pin 7) to PTE4 (J9 pin 13) \n"); //printf("* \n"); //printf("* Then enter any key to continue \n"); //printf("* \n"); //printf("********************************************************\n"); //printf ("\n\n"); /* Slave receiving some message from master*/ SS1_ReceiveBlock(SS1_DeviceData, slave_receive, COMM_SIZE); for(;;){ for(i=0;i<10000;i++){ //printf("\nSlave: first sending\n"); } //Delay } /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/ #ifdef PEX_RTOS_START PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */ #endif /*** End of RTOS startup code. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ return 0; } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
/*lint -save -e970 Disable MISRA rule (6.3) checking. */ int main(void) /*lint -restore Enable MISRA rule (6.3) checking. */ { /* Write your local variable definition here */ /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ //test(); #if PL_HAS_SD_CARD /* SD card detection: PTE6 with pull-down! */ PORT_PDD_SetPinPullSelect(PORTE_BASE_PTR, 6, PORT_PDD_PULL_DOWN); PORT_PDD_SetPinPullEnable(PORTE_BASE_PTR, 6, PORT_PDD_PULL_ENABLE); #endif #if PL_HAS_KEYS /* SW3: PTA4 */ PORT_PDD_SetPinPullSelect(PORTA_BASE_PTR, 4, PORT_PDD_PULL_UP); PORT_PDD_SetPinPullEnable(PORTA_BASE_PTR, 4, PORT_PDD_PULL_ENABLE); /* SW2: PTC6 */ PORT_PDD_SetPinPullSelect(PORTC_BASE_PTR, 6, PORT_PDD_PULL_UP); PORT_PDD_SetPinPullEnable(PORTC_BASE_PTR, 6, PORT_PDD_PULL_ENABLE); #endif #if PL_HAS_BLUETOOTH /* pull up Rx pin (PTC14) for Bluetooth module */ PORT_PDD_SetPinPullSelect(PORTC_BASE_PTR, 14, PORT_PDD_PULL_UP); PORT_PDD_SetPinPullEnable(PORTC_BASE_PTR, 14, PORT_PDD_PULL_ENABLE); #endif LED1_On(); WAIT1_Waitms(50); LED1_Off(); WAIT1_Waitms(50); LED2_On(); WAIT1_Waitms(50); LED2_Off(); WAIT1_Waitms(50); LED3_On(); WAIT1_Waitms(50); LED3_Off(); WAIT1_Waitms(50); APP_Start(); /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/ #ifdef PEX_RTOS_START PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */ #endif /*** End of RTOS startup code. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
/*lint -save -e970 Disable MISRA rule (6.3) checking. */ int main(void) /*lint -restore Enable MISRA rule (6.3) checking. */ { /* Write your local variable definition here */ /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ /* Write your code here */ /* For example: for(;;) { } */ byte c, err; for (;;) { do { err = UART_RecvChar(&c); } while(err != ERR_OK); sendString("Press R, G or B to toggle the red, green or blue LEDs.\r\nPress ESC to close.\r\n"); do { do { err = UART_RecvChar(&c); } while(err != ERR_OK); if (c == 0x52 || c == 0x72) { Red_NegVal(); sendString("Toggle red.\r\n"); } else if (c == 0x47 || c == 0x67) { Green_NegVal(); sendString("Toggle green.\r\n"); } else if (c == 0x42 || c == 0x62) { Blue_NegVal(); sendString("Toggle blue.\r\n"); } } while(c != 0x1B); sendString("Press any key to start.\r\n"); Red_SetVal(); Green_SetVal(); Blue_SetVal(); } /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/ #ifdef PEX_RTOS_START PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */ #endif /*** End of RTOS startup code. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
void main(void) { /* Write your local variable definition here */ /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ Cap1_Reset(); /* Write your code here */ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
void main(void) { /* Write your local variable definition here */ BOOT_PreInit(); /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ BOOT_Start(); /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
/*lint -save -e970 Disable MISRA rule (6.3) checking. */ int main(void) /*lint -restore Enable MISRA rule (6.3) checking. */ { /* Write your local variable definition here */ /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ for(;;) { LEDR_On(); WAIT1_Waitms(500); LEDR_Off(); WAIT1_Waitms(500); LEDG_On(); WAIT1_Waitms(500); LEDG_Off(); LEDB_On(); WAIT1_Waitms(500); LEDB_Off(); LEDR_SetRatio16(0xc000); WAIT1_Waitms(500); LEDR_SetRatio16(0x8000); WAIT1_Waitms(500); LEDR_SetRatio16(0x4000); WAIT1_Waitms(500); LEDR_SetRatio16(0x1000); WAIT1_Waitms(500); LEDR_SetRatio16(0x500); WAIT1_Waitms(500); LEDR_SetRatio16(0x100); WAIT1_Waitms(500); } /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/ #ifdef PEX_RTOS_START PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */ #endif /*** End of RTOS startup code. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
/*lint -save -e970 Disable MISRA rule (6.3) checking. */ int main(void) /*lint -restore Enable MISRA rule (6.3) checking. */ { /* Write your local variable definition here */ enum logics{false, true}; uint16_t rotation = 0; /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ /* Write your code here */ lcd_init(Background); add2display((unsigned char *)"University of Nairobi",0); add2display((unsigned char *)" Physics Department ",0); add2display((unsigned char *)" another string for ",0); add2display((unsigned char *)" another string menu ",0); selected=0; while(1){ if(rotation>3) rotation = 0; if(selected>3) selected=0; lcd_setOrientation(rotation); lcd_clear(Background); display(); //lcd_invert(rotation); lcd_fillrect(10,50,40,60, blue); lcd_drawrect(10,50,40,60, red); lcd_drawline(11,51,39,59, green); lcd_drawcircle(30, 100,10, red); lcd_fillcircle(30, 100,10, crimson); WAIT1_Waitms(1000); selected++; rotation++; } /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/ #ifdef PEX_RTOS_START PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */ #endif /*** End of RTOS startup code. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
void main(void) { /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ nLoop = 0; SCIcount=0; AD1_Start(); Puls1_Enable(); Puls2_Enable(); TI1_DisableEvent(); Cpu_Delay100US(10000); if(!AD_Flag) { calibrateSensor(); TI1_EnableEvent(); AD_Flag = 1; } //---------------------------------------------------------------- for(;;) { nLoop ++; if(nLoop >= LOOP_TIME) nLoop = 0; else continue; //---------------------------------------------------------------- if((g_fGyroscopeAngleIntegral < 50.0) && (g_fGyroscopeAngleIntegral > -50.0)) //ж╠а╒еп╤о standFlag = 1; else if((g_fGyroscopeAngleIntegral >= 50.0) || (g_fGyroscopeAngleIntegral <= -50.0)) standFlag = 0; //---------------------------------------------------------------- Cpu_Delay100US(100); if(UartFlag == 1) { sendData(); UartFlag = 0; } receiveData(); } }
/*lint -save -e970 Disable MISRA rule (6.3) checking. */ int main(void) /*lint -restore Enable MISRA rule (6.3) checking. */ { /* Write your local variable definition here */ float temperature, humidity; uint8_t res; unsigned char buf[32]; /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ /* Write your code here */ CLS1_SendStr("\r\n-----------------------\r\nSHT11 Example\r\n-----------------------\r\n", CLS1_GetStdio()->stdOut); res = SHT11_SoftReset(); if (res!=ERR_OK) { CLS1_SendStr("FAILED to reset device\r\n ", CLS1_GetStdio()->stdErr); for(;;){} } for(;;) { SHT11_Read(&temperature, &humidity); CLS1_SendStr("Temperature ", CLS1_GetStdio()->stdOut); buf[0] = '\0'; UTIL1_strcatNum32sDotValue100(buf, sizeof(buf), temperature*100); CLS1_SendStr(buf, CLS1_GetStdio()->stdOut); CLS1_SendStr("°C, Humidity ", CLS1_GetStdio()->stdOut); buf[0] = '\0'; UTIL1_strcatNum32sDotValue100(buf, sizeof(buf), humidity*100); CLS1_SendStr(buf, CLS1_GetStdio()->stdOut); CLS1_SendStr("%\r\n", CLS1_GetStdio()->stdOut); WAIT1_Waitms(1000); LED1_Neg(); } /* For example: for(;;) { } */ /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/ #ifdef PEX_RTOS_START PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */ #endif /*** End of RTOS startup code. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
/*lint -save -e970 Disable MISRA rule (6.3) checking. */ int main(void) /*lint -restore Enable MISRA rule (6.3) checking. */ { /* Write your local variable definition here */ /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ LED2_On(); WAIT1_Waitms(1000); LED2_Off(); #if PL_HAS_LOW_POWER LP_Init(); #endif #if PL_HAS_RTOS if (FRTOS1_xTaskCreate(BlinkTask, "Blink", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL) != pdPASS) { for(;;){} /* error */ } #endif #if PL_HAS_SHELL SHELL_Init(); #endif #if PL_HAS_RTOS PEX_RTOS_START(); #endif for(;;) { LP_EnterPowerMode(LP_WAIT); LED1_On(); WAIT1_Waitms(20); LED1_Off(); } /* For example: for(;;) { } */ /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/ #ifdef PEX_RTOS_START PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */ #endif /*** End of RTOS startup code. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
int main(void) { PE_low_level_init(); /* low level driver initialization, do not remove */ for(;;) { int result, value; printf("Please enter a number:\r\n"); result = scanf("%d", &value); while('\n' != getchar()); /* skip rest of input until '\n' */ if (result==1) { /* one value read */ printf("You entered: '%d'\r\n", value); } else { printf("Wrong number of input: is '%d' but should be '1'!\r\n", result); } } /* do not leave main! */ return 0; }
void main(void) { /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ /*Write your code here*/ /* Just jump to the real main(). */ __asm { jmp vMain } /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;); /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
/*lint -save -e970 Disable MISRA rule (6.3) checking. */ int main(void) /*lint -restore Enable MISRA rule (6.3) checking. */ { /* Write your local variable definition here */ /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ if (FRTOS1_xTaskCreate( Task1, /* pointer to the task */ (signed portCHAR *)"Task1", /* task name for kernel awareness debugging */ configMINIMAL_STACK_SIZE, /* task stack size */ (void*)NULL, /* optional task startup argument */ tskIDLE_PRIORITY, /* initial priority */ (xTaskHandle*)NULL /* optional task handle to create */ ) != pdPASS) { /*lint -e527 */ for(;;){}; /* error! probably out of memory */ /*lint +e527 */ } if (FRTOS1_xTaskCreate( Task2, /* pointer to the task */ (signed portCHAR *)"Task2", /* task name for kernel awareness debugging */ configMINIMAL_STACK_SIZE, /* task stack size */ (void*)NULL, /* optional task startup argument */ tskIDLE_PRIORITY, /* initial priority */ (xTaskHandle*)NULL /* optional task handle to create */ ) != pdPASS) { /*lint -e527 */ for(;;){}; /* error! probably out of memory */ /*lint +e527 */ } /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/ #ifdef PEX_RTOS_START PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */ #endif /*** End of RTOS startup code. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
int main(void) { PE_low_level_init(); gpio_init(); uart_init(); i2c_init(); gps_sate_data_init(); while(1) { // Wait to receive input data if(kStatus_LPSCI_Success == LPSCI_HAL_ReceiveDataPolling(UART0, &SBUF,1)) { // Echo received character // LPSCI_HAL_SendDataPolling(UART0, &SBUF, 1); gps_parser(); } GPIO_Test_for_TE(); } }
void main(void) { /* Write your local variable definition here */ /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ APP_Run(); /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/ #ifdef PEX_RTOS_START PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */ #endif /*** End of RTOS startup code. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
void main (void){ timer= newObj(Timer,(ulong)500); /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ Teclas_Init(); Display_Init(); // Inicializacion del display Grabacion_Init(); newAllocObj(&mainThread,ThreadAdjuntable); cap=GET_INSTANCE(); #ifdef _ENTRADA_SIMULADA CapturadorSimulado_setMicroSegundos(cap,100000000); CapturadorSimulado_setPulsos(cap,2); #endif { void * adjuntador= ThreadAdjuntable_getAdjuntador(&mainThread); newAllocObj(&sensorRpm,SensorRpm,adjuntador,1000,cap,&config,"SEn rPM"); deleteObj(&adjuntador); } for(;;){ WDog1_Clear(); if(Timer_isfinish(timer)){ Timer_Restart(timer); _GetterPrint(&sensorRpm,1); // Pasar_Numero(Capturador_getMicroSegundos(cap)/1000,0,0); // Pasar_Numero(Capturador_getPulsos(cap),1,0); // CapturadorSimulado_setPulsos(cap,CapturadorSimulado_getPulsos(cap)+1); } //Eventos MethodContainer_Execute(&mainThread); } }
void main(void) { /* Write your local variable definition here */ PEX_RTOS_INIT(); /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ if (FRTOS1_xTaskCreate( Task1, /* pointer to the task */ (signed portCHAR *)"Task1", /* task name for kernel awareness debugging */ configMINIMAL_STACK_SIZE, /* task stack size */ (void*)NULL, /* optional task startup argument */ tskIDLE_PRIORITY, /* initial priority */ (xTaskHandle*)NULL /* optional task handle to create */ ) != pdPASS) { /*lint -e527 */ for(;;){}; /* error! probably out of memory */ /*lint +e527 */ } if (FRTOS1_xTaskCreate( Task2, /* pointer to the task */ (signed portCHAR *)"Task2", /* task name for kernel awareness debugging */ configMINIMAL_STACK_SIZE, /* task stack size */ (void*)NULL, /* optional task startup argument */ tskIDLE_PRIORITY, /* initial priority */ (xTaskHandle*)NULL /* optional task handle to create */ ) != pdPASS) { /*lint -e527 */ for(;;){}; /* error! probably out of memory */ /*lint +e527 */ } FRTOS1_vTaskStartScheduler(); /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
/*lint -save -e970 Disable MISRA rule (6.3) checking. */ int main(void) /*lint -restore Enable MISRA rule (6.3) checking. */ { /* Write your local variable definition here */ /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ char* testName = "test"; Test test(0, testName, 500, 1); /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/ #ifdef PEX_RTOS_START PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */ #endif /*** End of RTOS startup code. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
void main(void) { /* Write your local variable definition here */ long t=sizeof(byte*); ++t; --t; ++g; --g; g=t; /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ /* Write your code here */ AS1_SendChar('a'); for(;1;){AS1_SendChar('a');Cpu_Delay100US(1000); } /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
/*lint -save -e970 Disable MISRA rule (6.3) checking. */ int main(void) /*lint -restore Enable MISRA rule (6.3) checking. */ { /* Write your local variable definition here */ uint32_t currentCounter = 0; /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ hw_average_config.hwAverageCountMode = kAdc16HwAverageCountOf32; //enable hardware average. ADC16_DRV_ConfigHwAverage(FSL_ADCONV1,&hw_average_config); ADC16_DRV_GetAutoCalibrationParam(FSL_ADCONV1,&calibration_param); calibrateParams(); //ADC16_DRV_Init(FSL_ADCONV1, &adConv1_InitConfig0); LPTMR_DRV_SetTimerPeriodUs(FSL_LPTMR1,1000000); // Set lptmr period printf("\r\nLPTMR is running!!\r\n"); LPTMR_DRV_Start(FSL_LPTMR1); /* Write your code here */ /* For example: for(;;) { } */ while(1) { if(currentCounter != lptmrCounter) { currentCounter = lptmrCounter; printf("\r\nLPTMR interrupt No.%d \r\n",currentCounter); GPIO_DRV_TogglePinOutput(LEDRGB_GREEN); } } /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/ #ifdef PEX_RTOS_START PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */ #endif /*** End of RTOS startup code. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
/*! * @brief * The main function of the project. * @param * void * @return * int */ int main(void) /*lint -restore Enable MISRA rule (6.3) checking. */ { /* Write your local variable definition here */ /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ /* Write your code here */ /* For example: for(;;) { } */ (void)TestApp_Init(); /* Initialize the USB Test Application */ /* Initialize on-chip and peripheral devices */ #if DEBUG GPIOTest(); printf("+UserInit begins...\n"); #endif UserInit(); #if DEBUG printf("-UserInit finished.\n"); #endif #if DEBUG GPIOTest(); #endif Init_State = 200;//Init is OK /* The main loop */ MainLoop(); /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/ #ifdef PEX_RTOS_START PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */ #endif /*** End of RTOS startup code. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
void kinetis_init(void) { #if PE_LDD_VERSION /* Watchdog disabled by CPU bean (need to setup in CPU Inspector) */ __pe_initialize_hardware(); /* Enable clock to peripheral modules */ kinetis_clock_enable(); _bsp_mpu_disable(); /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); #else kinetis_wdt_disable(); pll_init(); /* Enable clock to peripheral modules */ kinetis_clock_enable(); _bsp_mpu_disable(); #endif /* Initialize FlexBus */ _bsp_flexbus_setup(); /* Initialize MRAM */ _bsp_flexbus_mram_setup((uint_32)BSP_EXTERNAL_MRAM_RAM_BASE); }
/*lint -save -e970 Disable MISRA rule (6.3) checking. */ int main(void) /*lint -restore Enable MISRA rule (6.3) checking. */ { /* Write your local variable definition here */ /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ /* Write your code here */ /* For example: for(;;) { } */ for(;;){ GPIO_DRV_ClearPinOutput(RGB_RedLed); // On Red Led OSA_TimeDelay(300); GPIO_DRV_ClearPinOutput(RGB_GreenLed); // On Green Led OSA_TimeDelay(300); GPIO_DRV_ClearPinOutput(RGB_BlueLed); // On Blue Led OSA_TimeDelay(300); GPIO_DRV_SetPinOutput(RGB_RedLed); // Off Red Led OSA_TimeDelay(300); GPIO_DRV_SetPinOutput(RGB_GreenLed); // Off Green Led OSA_TimeDelay(300); GPIO_DRV_SetPinOutput(RGB_BlueLed); // Off Blue Led OSA_TimeDelay(300); } /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/ #ifdef PEX_RTOS_START PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */ #endif /*** End of RTOS startup code. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
/*! * @brief The entry point into the program. */ int main(void) /*lint -restore Enable MISRA rule (6.3) checking. */ { /* Write your local variable definition here */ /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ /* Write your code here */ OS_Init(CPU_CORE_CLK_HZ); //Important semaphores. Do it now! EventSemaphore = OS_SemaphoreCreate(0); InitSemaphore = OS_SemaphoreCreate(1); RtcSemaphore = OS_SemaphoreCreate(0); //Make some threads. CREATE_THREAD(InitThread, NULL, InitThreadStack, TP_INITTHREAD); CREATE_THREAD(MainThread, NULL, MainThreadStack, TP_MAINTHREAD); CREATE_THREAD(EventThread, NULL, EventThreadStack, TP_EVENTTHREAD); CREATE_THREAD(PacketThread, NULL, PacketThreadStack, TP_PACKETTHREAD); CREATE_THREAD(RtcThread, NULL, RtcThreadStack, TP_RTCTHREAD); //GOGOGOGOOGOGOGO OS_Start(); //We don't go here. /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/ #ifdef PEX_RTOS_START PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */ #endif /*** End of RTOS startup code. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
int main(void) { byte ret = MAIN_SUCCESS; event = EVENT_NOTHING_TO_DO; PE_low_level_init(); Cpu_SetClockConfiguration(1); back_to_first_screen(); do{ if(event!=EVENT_NOTHING_TO_DO) ret = parse_event(&event); else{ __asm("WFI\n\t"); //Waitms(100); } //Waitms(100); if(ret!=MAIN_SUCCESS) { ret = reset_ST(); } }while(TRUE); for(;;){} return 0; /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/ #ifdef PEX_RTOS_START PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */ #endif /*** End of RTOS startup code. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ }
void main(void) { /* Write your local variable definition here */ #if PL_BOARD_LCD /* NOTE: the JM128 on the TWR-LCD needs at least to pull-up the microSD card detection pin, otherwise the signal is floating for the the driver in U5A */ PTGPE_PTGPE3 = 1; /* pull up enable for card detection line. Otherwise a CPU on the elevator will not be able to read the SD card detection signal */ #endif #if PL_BOARD_LCD && !PL_IS_BOOTLOADER && !PL_APP_MODE_I2C_LCD /* we are the TWR-LCD, and not the bootloader or the I2C application */ /* if we are not the bootloader: - if JM_ELE (SW1-3) is ON/low, then TWR CPU has control over the display (tristate lines) - if EuSD (SW1-4) is ON/low, then TWR CPU has control over the microSD card (tristate lines, pull-up CD line) - if TP_SEL (SW1-6) is OFF/high, then TWR CPU has control over the touch panel lines (tristate lines) */ if (!CanUseTouchPanel()) { for(;;) {} } if (!CanUseDisplay()) { for(;;) {} } #endif #if PL_HAS_BOOTLOADER BL_RedirectUserVectors(); /* need to redirect vectors before initializing the drivers below */ #endif /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ #if PL_IS_BOOTLOADER BL_Bootloader(); /* does not return */ #else RTOS_Start(); /* does not return */ #endif /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
void main(void) { /* Write your local variable definition here */ /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ LED1_Neg(); WAIT1_Waitms(100); LED2_Neg(); WAIT1_Waitms(100); LED3_Neg(); WAIT1_Waitms(100); LED4_Neg(); WAIT1_Waitms(100); LED1_Off(); LED2_Off(); LED3_Off(); LED4_Off(); CDC_Run(); /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
/*lint -save -e970 Disable MISRA rule (6.3) checking. */ int main(void) /*lint -restore Enable MISRA rule (6.3) checking. */ { /* Write your local variable definition here */ /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ for (;;) { #if IS_SENDER int i; #endif int cntr; uint8_t status; WAIT1_Waitms(100); /* give device time to power up */ RF_Init(); /* set CE and CSN to initialization value */ RF_WriteRegister(RF24_RF_SETUP, RF24_RF_SETUP_RF_PWR_0 | RF24_RF_SETUP_RF_DR_250); RF_WriteRegister(RF24_RX_PW_P0, PAYLOAD_SIZE); /* number of payload bytes we want to send and receive */ RF_WriteRegister(RF24_RF_CH, CHANNEL_NO); /* set channel */ /* Set RADDR and TADDR as the transmit address since we also enable auto acknowledgment */ RF_WriteRegisterData(RF24_RX_ADDR_P0, (uint8_t*) TADDR, sizeof(TADDR)); RF_WriteRegisterData(RF24_TX_ADDR, (uint8_t*) TADDR, sizeof(TADDR)); /* Enable RX_ADDR_P0 address matching */ RF_WriteRegister(RF24_EN_RXADDR, RF24_EN_RXADDR_ERX_P0); /* enable data pipe 0 */ /* clear interrupt flags */ RF_ResetStatusIRQ( RF24_STATUS_RX_DR | RF24_STATUS_TX_DS | RF24_STATUS_MAX_RT); #if IS_SENDER RF_WriteRegister(RF24_EN_AA, RF24_EN_AA_ENAA_P0); /* enable auto acknowledge. RX_ADDR_P0 needs to be equal to TX_ADDR! */ RF_WriteRegister(RF24_SETUP_RETR, RF24_SETUP_RETR_ARD_750|RF24_SETUP_RETR_ARC_15); /* Important: need 750 us delay between every retry */ TX_POWERUP(); /* Power up in transmitting mode */ CE_ClrVal(); /* Will pulse this later to send data */ #else RX_POWERUP(); /* Power up in receiving mode */ CE_SetVal(); /* Listening for packets */ #endif cntr = 0; for (;;) { #if IS_SENDER cntr++; if (cntr==200) { /* send data every 200 ms */ cntr = 0; for(i=0;i<PAYLOAD_SIZE;i++) { payload[i] = i+1; /* just fill payload with some data */ } LEDR_ClrVal(); RF_TxPayload(payload, sizeof(payload)); /* send data */ } if (cntr>50) { /* not able to send data for 50 ms? */ LEDR_SetVal(); } if (isrFlag) { /* check if we have received an interrupt */ isrFlag = FALSE; /* reset interrupt flag */ status = RF_GetStatus(); if (status&RF24_STATUS_RX_DR) { /* data received interrupt */ RF_ResetStatusIRQ(RF24_STATUS_RX_DR); /* clear bit */ } if (status&RF24_STATUS_TX_DS) { /* data sent interrupt */ cntr = 0; /* reset timeout counter */ LEDR_SetVal(); /* indicate data has been sent */ RF_ResetStatusIRQ(RF24_STATUS_TX_DS); /* clear bit */ } if (status&RF24_STATUS_MAX_RT) { /* retry timeout interrupt */ RF_ResetStatusIRQ(RF24_STATUS_MAX_RT); /* clear bit */ } } WAIT1_Waitms(1); #else if (isrFlag) { /* interrupt? */ isrFlag = FALSE; /* reset interrupt flag */ cntr = 0; /* reset counter */ LEDB_SetVal(); LEDG_NegVal(); /* blink green LED to indicate good communication */ status = RF_GetStatus(); if (status & RF24_STATUS_RX_DR) { /* data received interrupt */ RF_RxPayload(payload, sizeof(payload)); /* will reset RX_DR bit */ RF_ResetStatusIRQ( RF24_STATUS_RX_DR | RF24_STATUS_TX_DS | RF24_STATUS_MAX_RT); /* make sure we reset all flags. Need to have the pipe number too */ } if (status & RF24_STATUS_TX_DS) { /* data sent interrupt */ RF_ResetStatusIRQ(RF24_STATUS_TX_DS); /* clear bit */ } if (status & RF24_STATUS_MAX_RT) { /* retry timeout interrupt */ RF_ResetStatusIRQ(RF24_STATUS_MAX_RT); /* clear bit */ } } else { cntr++; if (cntr > 500) { /* blink every 500 ms if not receiving data */ cntr = 0; /* reset counter */ LEDG_SetVal(); LEDB_NegVal(); /* blink blue to indicate no communication */ } WAIT1_Waitms(1); /* burning some cycles here */ } #endif } } /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/ #ifdef PEX_RTOS_START PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */ #endif /*** End of RTOS startup code. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
void main (void){ char tecla; /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ newAlloced(&plataforma,&PlataformaEmbedded); Teclas_Init(); Display_Init(); // Inicializacion del display com_initialization(&arrayNodosComunicacion); add1msListener(_new(&Method,on1ms,0)); add40msListener(_new(&Method,on40ms,0)); newAlloced(&mainThread,&ThreadAdjuntable); cap=GET_INSTANCE(); #ifdef _ENTRADA_SIMULADA CapturadorSimulado_setMicroSegundos(cap,100000000); CapturadorSimulado_setPulsos(cap,2); #endif { void * adjuntador= ThreadAdjuntable_getAdjuntador(&mainThread); newAlloced(&sensorRpm,&SensorRpm,adjuntador,1000,cap,&config,"SEn rPM"); _delete(adjuntador); } newAlloced(&pwm,&PWMTimer,&pwm_config,0); newAlloced(&pid,ControlPID,&pid_config,&sensorRpm,&pwm); newAlloced(&msj[0],MessageOut); #ifndef HD90 PID_AddOnTSalChange(&pid,OnTSalChange,NULL); #endif /* DN_Init(&CBox_Pri); Sets_Init(); PWM_Hmi_Add(&pwm,0); SenRpmHmi_Add(&sensorRpm,0); PidHmi_AddBoxes(&pid,0); // PidHmi_AddBoxes(&pid,2); // PidHmi_AddBoxes(&pid,3); Sets_AddBoxes(); */ DN_staticInit(&OpList,&AccessList); setConectada(&pwm,TRUE); LedsSalida_init(&ledsSalida); for(;;){ WDog1_Clear(); tecla=get_key(); //Eventos MethodContainer_execute(&mainThread); mainLoop(&plataforma); DN_Proc(tecla); } }
/*lint -save -e970 Disable MISRA rule (6.3) checking. */ int main(void) /*lint -restore Enable MISRA rule (6.3) checking. */ { /* Write your local variable definition here */ uint8_t i ; //uint8_t send_buf[50] ; /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ GPIO1_ClearFieldBits(GPIO1_Ptr, LAMP_CTR, 1); //turn off the lamp modbus_init(); Ram_Init(); read_from_flash(); task_init(); bmp180_init(); opa_init(); Aq_Init(); /* Write your code here */ /* For example: */ for(;;) { // sprintf((char*)send_buf,"#C%05u P%07u TP%04d TH%04d H%04u AQ%04u\n\r", modbus.Co2, modbus.PP, modbus.PT, modbus.HT, modbus.HH, modbus.Aq); // AS1_SendBlock(AS1_ptr, send_buf, strlen((char*)send_buf)) ; // Delay(6); if(heartbeat == TRUE) //tick = 1ms { heartbeat = FALSE; if(serial_receive_timeout_count > 0) { serial_receive_timeout_count--; if(serial_receive_timeout_count == 0) { revce_count = 0; } } if(serial_response_delay > 0) serial_response_delay--; if((dealwithTag == TRUE) && (serial_response_delay == 0)) { dealwithTag = FALSE; dealwithData(); } heartbeat_counter++; if(heartbeat_counter >= OS_TICK) // 1 * 10 = 10ms { heartbeat_counter = 0; task_manage(); } } Co2_Detect(); // // AS2_SendBlock(AS2_ptr, "start\n\r", sizeof("start\n\r")) ; // print_status = AD1_CreateSampleGroup(AdDataPTR, &ADC_CO2_Sample, 1) ; // Delay(300); // // sprintf((void*)str, "P = %u\n\r", (uint16_t)print_status); // AS1_SendBlock(AS1_ptr, str, sizeof(str)) ; // Delay(300); // if(enter_adc) // { // enter_adc = 0 ; // AS2_SendBlock(AS2_ptr, "enteradc\n\r", sizeof("enteradc\n\r")) ; // } // Delay(300); // switch(print_status) // { // case ERR_PARAM_SAMPLE_COUNT: // AS2_SendBlock(AS2_ptr, "Para\n\r", sizeof("Para\n\r")) ; // break; // case ERR_BUSY: // AS2_SendBlock(AS2_ptr, "BSY\n\r", sizeof("BSY\n\r")) ; // break; // case ERR_OK: // AS2_SendBlock(AS2_ptr, "OK\n\r", sizeof("OK\n\r")) ; // break ; // case ERR_PARAM_INDEX: // AS2_SendBlock(AS2_ptr, "index\n\r", sizeof("index\n\r")) ; // break ; // } // AD1_CreateSampleGroup(AdDataPTR, (LDD_ADC_TSample *)&ADC_PM25_Sample, 1U); // AD1_StartSingleMeasurement(AdDataPTR); // while(AD1_GetMeasurementCompleteStatus(AdDataPTR) != TRUE); // AD1_GetMeasuredValues(AdDataPTR, (LDD_TData *)&PM25_AD) ; // sprintf((void*)str, "P%u\n\r", (uint16_t)PM25_AD); // AS1_SendBlock(AS1_ptr, str, strlen((const char*)str)) ; // Delay(3000) ; } /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/ #ifdef PEX_RTOS_START PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */ #endif /*** End of RTOS startup code. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/