/*! * @brief main routine testing the library content * @note POST tests are located in the startup files */ int main (void) { testResult_t result = IEC60335_testFailed; /* test results */ /* critical data */ critical_uint32_t Crit_test = IEC60335_ClassB_CriticalDataInit(12345678); /* hardware setup */ initController(); /* critical data */ IEC60335_ClassB_CriticalDataPush(Crit_test, 0x87654321); /* regular usage */ result = IEC60335_ClassB_CriticalDataValidate(Crit_test); /* not allowed by compiler */ // Crit_test = 34343434; result = IEC60335_ClassB_CriticalDataValidate(Crit_test); Crit_test.data = 89898989; /* not allowed in runtime */ result = IEC60335_ClassB_CriticalDataValidate(Crit_test); result = IEC60335_ClassB_FLASHtest_POST(); /* clock/rtc test */ IEC60335_ClassB_initClockTest(100, 5); /* init clock test */ result = IEC60335_ClassB_Clocktest_PollHandler(); /* check evidence */ /* IRQ test */ IRQtest.MaxThres = 1000; /* IRQ test parameter */ IRQtest.MinThres = 10; initSystick(1); IEC60335_ClassB_InitInterruptTest(SysTick_IRQn, CallIRQHandler, &IRQtest); while (IEC60335_ClassB_InterruptCheck(SysTick_IRQn) != IEC60335_testPassed) {} /* IRQ test off */ IEC60335_ClassB_InitInterruptTest(SVCall_IRQn, 0, 0); initSystick(0); /* Flash test */ result = IEC60335_ClassB_FLASHtest_BIST (FLASH_CRC_Restart); while (1) { result = IEC60335_ClassB_CPUregTest_BIST(); result = IEC60335_ClassB_FLASHtest_BIST (0); result = IEC60335_ClassB_PCTest_BIST(); result = IEC60335_ClassB_RAMtest_BIST (0x20000100, 0x10); if (result != IEC60335_testPassed) { /* Break point here to test with debugger */ __NOP(); } } }
int main() { SystemInit(); initSystick(); initAccelerometer(); initLeds(); AccelerometerDataStruct dat; uint32_t lastTime = 0; while(1) { if (millisecondCounter > lastTime + 100) { readAxes(&dat); // read sensor and store into `dat' setbuf(stdout, NULL); printf("X: %d Y: %d Z: %d\n", dat.X, dat.Y, dat.Z); // the member variables for each direction lastTime = millisecondCounter; // Add extra logic here to light LEDs based on orientation of the board if(dat.X<-500){ GPIOD->BSRRL|=(1<<12); GPIOD->BSRRH|=(1<<13); GPIOD->BSRRH|=(1<<14); GPIOD->BSRRH|=(1<<15); } if(dat.Y<-500){ GPIOD->BSRRL|=(1<<15); GPIOD->BSRRH|=(1<<12); GPIOD->BSRRH|=(1<<13); GPIOD->BSRRH|=(1<<14); } if(dat.Y>500){ GPIOD->BSRRL|=(1<<13); GPIOD->BSRRH|=(1<<12); GPIOD->BSRRH|=(1<<14); GPIOD->BSRRH|=(1<<15); } if(dat.X>500){ GPIOD->BSRRL|=(1<<14); GPIOD->BSRRH|=(1<<12); GPIOD->BSRRH|=(1<<13); GPIOD->BSRRH|=(1<<15); } } } }
int main() { int i=0; int ret,j; static u8 data[512]; cur_song_init(); init_usart(); initSystick(); delay(1000); printf("\r\n\r\n-------- start -------\r\n"); // shot(); // while (1); initSpi(); SD_Init(); readBlock(0,data); init_mp3(); Mp3Reset(); mute(); init_fetch(); //send_fetch_play_list(); while (1) loop(); // println("start shot..."); // for(i=1;i<=3573;i++){ // readBlock(i,data); // for(j=0;j<512;j++) { // printf("%c",data[j]); // } // } // println("shot over"); // println("--- 0"); // ret = get_millisecond(); // for(i=1;i<1000;i++) // writeBlock(i,data); // readBlock(990,data); // printf("--- %d\r\n",get_millisecond() - ret); }
int main(void) { initSystick(); unsigned int pin = 13; // pin 13 is the orange LED RCC->AHB1ENR |= RCC_AHB1ENR_GPIODEN; // enable the clock to GPIOD GPIOD->MODER = (1 << 2*pin); // set pin 13 to be general purpose output while (1) { delayMillis(1000); GPIOD->ODR ^= (1 << pin); // Toggle pin setbuf(stdout, NULL); printf("Toggling LED from off to on\r\n"); //waiting 1000 millisecond to turn on the LED delayMillis(1000); GPIOD->ODR ^= (1<<pin); setbuf(stdout,NULL); printf("Toggling LED from on to off\r\n"); //waiting 1000 millisecond to turn off the LED } }