Ejemplo n.º 1
0
/**
* This is called when the kernel attaches the module.
* This is the first time the class can be expected to have kernel access.
*
* @return 0 on no action, 1 on action, -1 on failure.
*/
int8_t STM32F7USB::attached() {
  if (EventReceiver::attached()) {
    read_abort_event.alterScheduleRecurrence(-1);
    read_abort_event.alterSchedulePeriod(50);
    read_abort_event.autoClear(false);
    read_abort_event.enableSchedule(true);
    #if !defined (__BUILD_HAS_THREADS)
      platform.kernel()->addSchedule(&read_abort_event);
    #endif

    reset();
    if (_accumulator.count() > 0) {
      TM_USBD_CDC_Puts(TM_USB_FS, (const char*)_accumulator.string());
      //_tx_in_progress = true;
  	  TM_USBD_CDC_Process(TM_USB_FS);
    }
    return 1;
  }
  return 0;
}