From 80469b4bfaf49a407d8d6b5bf3c2eb0d1c9870e6 Mon Sep 17 00:00:00 2001 From: Joe Zhao Date: Fri, 16 May 2014 17:12:37 +0800 Subject: Comments update --- rs422lib/rsbus.h | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'rs422lib/rsbus.h') 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_ */ -- cgit v1.2.3-70-g09d2