Ejemplo n.º 1
0
uint8_t
Keyboard__get_report(USB_KeyboardReport_Data_t *report_data)
{
  reset();

#ifdef STDOUT_TO_KBREPORT
  if (!stdout_is_empty())
    stdout_to_report_queue();
#endif

  KeyboardReport *report = NULL;

  if (ReportQueue__is_empty())
  {
    scan_matrix();
    init_active_keys();

    if (!kb.error_roll_over && (report = ReportQueue__push()))
    {
      do
        update_bindings(report);
      while (momentary_mode_engaged() || modifier_keys_engaged(report));
      process_keys(report);
    }
  }

  report = ReportQueue__pop();
  return fill_report(report, report_data);
}
Ejemplo n.º 2
0
char
stdout_popchar(void)
{
  if (stdout_is_empty())
  {
    return '\0';
  }

  char ch = output_buffer[front];
  front = (front + 1) % OUTPUT_BUFSIZE;
  if (ch == '\\')
  {
    switch ((ch = output_buffer[front]))
    {
    case 'n':
      ch = (char)10; break;
    case 't':
      ch = (char)9;  break;
    case 'b':
      ch = (char)8;  break;
    case '\\':
      break;
    }
    front = (front + 1) % OUTPUT_BUFSIZE;
  }
  count--;
  return ch;
}