Skip to content

Commit 3299088

Browse files
Improve Readme (#85)
***NO_CI***
1 parent 4824268 commit 3299088

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,32 +26,32 @@ var port = new SerialPort("COM2");
2626

2727
Note that the port name **must** be `COMx` where x is a number.
2828

29-
The GetPortNames method will gi you a list of available ports:
29+
The `GetPortNames` method will give you a list of available ports:
3030

3131
```csharp
3232
var ports = SerialPort.GetPortNames();
3333
```
3434

35-
You can as well directly specify the baud rate and other elements in the constructor:
35+
You can also directly specify the baud rate and other elements in the constructor:
3636

3737
```csharp
3838
var port = new SerialPort("COM2", 115200);
3939
```
4040

41-
Each property can be adjusted, including while the port is open. Be aware that this can generate hazardous behaviors. It is always recommended to change the properties once the port is closed.
41+
Each property can be adjusted, including when the port is open. Be aware that this can generate hazardous behaviors. It is always recommended to change the properties while the port is closed.
4242

43-
**Important**: you should setup a timeout for the read and write operations. If you have none, while operating a read or a write, you will wait indefinitely to read or write that everything is received or sent.
43+
**Important**: You should setup a timeout for the read and write operations. If you have none, read or a write periods may cause theads to be locked for indefinite periods.
4444

4545
```csharp
4646
port.WriteTimeout = 1000;
4747
port.ReadTimeout = 1000;
4848
```
4949

50-
Note: some MCU do not support Hankshake or specific bit parity even if you can set them up in the constructor.
50+
Note: some MCU do not support Handshake or specific bit parity even if you can set them up in the constructor.
5151

5252
### Opening and Closing the port
5353

54-
The port can only be in operation once open and will finish his operations when closed. If you dispose the SerialPort, it will close it before.
54+
The `SerialPort` can only operate once open and will finish the operations when closed. When disposed, the `SerialPort` will perform the close operation regardless of any ongoing receive or transmit operations.
5555

5656
```csharp
5757
var port = new SerialPort("COM2");
@@ -62,7 +62,8 @@ port.Close();
6262

6363
### Read and Write
6464

65-
You have multiple functions to read and write, some are byte related, others string related. Note that the string one will use the `Enconding` charset that you will define. By default, this is UTF8.
65+
You have multiple functions to read and write, some are byte related, others string related.
66+
Note that string functions will use UTF8 `Encoding` charset.
6667

6768
#### Sending and receiving bytes
6869

@@ -88,7 +89,7 @@ byte oneByte = port.ReadByte();
8889

8990
#### Sending and receiving string
9091

91-
You can as well write and read strings:
92+
Example:
9293

9394
```csharp
9495
string toSend = "I ❤ nanoFramework";
@@ -109,6 +110,8 @@ string aFullLine = port.ReadLine();
109110

110111
### Events
111112

113+
#### Character
114+
112115
SerialPort supports events when characters are received.
113116

114117
```csharp
@@ -127,7 +130,8 @@ private void DataReceivedNormalEvent(object sender, SerialDataReceivedEventArgs
127130
}
128131
```
129132

130-
#### Case of WatchChar
133+
#### WatchChar
134+
131135

132136
.NET nanoFramework has a specific API to watch for a specific character if present at the end of the transmission.
133137

0 commit comments

Comments
 (0)