Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of ds3_si by
Revision 5:5472bead8509, committed 2018-03-02
- Comitter:
- kikoaac
- Date:
- Fri Mar 02 02:55:16 2018 +0000
- Parent:
- 4:5bb182ca2b07
- Commit message:
- ??
Changed in this revision
ds3_si.cpp | Show annotated file Show diff for this revision Revisions of this file |
ds3_si.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/ds3_si.cpp Wed Oct 25 09:42:56 2017 +0000 +++ b/ds3_si.cpp Fri Mar 02 02:55:16 2018 +0000 @@ -17,7 +17,11 @@ } void ds3_si::serialin() -{ +{__disable_irq(); + NVIC_ClearPendingIRQ(UART0_IRQn); + NVIC_ClearPendingIRQ(UART1_IRQn); + NVIC_ClearPendingIRQ(UART2_IRQn); + NVIC_ClearPendingIRQ(UART3_IRQn); if(serial.readable()) { while(serial.getc() != 128) {} @@ -26,6 +30,7 @@ *(in + i) = serial.getc(); } } +__enable_irq(); } bool ds3_si::buttonstate(short order)
--- a/ds3_si.h Wed Oct 25 09:42:56 2017 +0000 +++ b/ds3_si.h Fri Mar 02 02:55:16 2018 +0000 @@ -14,8 +14,10 @@ #define ds3_si_H #include "mbed.h" +#include <iostream> +#include <queue> -#define PI 3.141592654 +#define PI 3.141 #define square 1 #define L1 2 #define L2 4 @@ -35,13 +37,12 @@ #define R3x 5 #define R3y 6 #define NONE_angle 10 - class ds3_si { private: Serial serial; char in[8]; - + public: ds3_si(PinName tx, PinName rx, int baudrate = 2400); void serialin();