Format code according to conventions (#16322)
This commit is contained in:
parent
afcdd7079c
commit
63646e8906
345 changed files with 4916 additions and 3229 deletions
|
@ -23,7 +23,9 @@ void clock_lo(void) {
|
|||
setPinOutput(PS2_CLOCK_PIN);
|
||||
}
|
||||
|
||||
void clock_hi(void) { setPinInputHigh(PS2_CLOCK_PIN); }
|
||||
void clock_hi(void) {
|
||||
setPinInputHigh(PS2_CLOCK_PIN);
|
||||
}
|
||||
|
||||
bool clock_in(void) {
|
||||
setPinInputHigh(PS2_CLOCK_PIN);
|
||||
|
@ -42,7 +44,9 @@ void data_lo(void) {
|
|||
setPinOutput(PS2_DATA_PIN);
|
||||
}
|
||||
|
||||
void data_hi(void) { setPinInputHigh(PS2_DATA_PIN); }
|
||||
void data_hi(void) {
|
||||
setPinInputHigh(PS2_DATA_PIN);
|
||||
}
|
||||
|
||||
bool data_in(void) {
|
||||
setPinInputHigh(PS2_DATA_PIN);
|
||||
|
|
|
@ -76,7 +76,7 @@ static inline bool pbuf_has_data(void);
|
|||
static inline void pbuf_clear(void);
|
||||
|
||||
void ps2_host_init(void) {
|
||||
idle(); // without this many USART errors occur when cable is disconnected
|
||||
idle(); // without this many USART errors occur when cable is disconnected
|
||||
PS2_USART_INIT();
|
||||
PS2_USART_RX_INT_ON();
|
||||
// POR(150-2000ms) plus BAT(300-500ms) may take 2.5sec([3]p.20)
|
||||
|
@ -91,12 +91,12 @@ uint8_t ps2_host_send(uint8_t data) {
|
|||
|
||||
/* terminate a transmission if we have */
|
||||
inhibit();
|
||||
_delay_us(100); // [4]p.13
|
||||
_delay_us(100); // [4]p.13
|
||||
|
||||
/* 'Request to Send' and Start bit */
|
||||
data_lo();
|
||||
clock_hi();
|
||||
WAIT(clock_lo, 10000, 10); // 10ms [5]p.50
|
||||
WAIT(clock_lo, 10000, 10); // 10ms [5]p.50
|
||||
|
||||
/* Data bit[2-9] */
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
|
@ -165,7 +165,7 @@ uint8_t ps2_host_recv(void) {
|
|||
|
||||
ISR(PS2_USART_RX_VECT) {
|
||||
// TODO: request RESEND when error occurs?
|
||||
uint8_t error = PS2_USART_ERROR; // USART error should be read before data
|
||||
uint8_t error = PS2_USART_ERROR; // USART error should be read before data
|
||||
uint8_t data = PS2_USART_RX_DATA;
|
||||
if (!error) {
|
||||
pbuf_enqueue(data);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue