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: BSP_B-L475E-IOT01
Revision 2:52e9bb32964b, committed 2018-12-06
- Comitter:
- vicara
- Date:
- Thu Dec 06 16:36:32 2018 +0000
- Parent:
- 1:164c6bd28b13
- Commit message:
- fixed
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 164c6bd28b13 -r 52e9bb32964b main.cpp
--- a/main.cpp Thu Dec 06 16:18:47 2018 +0000
+++ b/main.cpp Thu Dec 06 16:36:32 2018 +0000
@@ -57,26 +57,26 @@
led3 = led3_status;
}
-bool is_board_horizontal() {
+bool is_board_horizontal(int16_t pDataXYZ[3]) {
return (pDataXYZ[2] < 1030 && pDataXYZ[2] > 950) || (pDataXYZ[2] < -950 && pDataXYZ[2] > -1030);
}
-bool is_board_vertical_short() {
+bool is_board_vertical_short(int16_t pDataXYZ[3]) {
return (pDataXYZ[0] < -950 && pDataXYZ[0] > -1030) || (pDataXYZ[0] < 1030 && pDataXYZ[0] > 950);
}
-bool is_board_vertical_long() {
+bool is_board_vertical_long(int16_t pDataXYZ[3]) {
return (pDataXYZ[1] < 1030 && pDataXYZ[1] > 950) || (pDataXYZ[1] < -950 && pDataXYZ[1] > -1030);
}
void write_positions_on_file() {
int16_t pDataXYZ[3] = {0};
BSP_ACCELERO_AccGetXYZ(pDataXYZ);
- if (is_board_vertical_short()) {
+ if (is_board_vertical_short(pDataXYZ)) {
fprintf(f, "%d\n", 0);
- } else if (is_board_vertical_long()) {
+ } else if (is_board_vertical_long(pDataXYZ)) {
fprintf(f, "%d\n", 1);
- } else if (is_board_horizontal()) {
+ } else if (is_board_horizontal(pDataXYZ)) {
fprintf(f, "%d\n", 2);
} else {
fprintf(f, "%d\n", -1);
@@ -115,7 +115,7 @@
toggle_led(0,0,1);
}
- printf("Press the restart button to sample again.");
+ printf("Press the restart button to sample again.\n");
fflush(stdout);
int err = fclose(f);
printf("%s\n", (err < 0 ? "Fail :(" : "OK"));