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 2:95204570426c, committed 2016-09-29
- Comitter:
- ryood
- Date:
- Thu Sep 29 07:46:45 2016 +0000
- Parent:
- 1:74e13cd94576
- Child:
- 3:2b2c6c0e9f1d
- Commit message:
- some update
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Sep 29 07:41:01 2016 +0000 +++ b/main.cpp Thu Sep 29 07:46:45 2016 +0000 @@ -10,28 +10,13 @@ DigitalOut SpiMCs(PB_6); InterruptIn stepChangeInterrupt(PC_7); -//DigitalOut myled(PA_10); volatile bool isStepChanged = false; uint8_t prevSendVal = 0x00; -//float delay = 1.0f; - void setChangeStep() { isStepChanged = true; - /* - static uint8_t f = 0x0f; - - Leds.write(f); - f = ~f & 0x0f; - */ - /* - if (delay == 1.0) - delay = 0.2; // 200 ms - else - delay = 1.0; // 1 sec - */ } int main() @@ -65,19 +50,18 @@ for (;;) { uint8_t sendVal = ~Switches.read(); - static uint8_t receivedVal; - //if (prevSendVal != sendVal) { + if (prevSendVal != sendVal || isStepChanged) { SpiMCs = 0; - receivedVal = SpiM.write(sendVal); + uint8_t receivedVal = SpiM.write(sendVal); SpiMCs = 1; prevSendVal = sendVal; - //} - - if (isStepChanged) { - Leds.write(receivedVal & 0x0f); - isStepChanged = false; + + if (isStepChanged) { + Leds.write(receivedVal & 0x0f); + isStepChanged = false; + } } } }