summaryrefslogtreecommitdiff
path: root/example.c
diff options
context:
space:
mode:
authorNick Van Doorn <vandoorn.nick@gmail.com>2018-03-06 21:27:10 -0800
committerNick Van Doorn <vandoorn.nick@gmail.com>2018-03-06 21:51:31 -0800
commit195bf959d81b157456a66353da1946a7b51cbe33 (patch)
tree44d7f04ab9f0a0408fcdedb32f98a82d6f784a82 /example.c
parent7da4705734e6aacbdbed9e4aea9fe8a13ccbb60d (diff)
Use chromium clang format
Diffstat (limited to 'example.c')
-rw-r--r--example.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/example.c b/example.c
index 3436dab..c967e3a 100644
--- a/example.c
+++ b/example.c
@@ -1,10 +1,10 @@
-#include "legato.h"
-#include "interfaces.h"
#include "camera.h"
+#include "interfaces.h"
+#include "legato.h"
#define RETRY_WAIT_SEC 60
-bool takePhoto (Camera *cam, char *dirPath) {
+bool takePhoto(Camera* cam, char* dirPath) {
cam->fd = fd_openCam();
bool resetSucess = cam_reset(cam);
LE_INFO("Camera reset %s", resetSucess ? "succeeded" : "failed");
@@ -15,22 +15,23 @@ bool takePhoto (Camera *cam, char *dirPath) {
return resetSucess && snapshotSuccess;
}
-void photoLoop (Camera *cam, int intervalMintues, char *dirPath) {
- LE_INFO("Taking photos every %d minutes and storing them in %s", intervalMintues, dirPath);
+void photoLoop(Camera* cam, int intervalMintues, char* dirPath) {
+ LE_INFO("Taking photos every %d minutes and storing them in %s",
+ intervalMintues, dirPath);
while (true) {
bool success = takePhoto(cam, dirPath);
int sleepDur = success ? intervalMintues * 60 : RETRY_WAIT_SEC;
- if (success) LE_INFO("Taking next photo in %d minutes", intervalMintues);
- else LE_INFO("Retrying after %d seconds", RETRY_WAIT_SEC);
+ if (success)
+ LE_INFO("Taking next photo in %d minutes", intervalMintues);
+ else
+ LE_INFO("Retrying after %d seconds", RETRY_WAIT_SEC);
sleep(sleepDur);
}
}
COMPONENT_INIT {
Camera cam = {
- .serialNum = 0x00,
- .bufferLen = 0,
- .frameptr = 0,
+ .serialNum = 0x00, .bufferLen = 0, .frameptr = 0,
};
photoLoop(&cam, 10, "/home/root/sd");
} \ No newline at end of file