/** * Function called every 1 ms to generate the application's timer tick */ void FlightComputer::SystemTimerTick() { // Get a pointer to the application's instance FlightComputer * fc = FlightComputer::GetInstance(); // run the 1ms task necessary for the SD card library disk_timerproc(); fc->msElapsed++; // set 100ms, 1s, and 10s flags used for timing in the main loop if(fc->msElapsed >= 100) { fc->ms100Elapsed++; fc->msElapsed = 0; fc->timer100msFlag = true; } if(fc->ms100Elapsed >= 10) { fc->sElapsed++; fc->ms100Elapsed = 0; fc->timer1sFlag = true; } if(fc->sElapsed >= 10) { fc->sElapsed = 0; fc->timer10sFlag = true; } }
/******************************************************************************* * Function Name : timer_proc * Description : timer for the SPI * Input : None * Output : None * Return : None *******************************************************************************/ volatile void timer_proc(void) { /* call timerproc for timesteps in SD card handeling */ //GPIO_SetBits(GPIOC, GPIO_Pin_4); disk_timerproc(); //GPIO_ResetBits(GPIOC, GPIO_Pin_4); }
void CT16B0_IRQHandler(void) #else #error "timer16.c: No MCU defined" #endif { LPC_CT16B0->IR = 0x1 << 2; /* Clear MAT0 */ if( delayTimerOverflows++ >= DELAY_TIMER_OVERFLOWS_PER_MS) { delayTicks++; if (NULL != _delayCallback) { _delayCallback(); } if (delayTicks == 0) delayRollovers++; #ifdef CFG_SDCARD fatTicks++; if (fatTicks == 10) { fatTicks = 0; disk_timerproc(); } #endif delayTimerOverflows = 0; } return; }
void SysTimerHandler(void) { /// Clear interrupt flag MAP_TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT); /// Call disk process disk_timerproc(); }
//***************************************************************************** // //! Provides a periodic tick for the file system. //! //! \param ulTickMS is the number of milliseconds which have elapsed since the //! last time this function was called. //! //! Applications making use of the file system wrapper with underlying FatFs //! drives must call this function at least once every 10 milliseconds to //! provide a time reference for use by the file system. It is typically //! called in the context of the application's SysTick interrupt handler or //! from the handler of some other timer interrupt. //! //! If only binary file system images are in use, this function need not be //! called. //! //! \return None // // //***************************************************************************** void fs_tick(unsigned long ulTickMS) { static unsigned long ulTickCounter = 0; // // Check if the file system has been enabled yet. // if(!g_bFatFsEnabled) { return; } // // Increment the tick counter. // ulTickCounter += ulTickMS; // // Check to see if the FAT FS tick needs to run. // if(ulTickCounter >= 10) { ulTickCounter = 0; disk_timerproc(); } }
// vector 21 Timer W __interrupt(vect=21) void INT_TimerW(void) { TW.TSRW.BIT.IMFA = 0; Timer++; disk_timerproc(); }
void diskTimer() { for(;;) { vTaskDelay(10); disk_timerproc(); } }
//***************************************************************************** // // Provides the FATfs timer tick. // // This function must be called every 10mS or so by the application. It // provides the time reference required by the FAT file system. // // \return None. // //***************************************************************************** void FATWrapperSysTickHandler(void) { // // Call the FatFs tick timer. // disk_timerproc(); }
/* SysTick Handler * * - Required by FatFS for SD card timings * - On a 10ms interrupt */ void SysTickHandler(void) { // Alert FatFS and increment the timestamp disk_timerproc(); ++g_ulTimeStamp; if(g_ulIdleTimeout > 0) { g_ulIdleTimeout--; } }
void SysTick_Handler( void ) { // Handle virtual timers cmn_virtual_timer_cb(); #ifdef BUILD_MMCFS disk_timerproc(); #endif }
// // SysTickHandler - This is the handler for this SysTick interrupt. FatFs // requires a timer tick every 10 ms for internal timing // purposes. // __interrupt void SysTickHandler(void) { // // Call the FatFs tick timer. // disk_timerproc(); PieCtrlRegs.PIEACK.all |= 1; }
/* SysTick Interrupt Handler (1ms) */ void SysTick_Handler (void) { static uint32_t div10; Timer++; if (++div10 >= 10) { div10 = 0; disk_timerproc(); /* Disk timer function (100Hz) */ } }
/*Function to handle Systick interrupts*/ void SysTickHandler(void) { SysTickIntDisable(); a1++; if(a1==100) { a1=1; disk_timerproc(); } SysTickIntEnable(); }
void SysTick_Handler(void) { static int licznik=0; disk_timerproc(); licznik++; if (licznik==100) { sekunda=TRUE; licznik=0; } }
//***************************************************************************** // // This is the handler for this SysTick interrupt. FatFs requires a timer tick // every 10 ms for internal timing purposes. // //***************************************************************************** void SysTickHandler(void) { // // Call the FatFs tick timer. // disk_timerproc(); if(g_ui32IdleTimeout != 0) { g_ui32IdleTimeout--; } }
/******************************************************************************* * Function Name : SD_Start * Description : Start a Writing Session * Input : File Name, Flags * Output : None * Return : "1" for Success, "0" for Failure *******************************************************************************/ int SD_Start(char file_name[], unsigned char Flags) { /* Start Card Service */ disk_timerproc(); ret = disk_initialize(fs.drive); ret = f_mount(0,&fs); ret = f_open(&file, (const char*) file_name, Flags); if( ret == 0 ) { return 1; } return 0; }
void SysTickHandler(void) { // // Call the FatFs tick timer. // disk_timerproc(); ticks++; if (ticks == 100) //Every half a second update the clock { ticks = 0; updateClock(); } }
/********************************************************************* * Function: void T1Handler(void) * * PreCondition: * * Input: None * * Output: None * * Side Effects: * * Overview: FatFs requires a 1ms tick timer to aid * with low level function timinng * * Note: ********************************************************************/ void __attribute__((interrupt(ipl1), vector(_CORE_TIMER_VECTOR))) T1Handler(void) { //static const BYTE dom[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; //static int div1k; //BYTE n; // clear the interrupt flag mCTClearIntFlag(); OpenCoreTimer(FOSC/2000); //Timer++; disk_timerproc(); // call the low level disk IO timer functions }
/*---------------------------------------------------------------------------- SysTick_Handler *----------------------------------------------------------------------------*/ void SysTick_Handler(void) { // Increment systick counter for Delay(); msTicks++; // Increment SD card timer counter mmcTicks++; // Run MMC timer every 10 ms (mmc.c) if (mmcTicks == 10) { mmcTicks = 0; disk_timerproc(); } }
int main ( void ) { initADC(); init_stdusart0( BAUD, DB8 | P_N | SB1 ); init_timer0_ctc( T0_PRESCALER_1024, PIN_DISCONNECT, PIN_DISCONNECT );// initalize timer 0 in ctc mode with a 1024 prescale DDRD |= (1 << PORTD4) | (1 << PORTD5); //set status LED pins to outputs set_ocr0a( 108 ); // compare match every 156 ticks, producing 10ms interrupts enable_interrupt_t0a(); //enable interrupt on timer0 channel A static FATFS FATFS_Obj; //file system descriptor disk_timerproc(); //produce a base timer clock FIL logfile; //file descriptor for datalogging file FILINFO info; //file info structure DSTATUS status = disk_initialize(0); //initalize the SD card if( status & STA_NOINIT ) { //check for an error printf( "Disk Error\n\r" ); PORTD |= (1 << PORTD4); //Set LED to Error PORTD &= ~(1 << PORTD5); while (1); } PORTD |= (1 << PORTD5); //set LED to Success PORTD &= ~(1 << PORTD4); f_mount(0, &FATFS_Obj); //mount the filesystem double vout = 0.0; unsigned photo = 0, therm = 0, in = 0; while(1) { _delay_ms(5000); //delay 5 seconds PORTD |= (1 << PORTD4); //turn on the writing status int res = f_stat( "/avr/datalog.txt", &info ); //find the length of the datalog file if(f_open(&logfile, "/avr/datalog.txt", FA_OPEN_ALWAYS | FA_WRITE) != FR_OK) { //open the datalog and create anew ifnot present printf("System Error"); PORTD |= (1 << PORTD4); //Set LED to Error PORTD &= ~(1 << PORTD5); while(1); } if(res == FR_OK) f_lseek( &logfile, info.fsize ); //If the file existed seek to the end in = getADC(0); //Log the values vout = 3.3 * (in/1023.0); photo = (vout*10000.0)/(3.3-vout); printf( "Photo: %u ohms(%u raw) ", photo, in ); f_printf( &logfile, "Photo: %u ohms(%u raw) ", photo, in ); in = getADC(1); vout = 3.3 * (in/1023.0); therm = (vout*10000.0)/(3.3-vout); printf( "Therm: %u ohms(%u raw) \r\n", therm, in ); f_printf( &logfile, "Therm: %u ohms(%u raw)\n", therm, in ); f_close( &logfile ); //close the file PORTD &= ~(1 << PORTD4); //off with the writing status } return 0; }
void vTimerCallback ( xTimerHandle pxTimer ) { configASSERT( pxTimer ); // Which timer expired? long lTimerID = ( long ) pvTimerGetTimerID ( pxTimer ); if ( lTimerID < LED_NUM_TIMER ) LedTimerCallback ( lTimerID ); else switch ( lTimerID ) { case 4: disk_timerproc ( ); return; }; };
//***************************************************************************** // // File System tick handler. // //***************************************************************************** void fs_tick(uint32_t ui32TickMS) { // // Increment the tick counter. // ui32TickCounter += ui32TickMS; // // Check to see if the FAT FS tick needs to run. // if(ui32TickCounter >= 10) { ui32TickCounter = 0; disk_timerproc(); } }
void SysTick_Handler (void) { delayTicks++; if (delayTicks == 0) delayRollovers++; #ifdef CFG_SDCARD fatTicks++; if (fatTicks == 10) { fatTicks = 0; disk_timerproc(); } #endif return; }
void SysTick_Handler (void) { systickTicks++; // Increment rollover counter if (systickTicks == 0xFFFFFFFF) systickRollovers++; #ifdef CFG_SDCARD fatTicks++; if (fatTicks == 10) { fatTicks = 0; disk_timerproc(); } #endif }
void xPortSysTickHandler( void ) { unsigned long ulDummy; /* If using preemption, also force a context switch. */ #if configUSE_PREEMPTION == 1 *(portNVIC_INT_CTRL) = portNVIC_PENDSVSET; #endif ulDummy = portSET_INTERRUPT_MASK_FROM_ISR(); { vTaskIncrementTick(); } portCLEAR_INTERRUPT_MASK_FROM_ISR( ulDummy ); disk_timerproc(); }
/*-----------------------------------------------------------------------*/ void vSDcardTask(void *pvParameters) { // // Enable the peripherals used by the micro SD card. // SysCtlPeripheralEnable(SDC_SSI_SYSCTL_PERIPH); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); // // Mount the file system, using logical disk 0. // if (f_mount(0, &g_sFatFs) != FR_OK) { printf("f_mount error\n"); vTaskDelete(NULL); } for (;;) { disk_timerproc(); vTaskDelay(10 / portTICK_RATE_MS); } }
//**************************************************************************** // // This is the interrupt handler for the SysTick interrupt. It is called // periodically and updates a global tick counter then sets a flag to tell the // main loop to move the mouse. // //**************************************************************************** void SysTickHandler(void) { // // Increment the current tick count. // g_ulSysTickCount++; // // Call the FatFs tick timer. // disk_timerproc(); if(g_ulIdleTimeout != 0) { g_ulIdleTimeout--; } }
static void timer_1khz(int timer_id) { int i; static unsigned char timer_20ms; static unsigned char timer_62ms; static unsigned char timer_10ms; disk_timerproc(); log_poweron_tick(); // Poll the RF at 100Hz if(++timer_10ms >= 10) { timer_10ms = 0; rf_poll(); } // Generate behavior softirq at 50Hz if(++timer_20ms >= 20) { timer_20ms = 0; behavior_trigger(); } // Generate 16Hz, used by NTC & Acc. if(++timer_62ms >= 62) { timer_62ms = 0; timer_slow(); } for(i = 0; i < 2; i++) { if(vmVariables.timers[i]) { if(++timer[i] >= vmVariables.timers[i]) { timer[i] = 0; SET_EVENT(EVENT_TIMER0 + i); } } } }
void SDcard::service(void) { disk_timerproc(); return; }
//Обработчик прерываний от таймера TIM5. (10 ms) ___ for FatFS purpose ___ //============================================================================== void TIM5_IRQHandler(void) { disk_timerproc(); TIM_ClearITPendingBit(TIM5, TIM_IT_Update); //__Clear TIM5 update interrupt__ }