Commit Graph

19 Commits

Author SHA1 Message Date
Damien George 09bbe7215a stmhal: Fix USB CDC not flushing packets when an exact multiple of 64.
Need to send a zero-sized packet after sending an exact multiple of 64
bytes (not just after sending 64 bytes exactly).

Addresses issue #494, part 2.
2014-05-10 18:56:16 +01:00
Damien George 04b9147e15 Add license header to (almost) all files.
Blanket wide to all .c and .h files.  Some files originating from ST are
difficult to deal with (license wise) so it was left out of those.

Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
2014-05-03 23:27:38 +01:00
Damien George efc22e376f stmhal: Fix 64-byte USB packet bug properly.
A 64-byte packet is now followed by a 0-byte packet if there is nothing
more to send.  This flushes the USB endpoint.
2014-04-17 00:12:07 +01:00
Damien George 28817725fc stmhal: Replace magic number 3 with CDC_IN_EP define. 2014-04-16 23:17:29 +01:00
Damien George 9388a90842 stmhal: Fix USB CDC buffer overrun error.
Need to wait for the low-level USB driver to send the data over the USB
in-endpoint before the buffer can be used again.  This patch adds a
check for this.
2014-04-16 15:51:27 +01:00
Damien George cce7119a2b stmhal: Work around crazy bug in USB CDC.
Packets of 64 bytes length are not send to the host until the following
packet is sent.  Fixed by never sending packets of 64 bytes length.
2014-04-14 01:46:25 +01:00
Damien George 212f89e61a stmhal: Improve USB CDC write function (increase timeout). 2014-04-13 16:39:04 +01:00
Damien George 038df43183 stmhal: Implement selector for USB device mode; improve boot up.
Can now choose at boot up whether the USB device is CDC+MSC or CDC+HID.
Choice is made by an option in boot.py, with default being CDC+MSC.
HID+MSC is not currently supported, but should be easy to implement.

Boot up now has ability to change the reset mode: hold down USR switch
while booting and LEDs will count from 1 to 7 to indicate the boot mode.
Release USR when correct mode is selected.  Current modes are 1 (normal
boot), 2 (safe mode), 3 (reset FS mode).
2014-03-30 00:00:15 +00:00
Damien George 2f8beb8d88 stmhal: Fix bug with USB CDC transmit buffer wrap around. 2014-03-24 12:23:03 +00:00
Damien George f357a19202 stmhal: Fix issues with USB CDC init and receive.
Late USB enumeration could clear settings after they had been set.
Now fixed by not clearing some settings on init.

RX was blocking if received characters were not being processed, so
CTRL-C would not be picked up.  Now "fixed" by not blocking, but
instead discarding incoming characters if they overflow the buffer.
2014-03-23 18:54:48 +00:00
Damien George 908a670dfc stmhal: Add intensity method for blue LED.
As part of this, rejig the way TIM3 is initialised, since it's now
shared by USB CDC and the blue LED PWM.
2014-03-22 23:54:13 +00:00
Damien George 0119fc7532 stmhal: Servo driver can move at a given speed. 2014-03-22 18:34:16 +00:00
Damien George 2fb37847a7 stmhal: Tidy up USB CDC+MSC device some more. 2014-03-22 13:21:58 +00:00
Damien George a6787edcea stmhal: Tidy up USB device configuration. Make it use less RAM. 2014-03-22 12:46:23 +00:00
Damien George 02a8543841 stmhal: Check CDC tx buffer has free space before filling with data. 2014-03-15 16:54:23 +00:00
Damien George 6c2455f481 stmhal: Put an array in ROM. 2014-03-15 14:46:35 +00:00
Damien George 07174c6fca stmhal: Fix escape sequences in USB CDC input. 2014-03-15 12:53:51 +00:00
Damien George e285511a23 stmhal: Get USB CDC REPL working.
New USB HAL is quite a bit improved over previous one.  Now has better
callbacks and flow control.

REPL over USB CDC now works as before, except for soft-reset (since USB
driver uses malloc...).
2014-03-15 11:52:29 +00:00
Damien George b30c02afa0 stmhal: Get USB enumerating a CDC device.
Enumerates CDC device over USB, but doesn't transmit/receive yet.
2014-03-14 00:30:37 +00:00