Exemplo n.º 1
0
/*******************************************************************************
* Function name: timer_adc
* Description  : The function configures a ADC unit and a timer unit. After each
*                timer period the callback function cmt_callback_readADC, is 
*                executed.
* Arguments    : none
* Return value : none
*******************************************************************************/
void timer_adc(void)
{
    /* Prepare the ADC unit for continuous conversion of pot VR1 value. */
    S12ADC_init(); 
    /* Start continuous ADC conversion. */
    S12ADC_start();
    
    /* Prepare a CMT channel as a periodic timer. */
    /* Initialize a CMT one-shot timer. */ 
    cmt_init();
    /* Set up the callback function on cmt channel 0 */   
    cmt_callback_set(CHANNEL_1, &cmt_callback_readADC);
    /* Start 100mS count on cmt channel 0. */
    cmt_start(CHANNEL_1, g_timer_count);
            
} /* End of function timer_adc(). */
Exemplo n.º 2
0
void TestApp_Init(void)
{
    uint_8   error;
    
    DisableInterrupts;
#if (defined _MCF51MM256_H) || (defined _MCF51JE256_H)
    usb_int_dis();
#endif
    
#if !(defined _MC9S08JS16_H)
#if (defined MCU_mcf51jf128)
    sci1_init();
#else
    sci_init();
#endif
#endif /* _MC9S08JS16_H */
    
#if  ((defined __MCF52xxx_H__) || (defined __MK_xxx_H__))
    pit1_init();
#elif (defined _MC9S08JM60_H) || (defined _MC9S08JM16_H) || (defined _MC9S08JS16_H)
    rtc_init();
#elif (defined MCU_mcf51jf128)
    ftm0_init();
#else
    cmt_init();
#endif
    
    pwm_init();
    /* Initialize the USB interface */
    error = USB_Class_Audio_Init(CONTROLLER_ID,USB_App_Callback,
                                 NULL,NULL);
    UNUSED(error);
    
    EnableInterrupts;
#if (defined _MCF51MM256_H) || (defined _MCF51JE256_H)
    usb_int_en();
#endif
}
Exemplo n.º 3
0
void main(void) 
#endif
{
   USB_STATUS           status = USB_OK;
   _usb_host_handle     host_handle;
   boolean send = TRUE;
   
   /* Initialize the current platform. Call for the _bsp_platform_init which is specific to each processor family */
   _bsp_platform_init();
#ifdef MCU_MK70F12
   sci2_init();
#else
   sci1_init();
#endif
   TimerInit();

   /* Init polling global variable */
   POLL_init(); 
    
#if (defined(_MCF51MM256_H) || (defined _MCF51JE256_H))
   cmt_init();
   Mcu_Init();
   Kbi_Init();
   pwm_init();
#endif

#if (defined(__MCF52259_H__) || (defined (__MCF52221_H__)) ||(defined (_MK_xxx_H_)) )
   	GPIO_Init();
   	pit0_init();
   	pwm_init();
#endif

#if (defined MCU_mcf51jf128)
   	GPIO_Init();
   	mtim_init();
   	pwm_init();
#endif
   DisableInterrupts;
   #if (defined _MCF51MM256_H) || (defined _MCF51JE256_H)
   usb_int_dis();
   #endif	   
   /*
   ** It means that we are going to act like host, so we initialize the
   ** host stack. This call will allow USB system to allocate memory for
   ** data structures, it uses later (e.g pipes etc.).
   */
   status = _usb_host_init (
         HOST_CONTROLLER_NUMBER,   /* Use value in header file */
         MAX_FRAME_SIZE,            /* Frame size per USB spec  */
         &host_handle);             /* Returned pointer */
   if (status != USB_OK) 
   {
	   printf("\nUSB Host Initialization failed! STATUS: 0x%x", (unsigned int) status);
	   fflush(stdout);
	   exit(3);
   }
   status = _usb_host_driver_info_register (
                                    host_handle,
                                    (pointer)DriverInfoTable
                                    );
	if (status != USB_OK) 
	{
		printf("\nDriver Registration failed! STATUS: 0x%x",(unsigned int) status);
		fflush(stdout);
		exit(4);
   }    
  
  EnableInterrupts;
  #if (defined _MCF51MM256_H) || (defined _MCF51JE256_H)
  usb_int_en();
  #endif	  

  printf("USB Host Audio Demo\r\nWaitting for USB Audio Device to be attached...\r\n");
 
 _usb_event_init(&USB_Event);
 
	for(;;)
	{
    Poll(); 
    Audio_Task();
    __RESET_WATCHDOG(); /* feeds the dog */
  } /* loop forever */
  /* please make sure that you never leave main */
#ifdef __GNUC__
return 0;
#endif
}