RE: RS-485 problems » RS485.h
| 1 |
/*
|
|---|---|
| 2 |
* RS485.h
|
| 3 |
*
|
| 4 |
* Created on: 2013-07-16
|
| 5 |
* Author: mitydsp
|
| 6 |
*/
|
| 7 |
|
| 8 |
#ifndef RS485_H_
|
| 9 |
#define RS485_H_
|
| 10 |
|
| 11 |
#include <linux/serial.h>
|
| 12 |
#include <stdio.h>
|
| 13 |
#include <stdlib.h>
|
| 14 |
#include <fcntl.h>
|
| 15 |
#include <termios.h>
|
| 16 |
#include <unistd.h>
|
| 17 |
#include <string.h>
|
| 18 |
|
| 19 |
/* Driver-specific ioctls: */
|
| 20 |
#define TIOCGRS485 0x542E
|
| 21 |
#define TIOCSRS485 0x542F
|
| 22 |
|
| 23 |
/* new defines in linux/serial.h of CL provided kernel */
|
| 24 |
#ifndef SER_RS485_USE_GPIO
|
| 25 |
#define SER_RS485_USE_GPIO (1<<5)
|
| 26 |
#define gpio_pin padding[0]
|
| 27 |
#endif
|
| 28 |
|
| 29 |
#define GPIO0_9 (9)
|
| 30 |
|
| 31 |
#define USE2
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
// Common code belongs in the MityDSP namespace
|
| 37 |
namespace MityDSP |
| 38 |
{
|
| 39 |
class tcArmRS485 |
| 40 |
{
|
| 41 |
private:
|
| 42 |
struct serial_rs485 rs485conf; |
| 43 |
int i, rv, opt; |
| 44 |
struct termios my_termios, new_termios, stdio; |
| 45 |
bool isOpen; |
| 46 |
public:
|
| 47 |
int termHandle; |
| 48 |
bool isReady; |
| 49 |
tcArmRS485(void); |
| 50 |
virtual ~tcArmRS485(); |
| 51 |
|
| 52 |
};
|
| 53 |
} // end of MityDSP namespace |
| 54 |
|
| 55 |
#endif /* RS485_H_ */ |
- « Previous
- 1
- 2
- Next »