Переглянути джерело

ad hoc fix for wrong bit read problem of adb.c.

tags/v1.9
tmk 11 роки тому
джерело
коміт
dd0017558e
1 змінених файлів з 6 додано та 0 видалено
  1. 6
    0
      protocol/adb.c

+ 6
- 0
protocol/adb.c Переглянути файл

#include <stdbool.h> #include <stdbool.h>
#include <util/delay.h> #include <util/delay.h>
#include <avr/io.h> #include <avr/io.h>
#include <avr/interrupt.h>
#include "adb.h" #include "adb.h"




return 0; // No data to send return 0; // No data to send
if (!read_bit()) // Startbit(1) if (!read_bit()) // Startbit(1)
return -2; return -2;

// ad hoc fix: without block inerrupt read wrong bit occasionally and get keys stuck
cli();
data = read_byte(); data = read_byte();
data = (data<<8) | read_byte(); data = (data<<8) | read_byte();
sei();

if (read_bit()) // Stopbit(0) if (read_bit()) // Stopbit(0)
return -3; return -3;
return data; return data;

Завантаження…
Відмінити
Зберегти