NiboRoboLib 3.6 - NIBObee Library
bgx1_protocol.h
gehe zur Dokumentation dieser Datei
1 /* BSD-License:
2 
3 Copyright (c) 2010 by Nils Springob, nicai-systems, Germany
4 
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without modification,
8 are permitted provided that the following conditions are met:
9 
10  * Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12  * Redistributions in binary form must reproduce the above copyright notice,
13  this list of conditions and the following disclaimer in the documentation
14  and/or other materials provided with the distribution.
15  * Neither the name nicai-systems nor the names of its contributors may be
16  used to endorse or promote products derived from this software without
17  specific prior written permission.
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 */
32 
40 #ifndef NIBOBEE_BGX1_PROTOCOL_H_
41 #define NIBOBEE_BGX1_PROTOCOL_H_
42 
43 #include <stdint.h>
44 #include <avr/pgmspace.h>
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 
51 #define BGX1_VERSION 0x0103
52 
53 
54 enum {
55  // System:
56  CMD_Reset = 0x00, // () -> ()
57  CMD_GetVersion = 0x01, // () -> (uint16_t version)
58  CMD_GetStatus = 0x02, // () -> (uint8_t status)
59  CMD_SetStatus = 0x03, // (uint8_t status) -> ()
60  //CMD_ReadEEPROM = 0x04, // (uint16_t address, uint8_t size) -> (uint8_t[] data)
61  //CMD_WriteEEPROM = 0x05, // (uint16_t address, uint8_t size, uint8_t[] data) -> ()
62 
63  // Display:
64  CMD_Move = 0x10, // (uint8_t x, uint8_t y) -> ()
65  CMD_Mode = 0x11, // (uint8_t mode) -> ()
66  CMD_FillAll = 0x12, // (uint8_t pattern) -> ()
67  CMD_Print = 0x13, // (char text[]) -> (uint8_t x, uint8_t y)
68  CMD_TextWidth = 0x14, // (char text[]) -> (uint8_t width)
69  CMD_SelectFont = 0x15, // (uint8_t id) -> ()
70  CMD_HLine = 0x16, // (uint8_t length) -> (uint8_t x, uint8_t y)
71  CMD_VLine = 0x17, // (uint8_t length) -> (uint8_t x, uint8_t y)
72  CMD_Box = 0x18, // (uint8_t width, uint8_t height) -> (uint8_t x, uint8_t y)
73  CMD_Bitmap = 0x19, // (uint8_t width, uint8_t height, uint8_t bitmap[]) -> (uint8_t x, uint8_t y)
74  CMD_EmbeddedImage = 0x1a, // (uint8_t id) -> (uint8_t x, uint8_t y)
75  CMD_LineTo = 0x1b, // (uint8_t x, uint8_t y) -> ()
76 
77  // Terminal:
78  CMD_TermClear = 0x30, // () -> ()
79  CMD_TermGoto = 0x31, // (uint8_t col, uint8_t row) -> ()
80  CMD_TermScroll = 0x32, // (uint8_t lines) -> ()
81  CMD_TermPrint = 0x33, // (char text[]) -> ()
82 
83  // IO:
84  CMD_SyncPort = 0x40, // (uint8_t ddr, uint8_t port) -> (uint8_t pin)
85  CMD_GetAnalog = 0x41, // (uint8_t idx) -> (uint16_t value)
86  CMD_SyncInterface = 0x42, // (uint8_t leds) -> (uint8_t keys)
87  CMD_SetIllumination = 0x43, // (uint16_t value) -> ()
88 
89  CMD_INVALID = 0xff
90 };
91 
92 
93 #ifdef __cplusplus
94 } // extern "C"
95 #endif
96 
97 #endif // NIBOBEE_BGX1_PROTOCOL_H_