diff options
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_ */
|