Skip to content

Commit 4a66961

Browse files
committed
Merge branch 'master' into USBDevice-STM32F4
2 parents f56a134 + 6959ef7 commit 4a66961

File tree

593 files changed

+75505
-22210
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

593 files changed

+75505
-22210
lines changed

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
*.py[cod]
22

3+
# Distribution dir
4+
dist
5+
6+
# MANIFEST file
7+
MANIFEST
8+
39
# Private settings
410
private_settings.py
511

@@ -53,4 +59,4 @@ uVision Project/
5359
debug.log
5460

5561
# Ignore OS X Desktop Services Store files
56-
.DS_Store
62+
.DS_Store

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
install: "sudo $TRAVIS_BUILD_DIR/travis/install_dependencies.sh > /dev/null"
3+
python:
4+
- "2.7"
5+
script: "python workspace_tools/build_travis.py"

MANIFEST

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# file GENERATED by distutils, do NOT edit
2+
LICENSE
3+
setup.py
4+
workspace_tools/__init__.py
5+
workspace_tools/__init__.pyc
6+
workspace_tools/autotest.py
7+
workspace_tools/build.py
8+
workspace_tools/build_api.py
9+
workspace_tools/build_release.py
10+
workspace_tools/client.py
11+
workspace_tools/export_test.py
12+
workspace_tools/hooks.py
13+
workspace_tools/libraries.py
14+
workspace_tools/make.py
15+
workspace_tools/options.py
16+
workspace_tools/patch.py
17+
workspace_tools/paths.py
18+
workspace_tools/project.py
19+
workspace_tools/server.py
20+
workspace_tools/settings.py
21+
workspace_tools/size.py
22+
workspace_tools/syms.py
23+
workspace_tools/synch.py
24+
workspace_tools/targets.py
25+
workspace_tools/tests.py
26+
workspace_tools/utils.py
27+
workspace_tools/data/__init__.py
28+
workspace_tools/data/example_test_spec.json
29+
workspace_tools/data/support.py
30+
workspace_tools/data/rpc/RPCClasses.h
31+
workspace_tools/data/rpc/class.cpp
32+
workspace_tools/dev/__init__.py
33+
workspace_tools/dev/dsp_fir.py
34+
workspace_tools/dev/rpc_classes.py
35+
workspace_tools/export/__init__.py
36+
workspace_tools/export/codered.py
37+
workspace_tools/export/codered_lpc1768_cproject.tmpl
38+
workspace_tools/export/codered_lpc1768_project.tmpl
39+
workspace_tools/export/codered_lpc4088_cproject.tmpl
40+
workspace_tools/export/codered_lpc4088_project.tmpl
41+
workspace_tools/export/codesourcery.py
42+
workspace_tools/export/codesourcery_lpc1768.tmpl
43+
workspace_tools/export/ds5_5.py
44+
workspace_tools/export/ds5_5_lpc11u24.cproject.tmpl
45+
workspace_tools/export/ds5_5_lpc11u24.launch.tmpl
46+
workspace_tools/export/ds5_5_lpc11u24.project.tmpl
47+
workspace_tools/export/ds5_5_lpc1768.cproject.tmpl
48+
workspace_tools/export/ds5_5_lpc1768.launch.tmpl
49+
workspace_tools/export/ds5_5_lpc1768.project.tmpl
50+
workspace_tools/export/exporters.py
51+
workspace_tools/export/gcc_arm_lpc1768.tmpl
52+
workspace_tools/export/gccarm.py
53+
workspace_tools/export/iar.ewp.tmpl
54+
workspace_tools/export/iar.eww.tmpl
55+
workspace_tools/export/iar.py
56+
workspace_tools/export/uvision4.py
57+
workspace_tools/export/uvision4_kl25z.uvopt.tmpl
58+
workspace_tools/export/uvision4_kl25z.uvproj.tmpl
59+
workspace_tools/export/uvision4_lpc1114.uvopt.tmpl
60+
workspace_tools/export/uvision4_lpc1114.uvproj.tmpl
61+
workspace_tools/export/uvision4_lpc11c24.uvopt.tmpl
62+
workspace_tools/export/uvision4_lpc11c24.uvproj.tmpl
63+
workspace_tools/export/uvision4_lpc11u24.uvopt.tmpl
64+
workspace_tools/export/uvision4_lpc11u24.uvproj.tmpl
65+
workspace_tools/export/uvision4_lpc1347.uvopt.tmpl
66+
workspace_tools/export/uvision4_lpc1347.uvproj.tmpl
67+
workspace_tools/export/uvision4_lpc1768.uvopt.tmpl
68+
workspace_tools/export/uvision4_lpc1768.uvproj.tmpl
69+
workspace_tools/export/uvision4_lpc4088.uvopt.tmpl
70+
workspace_tools/export/uvision4_lpc4088.uvproj.tmpl
71+
workspace_tools/export/uvision4_lpc812.uvopt.tmpl
72+
workspace_tools/export/uvision4_lpc812.uvproj.tmpl
73+
workspace_tools/host_tests/__init__.py
74+
workspace_tools/host_tests/echo.py
75+
workspace_tools/host_tests/host_test.py
76+
workspace_tools/host_tests/mbedrpc.py
77+
workspace_tools/host_tests/net_test.py
78+
workspace_tools/host_tests/rpc.py
79+
workspace_tools/host_tests/tcpecho_client.py
80+
workspace_tools/host_tests/tcpecho_server.py
81+
workspace_tools/host_tests/tcpecho_server_loop.py
82+
workspace_tools/host_tests/udpecho_client.py
83+
workspace_tools/host_tests/udpecho_server.py
84+
workspace_tools/host_tests/example/BroadcastReceive.py
85+
workspace_tools/host_tests/example/BroadcastSend.py
86+
workspace_tools/host_tests/example/MulticastReceive.py
87+
workspace_tools/host_tests/example/MulticastSend.py
88+
workspace_tools/host_tests/example/TCPEchoClient.py
89+
workspace_tools/host_tests/example/TCPEchoServer.py
90+
workspace_tools/host_tests/example/UDPEchoClient.py
91+
workspace_tools/host_tests/example/UDPEchoServer.py
92+
workspace_tools/host_tests/example/__init__.py
93+
workspace_tools/toolchains/__init__.py
94+
workspace_tools/toolchains/arm.py
95+
workspace_tools/toolchains/gcc.py
96+
workspace_tools/toolchains/iar.py

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
graft workspace_tools
2+
include __init__.py LICENSE

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
mbed SDK
22
========
33

4+
[![Build Status](https://travis-ci.org/mbedmicro/mbed.png)](https://travis-ci.org/mbedmicro/mbed/builds)
5+
46
The mbed Software Development Kit (SDK) is a C/C++ microcontroller software platform relied upon by tens of thousands of
57
developers to build projects fast.
68

libraries/USBDevice/USBSerial/USBCDC.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ bool USBCDC::USBCallback_request(void) {
5252
break;
5353
case CDC_SET_LINE_CODING:
5454
transfer->remaining = 7;
55+
transfer->notify = true;
5556
success = true;
5657
terminal_connected = true;
5758
break;
@@ -67,6 +68,31 @@ bool USBCDC::USBCallback_request(void) {
6768
return success;
6869
}
6970

71+
void USBCDC::USBCallback_requestCompleted(uint8_t *buf, uint32_t length) {
72+
// Request of setting line coding has 7 bytes
73+
if (length != 7) {
74+
return;
75+
}
76+
77+
CONTROL_TRANSFER * transfer = getTransferPtr();
78+
79+
/* Process class-specific requests */
80+
if (transfer->setup.bmRequestType.Type == CLASS_TYPE) {
81+
if (transfer->setup.bRequest == CDC_SET_LINE_CODING) {
82+
if (memcmp(cdc_line_coding, buf, 7)) {
83+
memcpy(cdc_line_coding, buf, 7);
84+
85+
int baud = buf[0] + (buf[1] << 8)
86+
+ (buf[2] << 16) + (buf[3] << 24);
87+
int stop = buf[4];
88+
int bits = buf[6];
89+
int parity = buf[5];
90+
91+
lineCodingChanged(baud, bits, parity, stop);
92+
}
93+
}
94+
}
95+
}
7096

7197
// Called in ISR context
7298
// Set configuration. Return false if the

libraries/USBDevice/USBSerial/USBCDC.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,21 @@ class USBCDC: public USBDevice {
9999
* @returns true if successful
100100
*/
101101
bool readEP_NB(uint8_t * buffer, uint32_t * size);
102+
103+
/*
104+
* Called by USBCallback_requestCompleted when CDC line coding is changed
105+
* Warning: Called in ISR
106+
*
107+
* @param baud The baud rate
108+
* @param bits The number of bits in a word (5-8)
109+
* @param parity The parity
110+
* @param stop The number of stop bits (1 or 2)
111+
*/
112+
virtual void lineCodingChanged(int baud, int bits, int parity, int stop) {};
102113

103114
protected:
104115
virtual bool USBCallback_request();
116+
virtual void USBCallback_requestCompleted(uint8_t *buf, uint32_t length);
105117
virtual bool USBCallback_setConfiguration(uint8_t configuration);
106118
volatile bool terminal_connected;
107119

libraries/USBDevice/USBSerial/USBSerial.h

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ class USBSerial: public USBCDC, public Stream {
5555
* @param product_release Your preoduct_release (default: 0x0001)
5656
*
5757
*/
58-
USBSerial(uint16_t vendor_id = 0x1f00, uint16_t product_id = 0x2012, uint16_t product_release = 0x0001): USBCDC(vendor_id, product_id, product_release), buf(128){ };
58+
USBSerial(uint16_t vendor_id = 0x1f00, uint16_t product_id = 0x2012, uint16_t product_release = 0x0001): USBCDC(vendor_id, product_id, product_release), buf(128){
59+
settingsChangedCallback = 0;
60+
};
5961

6062

6163
/**
@@ -79,6 +81,22 @@ class USBSerial: public USBCDC, public Stream {
7981
* @returns the number of bytes available
8082
*/
8183
uint8_t available();
84+
85+
/** Determine if there is a character available to read
86+
*
87+
* @returns
88+
* 1 if there is a character available to read,
89+
* 0 otherwise
90+
*/
91+
int readable() { return available() ? 1 : 0; }
92+
93+
/** Determine if there is space available to write a character
94+
*
95+
* @returns
96+
* 1 if there is space to write a character,
97+
* 0 otherwise
98+
*/
99+
int writeable() { return 1; } // always return 1, for write operation is blocking
82100

83101
/**
84102
* Write a block of data.
@@ -110,19 +128,33 @@ class USBSerial: public USBCDC, public Stream {
110128
*
111129
* @param fptr function pointer
112130
*/
113-
void attach(void (*fn)(void)) {
114-
if(fn != NULL) {
115-
rx.attach(fn);
131+
void attach(void (*fptr)(void)) {
132+
if(fptr != NULL) {
133+
rx.attach(fptr);
116134
}
117135
}
118136

137+
/**
138+
* Attach a callback to call when serial's settings are changed.
139+
*
140+
* @param fptr function pointer
141+
*/
142+
void attach(void (*fptr)(int baud, int bits, int parity, int stop)) {
143+
settingsChangedCallback = fptr;
144+
}
119145

120146
protected:
121147
virtual bool EP2_OUT_callback();
148+
virtual void lineCodingChanged(int baud, int bits, int parity, int stop){
149+
if (settingsChangedCallback) {
150+
settingsChangedCallback(baud, bits, parity, stop);
151+
}
152+
}
122153

123154
private:
124155
FunctionPointer rx;
125156
CircBuffer<uint8_t> buf;
157+
void (*settingsChangedCallback)(int baud, int bits, int parity, int stop);
126158
};
127159

128160
#endif

libraries/USBHost/USBHost3GModule/IUSBHostSerial.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030

3131
#include "IUSBHostSerialListener.h"
3232

33+
// This is needed by some versions of GCC
34+
#undef putc
35+
#undef getc
36+
3337
class IUSBHostSerial {
3438
public:
3539

0 commit comments

Comments
 (0)