diff --git a/sbs.conf b/sbs.conf index 13f75518d260dd3f8dc06e3ba195d7f508080cce..c82700d1fb766c43188022943d66d85bd8f185b3 100644 --- a/sbs.conf +++ b/sbs.conf @@ -97,6 +97,11 @@ Type: srcfiles Files: src/shared/boards/AnakinBoard.cpp src/shared/drivers/Leds.cpp +[dsgamma-serial] +Type: srcfiles +Files: src/shared/drivers/dsgamma-serial/dsgamma-serial.cpp + + # Boards [discovery-canbus-test] Type: board @@ -193,3 +198,11 @@ BinName: test-piksi Include: %piksi Defines: Main: test-piksi + +[test-dsgamma-serial] +Type: board +BoardId: stm32f407vg_stm32f4discovery +BinName: test-dsgamma +Include: %dsgamma-serial +Defines: +Main: test-dsgamma-serial \ No newline at end of file diff --git a/src/entrypoints/test-dsgamma-serial.cpp b/src/entrypoints/test-dsgamma-serial.cpp new file mode 100644 index 0000000000000000000000000000000000000000..05585f766512d1a7257c220fa69e2d62cd2d8c69 --- /dev/null +++ b/src/entrypoints/test-dsgamma-serial.cpp @@ -0,0 +1,57 @@ + +#include <cstdio> +#include "miosix.h" +//#include <pthread.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> + + +using namespace std; +using namespace miosix; + +typedef Gpio<GPIOD_BASE,12> greenLed; +typedef Gpio<GPIOD_BASE,14> redLed; + +void thread1(void *arg); + +int main(){ + + { + FastInterruptDisableLock dLock; + greenLed::mode(Mode::OUTPUT); + redLed::mode(Mode::OUTPUT); + } + + int fd = open("/dev/auxtty",O_RDWR); + if(fd<0) printf("Error opening serial test port\n"); + + Thread *t; + t=Thread::create(thread1,STACK_MIN); + if(t==NULL) printf("Error: thread not created\n"); + + for(;;){ + greenLed::high(); + Thread::sleep(200); + greenLed::low(); + Thread::sleep(2000); + printf("Hey!\n"); + + write(fd,"24",2); + } +} + +void thread1(void *arg){ + int i = 0; + for(;;){ + redLed::high(); + Thread::sleep(50); + redLed::low(); + Thread::sleep(50); + i++; + if(i==4){ + Thread::sleep(2000); + i = 0; + } + } +} \ No newline at end of file diff --git a/src/shared/drivers/dsgamma-serial/dsgamma-serial.cpp b/src/shared/drivers/dsgamma-serial/dsgamma-serial.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/shared/drivers/dsgamma-serial/dsgamma-serial.h b/src/shared/drivers/dsgamma-serial/dsgamma-serial.h new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391