diff options
author | Joe Zhao <ztuowen@gmail.com> | 2014-05-16 17:12:37 +0800 |
---|---|---|
committer | Joe Zhao <ztuowen@gmail.com> | 2014-05-16 17:12:37 +0800 |
commit | 80469b4bfaf49a407d8d6b5bf3c2eb0d1c9870e6 (patch) | |
tree | 12c312dc2c7a32a5e987d4603b6179b5fab6d391 /rs422lib/rsbus.h | |
parent | b038c3b87564e9f4acac0019b18fd6d20692ac38 (diff) | |
download | rsbus-80469b4bfaf49a407d8d6b5bf3c2eb0d1c9870e6.tar.gz rsbus-80469b4bfaf49a407d8d6b5bf3c2eb0d1c9870e6.tar.bz2 rsbus-80469b4bfaf49a407d8d6b5bf3c2eb0d1c9870e6.zip |
Comments update
Diffstat (limited to 'rs422lib/rsbus.h')
-rw-r--r-- | rs422lib/rsbus.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/rs422lib/rsbus.h b/rs422lib/rsbus.h index 2faf620..2e29b9b 100644 --- a/rs422lib/rsbus.h +++ b/rs422lib/rsbus.h @@ -34,17 +34,30 @@ // Available indices 0,1,2
#define STATE(X) (mac_stat[X+1])
+// Start and Stop bits definition
+// Every message sent that does not agree with it will be ignored
+// Please avoid this pattern in STATE(X)
#define STBIT0 (0x5B)
#define STBIT1 (0xAD)
#define EDBIT0 (0xA4)
#define EDBIT1 (0x52)
-typedef void (*rshdlr)(unsigned char*,int);
+// Receieve handler ->
+// Received message and it's length
+typedef void (*rshdlr)(unsigned char* msg,unsigned int len);
+// RSBUS init function
+// Setting up UART, DE pin, receieve handler
void rsbus_init(rshdlr);
-void rsbus_w(int addr,unsigned char* buf,unsigned int len);
+// Send something to the rs422 bus
+// Length must not exceeds RS_MAX
+void rsbus_w(int,unsigned char*,unsigned int);
-extern volatile unsigned char mac_stat[4]; // Machine status -> change it to change the auto respond status
+// Machine status -> change it to change the auto respond status
+// 0 is reserved for machine state specification
+// 1-3 used for mac_type specific state
+// recommend using SWITCH_STATE & STATE
+extern volatile unsigned char mac_stat[4];
#endif /* RSBUS_H_ */
|