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.
Dependencies: mbed-rtos mbed st7565LCD
Revision 6:66955ebd56dd, committed 2016-10-04
- Comitter:
- ryood
- Date:
- Tue Oct 04 05:25:37 2016 +0000
- Parent:
- 5:915a9d45c969
- Child:
- 7:4bb0c1e05e33
- Commit message:
- CS:L CS:H???????????
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Oct 04 04:58:19 2016 +0000 +++ b/main.cpp Tue Oct 04 05:25:37 2016 +0000 @@ -4,6 +4,7 @@ #define SPI_SPEED (4000000) #define SPI_DUMMY_DATA (0x55) +#define LOOP_N (8) BusIn Switches(PA_0, PA_1, PA_4, PB_0, PC_1, PC_0); @@ -62,18 +63,23 @@ uint8_t count = 0; for (;;) { SpiMCs = 0; - uint8_t receivedVal = SpiM.write(count); + int step = -1; + for (int i = 0; i < LOOP_N; i++) { + uint8_t recievedVal = SpiM.write(count); + if (isStepChanged) { + step = recievedVal; + isStepChanged = false; + } + count++; + } SpiMCs = 1; - count++; - if (isStepChanged) { + if (step != -1) { char lineBuffer[20]; - sprintf(lineBuffer, "Step: %02d", receivedVal); + sprintf(lineBuffer, "Step: %02d", step); gLCD.drawstring(0, 0, lineBuffer); gLCD.display(); - isStepChanged = false; - } - //Thread::wait(1); - wait_us(100); + Thread::wait(1); + //wait_us(100); } }