-
Notifications
You must be signed in to change notification settings - Fork 14
♻️ Refactor VDML #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
♻️ Refactor VDML #40
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
e916e91
💥 Delete old VDML implementation
Exortions b609bc6
✨ New main vdml header
Exortions 7af7833
♻️ Refactor vdml namespace under zest namespace
Exortions e3f6885
✨ Implement registry
Exortions 332aefc
✨ Begin to implement registry
Exortions 179b0f5
Merge branch 'main' into refactor/vdml
liam-teale 13acc58
Merge branch 'main' into refactor/vdml
liam-teale 9cbd6e9
🎨 Update VDML to new style guide
Exortions af4a165
💩 [temp] add stubs for compilation
Exortions 8982fc5
🚚 Rename to new vdml headers in stubs
Exortions fae8114
🐛 Initialize registry in vdml
Exortions 67f9ab7
🐛 Use PROS mutex
Exortions 6e07d28
🐛 Utilize static_cast
Exortions 3a19936
Merge branch 'main' into refactor/vdml
liam-teale 4902917
Merge remote-tracking branch 'origin/main' into refactor/vdml
liam-teale 4252081
Merge branch 'main' into refactor/vdml
liam-teale 260fd1c
Merge remote-tracking branch 'origin/main' into refactor/vdml
liam-teale 0fe8114
Merge remote-tracking branch 'origin/main' into refactor/vdml
liam-teale File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| #ifndef VDML_REGISTRY_HPP | ||
| #define VDML_REGISTRY_HPP | ||
|
|
||
| #include "v5_apitypes.h" | ||
| #include "vdml/vdml.hpp" | ||
|
|
||
| #include <cstdint> | ||
| #include <optional> | ||
|
|
||
| namespace zest { | ||
| namespace vdml { | ||
| enum class DeviceType { | ||
| NONE = 0, | ||
| MOTOR = 2, | ||
| ROTATION = 4, | ||
| IMU = 6, | ||
| DISTANCE = 7, | ||
| RADIO = 8, | ||
| VISION = 11, | ||
| ADI = 12, | ||
| OPTICAL = 16, | ||
| GPS = 20, | ||
| AI_VISION = 29, | ||
| SERIAL = 129, | ||
| UNDEFINED = 255 | ||
| }; | ||
|
|
||
| struct DeviceInfo { | ||
| DeviceType type; | ||
| uint32_t data; | ||
| }; | ||
|
|
||
| static std::array<std::optional<DeviceInfo>, MAX_DEVICE_PORTS> device_registry; | ||
| static V5_DeviceType registry_types[MAX_DEVICE_PORTS]; | ||
|
|
||
| void initialize_registry(); | ||
|
|
||
| void update_registry(); | ||
| std::optional<DeviceInfo> set_device(uint8_t port, DeviceType type); | ||
| std::optional<DeviceInfo> get_device(uint8_t port); | ||
| bool validate_device(uint8_t port, DeviceType expected); | ||
| } // namespace vdml | ||
| } // namespace zest | ||
|
|
||
| // STUBS SO OLD VDML CODE COMPILES | ||
|
|
||
| typedef struct { | ||
| pros::c::v5_device_e_t device_type; | ||
| V5_DeviceT device_info; | ||
| uint8_t pad[128]; // 16 bytes in adi_data_s_t times 8 ADI Ports = 128 | ||
| } v5_smart_device_s_t; | ||
|
|
||
| void registry_update_types(); | ||
| v5_smart_device_s_t* registry_get_device(uint8_t port); | ||
| v5_smart_device_s_t* registry_get_device_internal(uint8_t port); | ||
| int32_t registry_validate_binding(uint8_t port, pros::c::v5_device_e_t expected_t); | ||
|
|
||
| #endif | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This enum should have a comment explaining that these values are based on VEXos (since they seem rather arbitrary right now)