diff options
author | Samuel Yvon <samuelyvon9@gmail.com> | 2022-07-04 16:47:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-04 16:47:07 +0300 |
commit | 9ebd2dea9d88de4188d9fc339b937bbaf9ea2222 (patch) | |
tree | 0039207b8626b825997d1ecde0e8492439e17c10 | |
parent | 6c1b8ae66a85bcd7e79e993a0b5573c38c302db5 (diff) |
Add GPIO objects (#30)
* Add a GPIO interface
* Update Changelog to v10: GPIO messages
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
-rw-r--r-- | Changelog | 4 | ||||
-rw-r--r-- | flipper.proto | 12 | ||||
-rw-r--r-- | gpio.options | 0 | ||||
-rw-r--r-- | gpio.proto | 57 |
4 files changed, 73 insertions, 0 deletions
@@ -1,5 +1,9 @@ # Changelog +## [0.10] +### Added +- GPIO message: SetPinMode, SetInputPull, GetPinMode, GetPinModeResponse, ReadPin, ReadPinResponse, WritePin + ## [0.9] ### Added - System message: UpdateResponse, enum UpdateResultCode: new entries diff --git a/flipper.proto b/flipper.proto index 10fdac0..9e1be6f 100644 --- a/flipper.proto +++ b/flipper.proto @@ -3,6 +3,7 @@ import "storage.proto"; import "system.proto"; import "application.proto"; import "gui.proto"; +import "gpio.proto"; package PB; option java_package = "com.flipperdevices.protobuf"; @@ -39,6 +40,10 @@ enum CommandStatus { /**< Virtual Display Errors */ ERROR_VIRTUAL_DISPLAY_ALREADY_STARTED = 19; /**< Virtual Display session can't be started twice */ ERROR_VIRTUAL_DISPLAY_NOT_STARTED = 20; /**< Virtual Display session can't be stopped when it's not started */ + + /**< GPIO Errors */ + ERROR_GPIO_MODE_INCORRECT = 58; + ERROR_GPIO_UNKNOWN_PIN_MODE = 59; } /* There are Server commands (e.g. Storage_write), which have no body message @@ -103,6 +108,13 @@ message Main { .PB_Gui.SendInputEventRequest gui_send_input_event_request = 23; .PB_Gui.StartVirtualDisplayRequest gui_start_virtual_display_request = 26; .PB_Gui.StopVirtualDisplayRequest gui_stop_virtual_display_request = 27; + .PB_Gpio.SetPinMode gpio_set_pin_mode = 50; + .PB_Gpio.SetInputPull gpio_set_input_pull = 51; + .PB_Gpio.GetPinMode gpio_get_pin_mode = 52; + .PB_Gpio.GetPinModeResponse gpio_get_pin_mode_response = 53; + .PB_Gpio.ReadPin gpio_read_pin = 54; + .PB_Gpio.ReadPinResponse gpio_read_pin_response = 55; + .PB_Gpio.WritePin gpio_write_pin = 56; } } diff --git a/gpio.options b/gpio.options new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/gpio.options diff --git a/gpio.proto b/gpio.proto new file mode 100644 index 0000000..446ae14 --- /dev/null +++ b/gpio.proto @@ -0,0 +1,57 @@ +syntax = "proto3"; + +package PB_Gpio; +option java_package = "com.flipperdevices.protobuf.gpio"; + +enum GpioPin { + PC0 = 0; + PC1 = 1; + PC3 = 2; + PB2 = 3; + PB3 = 4; + PA4 = 5; + PA6 = 6; + PA7 = 7; +}; + +enum GpioPinMode { + OUTPUT = 0; + INPUT = 1; +}; + +enum GpioInputPull { + NO = 0; + UP = 1; + DOWN = 2; +}; + +message SetPinMode { + GpioPin pin = 1; + GpioPinMode mode = 2; +} + +message SetInputPull { + GpioPin pin = 1; + GpioInputPull pull_mode = 2; +} + +message GetPinMode { + GpioPin pin = 1; +} + +message GetPinModeResponse { + GpioPinMode mode = 1; +} + +message ReadPin { + GpioPin pin = 1; +} + +message ReadPinResponse { + uint32 value = 2; +} + +message WritePin { + GpioPin pin = 1; + uint32 value = 2; +} |