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: C12832 MMA7660 mbed
accel.cpp@5:614e3ac042df, 2018-03-14 (annotated)
- Committer:
- ksaito
- Date:
- Wed Mar 14 11:15:31 2018 +0000
- Revision:
- 5:614e3ac042df
- Parent:
- 4:d61f6d186db0
- Child:
- 9:35c816293400
????????
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ksaito | 0:c3bc6981ad28 | 1 | #include "mbed.h" |
| ksaito | 0:c3bc6981ad28 | 2 | #include "MMA7660.h" |
| ksaito | 1:2967eac08981 | 3 | #include "commands.h" |
| ksaito | 0:c3bc6981ad28 | 4 | |
| ksaito | 0:c3bc6981ad28 | 5 | DigitalOut Zaxis_p(LED2); |
| ksaito | 0:c3bc6981ad28 | 6 | DigitalOut Zaxis_n(LED3); |
| ksaito | 0:c3bc6981ad28 | 7 | MMA7660 MMA(p28, p27); |
| ksaito | 0:c3bc6981ad28 | 8 | |
| ksaito | 4:d61f6d186db0 | 9 | static void _Initialize(void) { |
| ksaito | 0:c3bc6981ad28 | 10 | Zaxis_p = 0; |
| ksaito | 0:c3bc6981ad28 | 11 | Zaxis_n = 0; |
| ksaito | 0:c3bc6981ad28 | 12 | } |
| ksaito | 0:c3bc6981ad28 | 13 | |
| ksaito | 5:614e3ac042df | 14 | static void _ProcessInitialize(void) { |
| ksaito | 5:614e3ac042df | 15 | |
| ksaito | 5:614e3ac042df | 16 | } |
| ksaito | 5:614e3ac042df | 17 | |
| ksaito | 5:614e3ac042df | 18 | static bool _ProcessIsContinue(void) { |
| ksaito | 5:614e3ac042df | 19 | return false; |
| ksaito | 5:614e3ac042df | 20 | } |
| ksaito | 5:614e3ac042df | 21 | |
| ksaito | 5:614e3ac042df | 22 | static void _ProcessRunning(void) { |
| ksaito | 0:c3bc6981ad28 | 23 | Zaxis_p = MMA.z(); |
| ksaito | 0:c3bc6981ad28 | 24 | Zaxis_n = -MMA.z(); |
| ksaito | 0:c3bc6981ad28 | 25 | } |
| ksaito | 0:c3bc6981ad28 | 26 | |
| ksaito | 4:d61f6d186db0 | 27 | static void _Finalize(void) { |
| ksaito | 1:2967eac08981 | 28 | _Initialize(); |
| ksaito | 0:c3bc6981ad28 | 29 | } |
| ksaito | 1:2967eac08981 | 30 | |
| ksaito | 5:614e3ac042df | 31 | COMMAND_DEFINE Command_accel = {"accel", 0x02, _Initialize, _Finalize, |
| ksaito | 5:614e3ac042df | 32 | _ProcessInitialize, _ProcessIsContinue, _ProcessRunning |
| ksaito | 5:614e3ac042df | 33 | }; |