| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#ifndef SERIAL_H |
| 6 |
#define SERIAL_H |
| 7 |
|
| 8 |
#include <stdbool.h> |
| 9 |
#include <stdint.h> |
| 10 |
|
| 11 |
#ifdef __cplusplus |
| 12 |
extern "C" { |
| 13 |
#endif |
| 14 |
|
| 15 |
#define SERIAL_ATNIN_MASK (1<<3) |
| 16 |
#define SERIAL_CLOCKIN_MASK (1<<4) |
| 17 |
#define SERIAL_DATAIN_MASK (1<<5) |
| 18 |
|
| 19 |
typedef struct { |
| 20 |
struct { |
| 21 |
int atn; |
| 22 |
int clk; |
| 23 |
int data; |
| 24 |
} in; |
| 25 |
struct { |
| 26 |
int clk; |
| 27 |
int data; |
| 28 |
} out; |
| 29 |
} serial_port_t; |
| 30 |
|
| 31 |
extern serial_port_t serial_port; |
| 32 |
|
| 33 |
void serial_step(int clocks); |
| 34 |
|
| 35 |
bool serial_port_read_clk(); |
| 36 |
bool serial_port_read_data(); |
| 37 |
|
| 38 |
#ifdef __cplusplus |
| 39 |
} |
| 40 |
#endif |
| 41 |
|
| 42 |
#endif |