Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add readable(), writeable() and settings changed callback to USBSerial #99

Merged
merged 1 commit into from
Nov 5, 2013

Conversation

xiongyihui
Copy link
Contributor

For class Serial has readable() and writeable(), add them to class USBSerial, switch between Serial and USBSerial easily.
Add settings changed callback to USBSerial to implement a USB to UART bridge.

#include "mbed.h"
#include "USBSerial.h"

Serial uart(USBTX, USBRX);
USBSerial pc;

void settingsChanged(int baud, int bits, int parity, int stop)                // Called by ISR
{
    const Serial::Parity parityTable[] = {Serial::None, Serial::Odd, Serial::Even, Serial::Forced0, Serial::Forced1};
    if (stop != 2) {
        stop = 1;   // stop bit(s) = 1 or 1.5
    }
    uart.baud(baud);
    uart.format(bits, parityTable[parity], stop);
}

int main()
{
    pc.attach(settingsChanged);
    while (1) {
        while (uart.readable()) {
           pc.putc(uart.getc());
        }     
        while (pc.readable()) {
            uart.putc(pc.getc());
        }
    }
}

bogdanm added a commit that referenced this pull request Nov 5, 2013
add readable(), writeable() and settings changed callback to USBSerial
@bogdanm bogdanm merged commit cf71d08 into ARMmbed:master Nov 5, 2013
bridadan pushed a commit that referenced this pull request Jun 21, 2016
Fix SocketAddress constructor to support ipv6
yossi2le pushed a commit to yossi2le/mbed-os that referenced this pull request Jan 2, 2019
* Add  "PAL_INT_FLASH_NUM_SECTIONS=2" 
For all target as PAL only provided this define for
the 3 default targets.
linlingao added a commit to linlingao/mbed-os that referenced this pull request Jul 12, 2019
Refactor target directory. Add board cc3220sf_launchxl to the target
pan- added a commit to pan-/mbed that referenced this pull request May 29, 2020
DISCO_L475VG_IOT01A: Add this platform in the supported list of boards
artokin pushed a commit to artokin/mbed-os that referenced this pull request Aug 21, 2020
…from 6d72419d8b..293edc63b8

293edc63b8 Merge pull request ARMmbed#100 from ARMmbed/update_from_mbedos
b5c79340aa Flag chrono functions to support Mbed OS 5.15
f623784a51 Revert "Revert "(via Mbed-OS)Use std::chrono based functions (ARMmbed#98)" (ARMmbed#99)"
273491840a Revert "(via Mbed-OS)Use std::chrono based functions (ARMmbed#98)" (ARMmbed#99)
4c1cf6e8ca (via Mbed-OS)Use std::chrono based functions (ARMmbed#98)
6c1e445c43 Merge pull request ARMmbed#97 from ARMmbed/IOTTHD-4181
3e5fd70b38 Atmel RF: Data whitening configurable
16d636242a Merge pull request ARMmbed#96 from ARMmbed/IOTTHD-3433
18aed62f22 Atmel RF: Check if given TX power is invalid and return -1
86492ad9f8 Atmel RF: Implemented TX power setting
fd1cd361f5 Allow PIN configuration using Mbed OS config (ARMmbed#95)

git-subtree-dir: connectivity/drivers/802.15.4_RF/atmel-rf-driver
git-subtree-split: 293edc63b87c4700579b14f2034ab152c0fb4f4c
artokin pushed a commit to artokin/mbed-os that referenced this pull request Jun 22, 2021
…d80f42d..c343e4e2cc

c343e4e2cc Merge pull request ARMmbed#99 from PelionIoT/remove_ns_trace
70c411b0f8 Remove ns_trace.h
60e99d2c02 Update copyright (ARMmbed#100)

git-subtree-dir: features/frameworks/nanostack-libservice
git-subtree-split: c343e4e2ccb1517881ac85140974f3eb8cd85d46
artokin pushed a commit to artokin/mbed-os that referenced this pull request Jun 23, 2021
…260d80f42d..c343e4e2cc

c343e4e2cc Merge pull request ARMmbed#99 from PelionIoT/remove_ns_trace
70c411b0f8 Remove ns_trace.h
60e99d2c02 Update copyright (ARMmbed#100)

git-subtree-dir: connectivity/libraries/nanostack-libservice
git-subtree-split: c343e4e2ccb1517881ac85140974f3eb8cd85d46
artokin pushed a commit to artokin/mbed-os that referenced this pull request Jun 28, 2021
…d80f42d..c343e4e2cc

c343e4e2cc Merge pull request ARMmbed#99 from PelionIoT/remove_ns_trace
70c411b0f8 Remove ns_trace.h
60e99d2c02 Update copyright (ARMmbed#100)

git-subtree-dir: features/frameworks/nanostack-libservice
git-subtree-split: c343e4e2ccb1517881ac85140974f3eb8cd85d46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants