-
Notifications
You must be signed in to change notification settings - Fork 0
/
FUJICOM.H
53 lines (46 loc) · 1.42 KB
/
FUJICOM.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
* low level FujiNet API
*/
typedef struct /* Command Frame */
{
unsigned char ddev; /* Destination Device */
unsigned char dcomnd; /* Command */
unsigned char daux1; /* Auxiliary Parameter 1 */
unsigned char daux2; /* Auxiliary Parameter 2 */
unsigned char dcksum; /* 8-bit checksum */
} cmdFrame_t;
/**
* @brief start fujicom
* @param p COM port (1-4)
*/
void fujicom_init(unsigned char p);
/**
* @brief calculate 8-bit checksum for cmdFrame_t.dcksum
* @param buf Buffer to compute checksum against
* @param len Length of aforementioned buffer
*/
unsigned char fujicom_cksum(unsigned char *buf, unsigned short len);
/**
* @brief send FujiNet frame with no payload
* @param cmdFrame Pointer to command frame
* @return 'C'omplete, 'E'rror, or 'N'ak
*/
char fujicom_command(cmdFrame_t *c);
/**
* @brief send fujinet frame and read payload
* @param cmdFrame pointer to command frame
* @param buf Pointer to buffer to receive
* @param len Expected buffer length
*/
char fujicom_command_read(cmdFrame_t *c, unsigned char *buf, unsigned short len);
/**
* @brief send fujinet frame and write payload
* @param cmdFrame pointer to command frame
* @param buf pointer to buffer to send.
* @param len Length of buffer to send.
*/
char fujicom_command_write(cmdFrame_t *c, unsigned char *buf, unsigned short len);
/**
* @brief end fujicom
*/
void fujicom_done(void);