예제 #1
0
/**
 * 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;
	}
}
예제 #2
0
/*******************************************************************************
* 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);
}
예제 #3
0
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;
}
예제 #4
0
void SysTimerHandler(void)
{
    /// Clear interrupt flag
    MAP_TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
    /// Call disk process
    disk_timerproc();
}
예제 #5
0
파일: fswrapper.c 프로젝트: mybays/lm3s
//*****************************************************************************
//
//! 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();
    }
}
예제 #6
0
파일: intprg.c 프로젝트: smarth55/Examples
// vector 21 Timer W
__interrupt(vect=21) void INT_TimerW(void)
{
    TW.TSRW.BIT.IMFA = 0;

    Timer++;
    disk_timerproc();
}
예제 #7
0
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();
}
예제 #9
0
파일: main.c 프로젝트: rchorley/team23code1
/* 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--;
    }
}
예제 #10
0
void SysTick_Handler( void )
{
  // Handle virtual timers
  cmn_virtual_timer_cb();

#ifdef BUILD_MMCFS
  disk_timerproc();
#endif
}
예제 #11
0
//
// 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) */
	}
}
예제 #13
0
/*Function to handle Systick interrupts*/
void SysTickHandler(void)
{
	SysTickIntDisable();
	a1++;
	if(a1==100)
	{
		a1=1;
		disk_timerproc();
	}

	SysTickIntEnable();
}
예제 #14
0
void SysTick_Handler(void)
{
  static int licznik=0;

  disk_timerproc();

  licznik++;
  if (licznik==100) {
    sekunda=TRUE;
    licznik=0;
  }
}
예제 #15
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--;
    }
}
예제 #16
0
/*******************************************************************************
* 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;
}
예제 #17
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();
	}
}
예제 #18
0
/*********************************************************************
 * 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
}
예제 #19
0
/*----------------------------------------------------------------------------
  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();
  }
}
예제 #20
0
파일: main.c 프로젝트: Teknoman117/avr
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;
}
예제 #21
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;
	};
};
예제 #22
0
//*****************************************************************************
//
// 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();
    }
}
예제 #23
0
void SysTick_Handler (void)
{
  delayTicks++;
  if (delayTicks == 0) delayRollovers++;

  #ifdef CFG_SDCARD
  fatTicks++;
  if (fatTicks == 10)
  {
    fatTicks = 0;
    disk_timerproc();
  }
  #endif

  return;
}
예제 #24
0
void SysTick_Handler (void)
{
  systickTicks++;

  // Increment rollover counter
  if (systickTicks == 0xFFFFFFFF) systickRollovers++;

  #ifdef CFG_SDCARD
  fatTicks++;
  if (fatTicks == 10)
  {
    fatTicks = 0;
    disk_timerproc();
  }
  #endif
}
예제 #25
0
파일: port.c 프로젝트: inz2013/project_code
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();
}
예제 #26
0
/*-----------------------------------------------------------------------*/
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);
	}
}
예제 #27
0
//****************************************************************************
//
// 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--;
   }


}
예제 #28
0
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);
			}
		}
	}
	
}
예제 #29
0
파일: SDcard.cpp 프로젝트: markusk/direcs
void SDcard::service(void)
{
  disk_timerproc();

  return;
}
예제 #30
0
//Обработчик прерываний от таймера TIM5. (10 ms)     ___ for FatFS purpose ___
//==============================================================================
void TIM5_IRQHandler(void)
{ 
  disk_timerproc();
  
  TIM_ClearITPendingBit(TIM5, TIM_IT_Update);	//__Clear TIM5 update interrupt__
}