Skip to content

Commit

Permalink
Added basic Serial-over-USB functionality
Browse files Browse the repository at this point in the history
- Added "streams" includes to the Makefile in order to be able to use chprintf().
- Added subsystems/serial/chibiesc_usb.h/.c, configuring an USB CDC device and sending "Test\n" in a loop for testing
- Including the new usb files and calling usb_init() in main.c
  • Loading branch information
heiko-r committed Jun 19, 2016
1 parent e24ed38 commit d5ec6a9
Show file tree
Hide file tree
Showing 4 changed files with 402 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ CSRC = $(STARTUPSRC) \
$(PLATFORMSRC) \
$(BOARDSRC) \
$(TESTSRC) \
main.c
$(CHIBIOS)/os/hal/lib/streams/memstreams.c \
$(CHIBIOS)/os/hal/lib/streams/chprintf.c \
main.c \
subsystems/serial/chibiesc_usb.c

# C++ sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
Expand Down Expand Up @@ -145,6 +148,7 @@ ASMSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)

INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
$(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \
$(CHIBIOS)/os/hal/lib/streams \
$(CHIBIOS)/os/various

#
Expand Down
5 changes: 4 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include "ch.h"
#include "hal.h"
#include "test.h"
#include "chprintf.h"
#include "subsystems/serial/chibiesc_usb.h"

/*
* This is a periodic thread that does absolutely nothing except flashing
Expand Down Expand Up @@ -49,7 +51,7 @@ int main(void) {
*/
halInit();
chSysInit();
osalSysEnable(); // just copied here from example to test why LED blinking doesn't work
//osalSysEnable(); // just copied here from example to test why LED blinking doesn't work

/*
* Activates the serial driver 2 using the driver default configuration.
Expand All @@ -64,6 +66,7 @@ int main(void) {
*/
//chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);

usb_init(); // Serial over USB initialization
/*
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
Expand Down
Loading

0 comments on commit d5ec6a9

Please sign in to comment.