Skip to content
This repository has been archived by the owner on Jan 3, 2020. It is now read-only.

Commit

Permalink
Refactor UsbSerial
Browse files Browse the repository at this point in the history
Remove kruft leftover from original design
Refactor flow of `begin()` method
Rename members to more accurately reflect functionality
Prune unnecessary member variables
Added destructor to clear state
  • Loading branch information
zfields committed Jun 16, 2015
1 parent 7e2ba12 commit 99c3032
Show file tree
Hide file tree
Showing 3 changed files with 453 additions and 492 deletions.
68 changes: 34 additions & 34 deletions source/Serial/IStream.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#pragma once

/*
Copyright(c) Microsoft Open Technologies, Inc. All rights reserved.
Expand All @@ -24,75 +22,77 @@
THE SOFTWARE.
*/

#pragma once

#include <cstdint>

namespace Microsoft {
namespace Maker {
namespace Serial {

public enum class SerialConfig {
SERIAL_5E1,
SERIAL_5E2,
SERIAL_5N1,
SERIAL_5N2,
SERIAL_5O1,
SERIAL_5O2,
SERIAL_6E1,
SERIAL_6E2,
SERIAL_6N1,
SERIAL_6N2,
SERIAL_6O1,
SERIAL_6O2,
SERIAL_7E1,
SERIAL_7E2,
SERIAL_7N1,
SERIAL_7N2,
SERIAL_7O1,
SERIAL_7O2,
SERIAL_8E1,
SERIAL_8E2,
SERIAL_8N1,
SERIAL_8N2,
SERIAL_8O1,
SERIAL_8O2,
SERIAL_CONFIG_COUNT,
SERIAL_5E1,
SERIAL_5E2,
SERIAL_5N1,
SERIAL_5N2,
SERIAL_5O1,
SERIAL_5O2,
SERIAL_6E1,
SERIAL_6E2,
SERIAL_6N1,
SERIAL_6N2,
SERIAL_6O1,
SERIAL_6O2,
SERIAL_7E1,
SERIAL_7E2,
SERIAL_7N1,
SERIAL_7N2,
SERIAL_7O1,
SERIAL_7O2,
SERIAL_8E1,
SERIAL_8E2,
SERIAL_8N1,
SERIAL_8N2,
SERIAL_8O1,
SERIAL_8O2,
SERIAL_CONFIG_COUNT,
};

public delegate void RemoteWiringConnectionCallback();
public delegate void RemoteWiringConnectionFailedCallback( Platform::String ^message );
public delegate void RemoteWiringConnectionFailedCallback(Platform::String ^message);

public interface struct IStream
{
virtual
uint16_t
available(
void
) = 0;
) = 0;

virtual
void
begin(
uint32_t baud_,
SerialConfig config_
) = 0;
SerialConfig config_
) = 0;

virtual
void
end(
void
) = 0;
) = 0;

virtual
uint16_t
read(
void
) = 0;
) = 0;

virtual
uint32_t
write(
uint8_t c_
) = 0;
) = 0;
};

} // namespace Serial
Expand Down
Loading

0 comments on commit 99c3032

Please sign in to comment.