purduesigbots / pros

Source code for PROS kernel: open source C/C++ development for the VEX V5 microcontroller
https://pros.cs.purdue.edu
Other
259 stars 76 forks source link

⬆️ PROS 4: Fix the implementation for get_type() in the virtual device class #547

Closed aberiggs closed 1 year ago

aberiggs commented 1 year ago

Summary:

Implement the device class as a base class with get_type() no longer being a virtual function. Renamed get_type() to get_plugged_type() for clarity, as get_type() now makes a registry call to get the device type plugged into the port associated with a given Device object.

Removed get_type() from children of the device class.

Implemented changes (based on Ryan Doan's PR) to vdml.h and registry.h to define v5_device_e_t

Motivation:

Allows for users to dynamically find out the type of device that is plugged in.

References:

Closes #527

Test Plan: