Project

General

Profile

Download (655 Bytes) Statistics
| Branch: | Tag: | Revision:
1
#ifndef _SOFT_UART_H
2
#define _SOFT_UART_H
3

    
4
enum suart_state {
5
	WAIT_RESET,
6
	IN_RESET,
7
	WAIT_START_FALLEDGE,
8
	WAIT_START_ETU07,
9
	RX_BITS,
10
	POST_RX_WAIT_HIGH,
11
};
12

    
13
enum suart_convention {
14
	DIRECT_CONVENTION,
15
	INVERSE_CONVENTION,
16
};
17

    
18
struct suart_data {
19
	uint32_t samplerate;	/* samples per second input rate */
20
	uint32_t recip_etu;	/* 1/etu */
21
	uint8_t num_bits;
22

    
23
	enum suart_state state;
24
	enum suart_convention convention;
25

    
26
	uint32_t sample_after_sbit;
27
	uint8_t bits_pending;
28

    
29
	uint8_t rx_char;
30
};
31

    
32
int suart_process_sample_bit(struct suart_data *suart, uint8_t clk_bit, uint8_t rst_bit, uint8_t sample_bit);
33
void suart_init(struct suart_data *su);
34

    
35
#endif
(7-7/7)
Add picture from clipboard (Maximum size: 48.8 MB)