Updated return types

This commit is contained in:
2024-07-26 13:41:00 -04:00
parent 7cd43742b6
commit 6281fc9e7c

View File

@@ -15,7 +15,7 @@ template <uint16_t byteSize>
class SerialMessage{ class SerialMessage{
public: public:
// @warning Never use this to construct a SerialMessage object // @warning Never use this to construct a SerialMessage object
SerialMessage() = default; SerialMessage() = delete;
/** /**
* @brief Construct a new Serial Message object * @brief Construct a new Serial Message object
*/ */
@@ -46,19 +46,19 @@ class SerialMessage{
* @brief Return a pointer to the args array * @brief Return a pointer to the args array
* @return a pointer to the args array * @return a pointer to the args array
*/ */
uint32_t * GetArgs(); int32_t * GetArgs();
/** /**
* @brief Returns the number of args that have been populated for the current message * @brief Returns the number of args that have been populated for the current message
* @return the number of args that have been populated for the current message * @return the number of args that have been populated for the current message
*/ */
int GetArgsLength(); uint32_t GetArgsLength();
/** /**
* @brief Returns the number of args that have been populated for the current message * @brief Returns the number of args that have been populated for the current message
* @return the number of args that have been populated for the current message * @return the number of args that have been populated for the current message
*/ */
int GetPopulatedArgs(); uint32_t GetPopulatedArgs();
/** /**
* @brief Prints the args array to the serial monitor * @brief Prints the args array to the serial monitor
@@ -89,10 +89,10 @@ class SerialMessage{
SerialState state{IDLE}; SerialState state{IDLE};
char data[byteSize]; // an array to store the received data char data[byteSize]; // an array to store the received data
char temp_data[byteSize]; // an array that will be used with strtok() char temp_data[byteSize]; // an array that will be used with strtok()
uint16_t ndx{0}; uint32_t ndx{0};
static constexpr uint16_t args_length{30}; static constexpr uint16_t args_length{30};
uint16_t populatedArgs{0}; // the number of args that have been populated for the current message uint32_t populatedArgs{0}; // the number of args that have been populated for the current message
uint32_t args[args_length]; int32_t args[args_length];
const char startMarker = '!'; const char startMarker = '!';
const char endMarker = ';'; const char endMarker = ';';
@@ -196,17 +196,17 @@ void SerialMessage<byteSize>::ClearNewData(){
} }
template <uint16_t byteSize> template <uint16_t byteSize>
uint32_t * SerialMessage<byteSize>::GetArgs(){ int32_t * SerialMessage<byteSize>::GetArgs(){
return args; return args;
} }
template <uint16_t byteSize> template <uint16_t byteSize>
int SerialMessage<byteSize>::GetArgsLength(){ uint32_t SerialMessage<byteSize>::GetArgsLength(){
return args_length; return args_length;
} }
template <uint16_t byteSize> template <uint16_t byteSize>
int SerialMessage<byteSize>::GetPopulatedArgs(){ uint32_t SerialMessage<byteSize>::GetPopulatedArgs(){
return populatedArgs; return populatedArgs;
} }