Skip to content

Commit 29b5b88

Browse files
committed
Platform examples: Fix after review
1 parent b003e2d commit 29b5b88

File tree

8 files changed

+19
-24
lines changed

8 files changed

+19
-24
lines changed

APIs_Platform/FileHandle/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
## FileHandle example
2-
3-
The example monitors a serial console device, and every time it outputs a character, send it to the console back and toggle LED2.
4-
5-
1. Flash the board, and ensure the target's USB is plugged into the PC.
6-
2. Open serial console (select associated COM port, transmission speed: 19200 bps).
7-
3. Reset the target.
8-
4. Every time that device outputs a character, the character should appear in the console and LED2 should be toggled LED2.
9-
10-
**Note:** You can check the associated serial port using `mbedls` command.
1+
## FileHandle example
2+
3+
The example monitors a serial console device, and every time it reads a character, it sends it back to the console and toggles LED2.
4+
5+
1. Flash the board, and ensure the target's USB is plugged into the PC.
6+
2. Open serial console (select associated COM port, transmission speed: 9600 bps).
7+
3. Reset the target.
8+
4. Every time that device reads a character, the character should appear in the console and LED2 should be toggled.
9+
10+
**Note:** You can check the associated serial port using `mbedls` command.

APIs_Platform/FileHandle/main.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ static BufferedSerial device(STDIO_UART_TX, STDIO_UART_RX);
1111

1212
int main()
1313
{
14-
// Perform device-specific setup
15-
device.set_baud(19200);
16-
1714
// Once set up, access through the C library
1815
FILE *devin = fdopen(&device, "r");
1916

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
## FileHandle sigio example
22

3-
The example monitors a serial console device, and every time it outputs a character, send it to the console back and toggle LED2.
3+
The example monitors a serial console device, and every time it reads a character, it sends it back to the console and toggles LED2.
44

55
1. Flash the board, and ensure the target's USB is plugged into the PC.
6-
2. Open serial console (select associated COM port, transmission speed: 19200 bps).
6+
2. Open serial console (select associated COM port, transmission speed: 9600 bps).
77
3. Reset the target.
8-
4. Every time that device outputs a character, the character should appear in the console and LED2 should be toggled LED2.
8+
4. Every time that device reads a character, the character should appear in the console and LED2 should be toggled.
99

1010
**Note:** You can check the associated serial port using `mbedls` command.

APIs_Platform/FileHandle_sigio/main.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,13 @@ static void callback_ex()
1919
break;
2020
}
2121
putchar(c);
22+
putchar('\n');
2223
led2 = !led2;
2324
}
2425
}
2526

2627
int main()
2728
{
28-
// BufferedSerial-specific method - all others are from FileHandle base class
29-
device.set_baud(19200);
30-
3129
// Ensure that device.read() returns -EAGAIN when out of data
3230
device.set_blocking(false);
3331

APIs_Platform/Poll/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The example transfers bidirectional data between two serial ports, acting as a v
1919
3. Connect second serial port to PC via USB to serial adapter (UART1).
2020
4. Open two serial consoles (select associated COM ports, transmission speed: 9600 bps).
2121
5. Reset the target.
22-
6. Data send from one console should appear in the other one and vice versa.
22+
6. Data sent from one console should appear in the other one and vice versa.
2323

2424
**Note:** You can check the associated serial port using `mbedls` command (UART2).
2525
**Note:** Note: On Windows you can check the associated COM port in the Device Manager (UART1).

APIs_Platform/Poll/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
* Copyright (c) 2006-2020 Arm Limited and affiliates.
33
* SPDX-License-Identifier: Apache-2.0
44
*/
5-
// Transfer bidirectional data between two ports, acting as a virtual link.
6-
// poll() is used to monitor both ports for input.
75
#include "mbed.h"
86

97
// Pins for each port are specified using mbed_app.json. Assume no flow control.
@@ -37,6 +35,8 @@ static void copy_some(FileHandle *out, FileHandle *in)
3735
}
3836
}
3937

38+
// Transfer bidirectional data between two ports, acting as a virtual link.
39+
// poll() is used to monitor both ports for input.
4040
int main()
4141
{
4242
pollfh fds[2];
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
## ScopedRamExecutionLock example
1+
## ScopedRomWriteLock example
22

33
The example shows how to use ScopedRomWriteLock class for enabling writing to ROM.

APIs_Platform/ScopedRomWriteLock/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
int main()
88
{
9-
// Enable execution from RAM while in main
9+
// Enable writing to ROM while in main
1010
ScopedRomWriteLock make_rom_writable;
1111

1212
//custom_flash_programming();

0 commit comments

Comments
 (0)