コード例 #1
0
ファイル: host_ms_task.c プロジェクト: tslabs/avr
//! @brief This function manages the HOST mass storage application
//!
void host_ms_task(void)
{
   if( Is_host_ready() )   
   {
      // Here, Enumeration successfull, device is operationnal
      if(Is_new_device_connection_event())
      {
         // Update MS driver in case of
         if( host_mem_install() )
         {
#if (HOST_UPGRADE_MODE==ENABLE)
            b_new_msc_connected = TRUE;
#endif
            Led1_on();
         }
      }

#if (HOST_SYNC_MODE==ENABLE)  // Sync operating mode(if available)
      if( 0 != host_mem_get_lun() )
      {
         if(Is_joy_right())   // Sync device to host stream
         {
            Led0_on();
            sync_on_going=1;
            copy_dir( (U8 code *)dir_usb_out_name, (U8 code *)dir_local_in_name, 1 );
            sync_on_going=0;
            Led3_off();
            Led0_off();
         }
         if(Is_joy_left())    // Sync host to device stream
         {
            Led0_on();
            sync_on_going=1;
            copy_dir( (U8 code *)dir_local_out_name, (U8 code *)dir_usb_in_name, 1 );
            sync_on_going=0;
            Led0_off();
            Led3_off();
         }
      }
#endif

#if (HOST_UPGRADE_MODE==ENABLE)
      if( b_new_msc_connected )
      {
         // A new MSC is connected then start upgrade routine
         b_new_msc_connected = FALSE;
         firm_upgrade_run();
      }
#endif
   }

   // Device disconnection...
   if( Is_device_disconnection_event() )
   {
      // Update MS driver in case of
      host_mem_uninstall();
      Led1_off();
   }
}
コード例 #2
0
void buttons_read(){
  button_read(&button_joy_up, Is_joy_up());
  button_read(&button_joy_down, Is_joy_down());
  button_read(&button_joy_right, Is_joy_right());
  button_read(&button_joy_left, Is_joy_left());
  button_read(&button_joy_mid, Is_btn_middle());
  button_read(&button_hwb, Is_hwb());
}