65 lines
1.1 KiB
Protocol Buffer
65 lines
1.1 KiB
Protocol Buffer
import "nanopb.proto";
|
|
|
|
package tm1638;
|
|
|
|
enum Color {
|
|
GREEN = 1;
|
|
RED = 2;
|
|
BOTH = 3;
|
|
NONE = 4;
|
|
}
|
|
|
|
enum Module {
|
|
TM1638 = 1;
|
|
InvertedTM1638 = 2;
|
|
TM1640 = 3;
|
|
}
|
|
|
|
message Command {
|
|
enum Type {
|
|
SERVER = 1;
|
|
PING = 2;
|
|
CONSTRUCT = 3;
|
|
SET_LED = 4;
|
|
}
|
|
|
|
required Type type = 1;
|
|
optional Server server = 2;
|
|
optional Ping ping = 3;
|
|
optional Construct construct = 4;
|
|
optional SetLed setLed = 5;
|
|
}
|
|
|
|
message Server {
|
|
optional string host = 1;
|
|
required int32 port = 2;
|
|
}
|
|
|
|
message Ping {
|
|
required int32 id = 1;
|
|
}
|
|
|
|
message Echo {
|
|
required int32 id = 1;
|
|
optional string message = 2 [(nanopb).max_size = 40];
|
|
}
|
|
|
|
message Construct {
|
|
required int32 dataPin = 1;
|
|
required int32 clockPin = 2;
|
|
optional int32 strobePin = 3;
|
|
optional bool activateDisplay = 4 [default = true];
|
|
optional int32 intensity = 5 [default = 7];
|
|
optional Module module = 6 [default = TM1638];
|
|
optional int32 id = 7 [default = 0];
|
|
}
|
|
|
|
message SetLed {
|
|
required Color color = 1;
|
|
required int32 pos = 2;
|
|
optional int32 id = 3 [default = 1];
|
|
}
|
|
|
|
message Buttons {
|
|
required byte buttons;
|
|
} |