Project

General

Profile

Statistics
| Revision:

root / trunk / common / rs485_poll.h @ 186

History | View | Annotate | Download (1.35 KB)

1
/********
2
 * This file is part of Tooltron.
3
 *
4
 * Tooltron is free software: you can redistribute it and/or modify
5
 * it under the terms of the Lesser GNU General Public License as published by
6
 * the Free Software Foundation, either version 3 of the License, or
7
 * (at your option) any later version.
8
 *
9
 * Tooltron is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * Lesser GNU General Public License for more details.
13
 * You should have received a copy of the Lesser GNU General Public License
14
 * along with Tooltron.  If not, see <http://www.gnu.org/licenses/>.
15
 *
16
 * Copyright 2009 Kevin Woo <kwoo@2ndt.com>
17
 *
18
 ********/
19
/** 
20
 * @file rs485_poll.h
21
 * @brief Implements rs485 using the uart hardware module.
22
 *
23
 * See rs485_sw.c for more information
24
 *
25
 * @author Kevin Woo (kwoo)
26
 */
27

    
28
#ifndef _RS485_SW_H
29
#define _RS485_SW_H
30

    
31
#include <avr/io.h>
32
#include <avr/interrupt.h>
33
#include <stdint.h>
34

    
35
#define RS485_TX_OFF 0
36
#define RS485_TX_ON 1
37

    
38
/** @brief RX Pin for the RS485 */
39
#define RX                _BV(PORTD0)
40
/** @brief TX Pin for the RS485 */
41
#define TX                _BV(PORTD1)
42
/** @brief TX Enable Pin for the RS485 */
43
#define TX_EN        _BV(PORTD5)
44

    
45
void rs485_init(uint16_t baud);
46
int8_t rs485_get_byte(uint8_t *output_byte);
47
void rs485_send_byte(uint8_t data);
48
#endif