Extended MaximInterface

Dependents:   mbed_DS28EC20_GPIO

Revision:
6:a8c83a2e6fa4
Parent:
3:f818ea5172ed
Child:
7:471901a04573
--- a/Links/Uart.hpp	Fri Jan 19 10:25:02 2018 -0600
+++ b/Links/Uart.hpp	Wed Jan 23 13:11:04 2019 -0600
@@ -34,9 +34,8 @@
 #define MaximInterface_Uart
 
 #include <stdint.h>
-#include <stddef.h>
-
 #include <MaximInterface/Utilities/Export.h>
+#include <MaximInterface/Utilities/span.hpp>
 #include <MaximInterface/Utilities/system_error.hpp>
 
 namespace MaximInterface {
@@ -65,7 +64,7 @@
   
   /// Writes a block of data to the port.
   MaximInterface_EXPORT virtual error_code
-  writeBlock(const uint_least8_t * data, size_t dataLen);
+  writeBlock(span<const uint_least8_t> data);
   
   /// Reads a byte of data from the port. Block until data is received or a
   /// timeout is reached.
@@ -75,9 +74,7 @@
   /// Read a block of data from the port. Block until data is received or a
   /// timeout is reached.
   /// @param[out] data Data read from the port if successful.
-  /// @para dataLen Number of bytes to read and length of data.
-  MaximInterface_EXPORT virtual error_code readBlock(uint_least8_t * data,
-                                                     size_t dataLen);
+  MaximInterface_EXPORT virtual error_code readBlock(span<uint_least8_t> data);
 
   MaximInterface_EXPORT static const error_category & errorCategory();
 };
@@ -85,10 +82,11 @@
 inline error_code make_error_code(Uart::ErrorValue e) {
   return error_code(e, Uart::errorCategory());
 }
+
 inline error_condition make_error_condition(Uart::ErrorValue e) {
   return error_condition(e, Uart::errorCategory());
 }
 
 } // namespace MaximInterface
 
-#endif
\ No newline at end of file
+#endif