Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
fwatch
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
8
Issues
8
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
fwatch
Commits
bc1c219d
Commit
bc1c219d
authored
May 23, 2015
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
freewatch: stop application using library function
Signed-off-by:
Federico Vaga
<
federico.vaga@gmail.com
>
parent
b380ebb7
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
50 additions
and
25 deletions
+50
-25
clock.c
sw/freewatch/src/apps/clock.c
+4
-4
compass.c
sw/freewatch/src/apps/compass.c
+5
-2
game.c
sw/freewatch/src/apps/game.c
+5
-2
gpscoord.c
sw/freewatch/src/apps/gpscoord.c
+5
-3
menu.c
sw/freewatch/src/apps/menu.c
+2
-1
reset.c
sw/freewatch/src/apps/reset.c
+6
-2
set_date.c
sw/freewatch/src/apps/settings/set_date.c
+5
-3
set_gmt_ofs.c
sw/freewatch/src/apps/settings/set_gmt_ofs.c
+5
-3
set_time.c
sw/freewatch/src/apps/settings/set_time.c
+5
-3
set_time_fr_gps.c
sw/freewatch/src/apps/settings/set_time_fr_gps.c
+3
-0
usb_mass_storage.c
sw/freewatch/src/apps/usb_mass_storage.c
+5
-2
No files found.
sw/freewatch/src/apps/clock.c
View file @
bc1c219d
...
...
@@ -24,9 +24,8 @@
/**
* Clock application.
*/
#include <libfwatch.h>
#include "clock.h"
#include "application.h"
#include "widgets/status_bar.h"
#include <drivers/rtc.h>
...
...
@@ -36,6 +35,7 @@
static
struct
rtc_time
rtc
;
static
struct
tm
cur_time
;
application
clock_app
;
static
void
digital_watch_redraw
(
struct
ui_widget
*
w
)
{
char
buf
[
32
];
...
...
@@ -105,7 +105,7 @@ void clock_main(void* params) {
ui_update
(
NULL
);
// Event loop
while
(
1
)
{
while
(
fwatch_is_application_running
(
&
clock_app
)
)
{
ret
=
xQueueReceive
(
appQueue
,
&
evt
,
portMAX_DELAY
);
if
(
ret
==
pdFALSE
)
continue
;
...
...
@@ -115,7 +115,7 @@ void clock_main(void* params) {
case
BUTTON_PRESSED
:
if
(
evt
.
data
.
button
==
BUT_TR
||
evt
.
data
.
button
==
BUT_TL
)
return
;
/* Quit Application */
fwatch_application_stop
(
&
clock_app
);
// no break; fall through
default:
// suppress warnings
...
...
sw/freewatch/src/apps/compass.c
View file @
bc1c219d
...
...
@@ -24,6 +24,7 @@
* Compass application.
*/
#include <libfwatch.h>
#include "application.h"
#include <drivers/lsm303c.h>
#include <gfx/ui.h>
...
...
@@ -39,6 +40,8 @@
#define COMP_X0 64
#define COMP_Y0 64
application
compass
;
static
int
x_lcd
,
y_lcd
;
static
float
sina
,
cosa
;
static
int
calib
=
0
;
...
...
@@ -139,14 +142,14 @@ void compass_main(void *params)
ui_update
(
NULL
);
/*main loop*/
while
(
1
)
{
while
(
fwatch_is_application_running
(
&
compass
)
)
{
ret
=
xQueueReceive
(
appQueue
,
&
evt
,
50
/
portTICK_RATE_MS
);
if
(
ret
==
pdTRUE
)
{
switch
(
evt
.
type
)
{
case
BUTTON_PRESSED
:
if
(
evt
.
data
.
button
==
BUT_TR
||
evt
.
data
.
button
==
BUT_TL
)
return
;
/* Quit application */
fwatch_application_stop
(
&
compass
);
/*if(evt.data.button == BUT_BR) {
c_min.x = 0x7fff;
...
...
sw/freewatch/src/apps/game.c
View file @
bc1c219d
...
...
@@ -24,6 +24,7 @@
* Very simple "game"
*/
#include <libfwatch.h>
#include "application.h"
#include "widgets/status_bar.h"
#include <drivers/lsm303c.h>
...
...
@@ -44,6 +45,8 @@
#define MODE_NORM 0
#define MODE_HIGH 1
application
game
;
int
win_x0
,
win_y0
,
win_x1
,
win_y1
;
int
score
,
highscore
;
int
mode
;
...
...
@@ -126,7 +129,7 @@ void game_main(void *params)
ui_update
(
NULL
);
/*main loop*/
while
(
1
)
{
while
(
fwatch_is_application_running
(
&
game
)
)
{
ret
=
xQueueReceive
(
appQueue
,
&
evt
,
portMAX_DELAY
);
if
(
ret
==
pdTRUE
)
{
switch
(
evt
.
type
)
{
...
...
@@ -135,7 +138,7 @@ void game_main(void *params)
evt
.
data
.
button
==
BUT_TL
)
{
vibra_disable
();
buzzer_disable
();
return
;
/* Quit application */
fwatch_application_stop
(
&
game
);
}
if
(
evt
.
data
.
button
==
BUT_BR
)
mode
=
MODE_HIGH
;
...
...
sw/freewatch/src/apps/gpscoord.c
View file @
bc1c219d
...
...
@@ -33,11 +33,13 @@
#include <bitmaps.h>
#include <drivers/gps.h>
#include <libfwatch.h>
#include "application.h"
#include "settings/settings.h"
application
gpscoord
;
static
struct
gps_coord
coord
;
static
int
coord_format
;
static
int
gpsscreen
=
0
;
...
...
@@ -155,7 +157,7 @@ void gpscoord_main(void *params)
ui_update
(
NULL
);
while
(
1
)
{
while
(
fwatch_is_application_running
(
&
gpscoord
)
)
{
ret
=
xQueueReceive
(
appQueue
,
&
evt
,
portMAX_DELAY
);
if
(
ret
!=
pdTRUE
)
continue
;
...
...
@@ -164,7 +166,7 @@ void gpscoord_main(void *params)
case
BUTTON_PRESSED
:
if
(
evt
.
data
.
button
==
BUT_TR
||
evt
.
data
.
button
==
BUT_TL
)
return
;
/* Quit application */
fwatch_application_stop
(
&
gpscoord
);
// else if (evt.data.button == BUT_BR) {
// /*
// * Toggle between coordinate and
...
...
sw/freewatch/src/apps/menu.c
View file @
bc1c219d
...
...
@@ -24,7 +24,7 @@
/**
* Menu application.
*/
#include <libfwatch.h>
#include "app_list.h"
#include "menu_struct.h"
#include "widgets/status_bar.h"
...
...
@@ -149,6 +149,7 @@ static void menu_ui_init() {
static
void
run
(
menu_entry
*
entry
)
{
if
(
entry
->
type
==
APP
)
{
entry
->
data
.
app
->
flags
|=
APP_FLAGS_RUN
;
entry
->
data
.
app
->
main
(
NULL
);
if
(
entry
->
data
.
app
->
quit
)
entry
->
data
.
app
->
quit
(
entry
->
data
.
app
);
...
...
sw/freewatch/src/apps/reset.c
View file @
bc1c219d
...
...
@@ -28,11 +28,15 @@
#include <drivers/gps.h>
#include <gfx/graphics.h>
#include <gfx/ui.h>
#include <libfwatch.h>
#include "widgets/status_bar.h"
#include "settings/settings.h"
#include "application.h"
application
reset
;
static
void
reset_redraw
(
struct
ui_widget
*
w
)
{
gfx_text
(
&
w
->
dc
,
&
font_helv22b
,
10
,
50
,
"Bottom right"
,
0
);
...
...
@@ -62,7 +66,7 @@ void reset_main(void *params)
ui_add_widget
(
&
status_bar
);
ui_update
(
NULL
);
while
(
1
)
{
while
(
fwatch_is_application_running
(
&
reset
)
)
{
ret
=
xQueueReceive
(
appQueue
,
&
evt
,
portMAX_DELAY
);
if
(
ret
!=
pdTRUE
)
continue
;
...
...
@@ -71,7 +75,7 @@ void reset_main(void *params)
case
BUTTON_PRESSED
:
if
(
evt
.
data
.
button
==
BUT_TR
||
evt
.
data
.
button
==
BUT_TL
)
return
;
/* Quit application */
fwatch_application_stop
(
&
reset
);
/* Reset on bottom right and bottom left buttons
* pressed */
if
(
evt
.
data
.
button
==
BUT_BR
)
...
...
sw/freewatch/src/apps/settings/set_date.c
View file @
bc1c219d
...
...
@@ -23,13 +23,15 @@
/**
* Settings application.
*/
#include <libfwatch.h>
#include "application.h"
#include "widgets/status_bar.h"
#include "widgets/spinbox.h"
#include "clock.h"
#include <time.h>
application
set_date
;
static
const
int
DIST_X
=
20
;
static
const
int
POS_X
=
1
;
static
const
int
POS_Y
=
30
;
...
...
@@ -178,7 +180,7 @@ void set_date_main(void* params) {
ui_update
(
NULL
);
// event loop
while
(
1
)
{
while
(
fwatch_is_application_running
(
&
set_date
)
)
{
ret
=
xQueueReceive
(
appQueue
,
&
evt
,
portMAX_DELAY
);
if
(
ret
!=
pdTRUE
)
continue
;
...
...
@@ -186,7 +188,7 @@ void set_date_main(void* params) {
switch
(
evt
.
type
)
{
case
BUTTON_PRESSED
:
if
(
evt
.
data
.
button
==
BUT_TL
)
{
return
;
// go back to the main menu
fwatch_application_stop
(
&
set_date
);
}
else
if
(
evt
.
data
.
button
==
BUT_TR
)
{
if
(
sb_index
<
SPINBOX_NUMBER
-
1
)
{
spinbox_set_active
(
&
sb_date
[
sb_index
],
false
);
...
...
sw/freewatch/src/apps/settings/set_gmt_ofs.c
View file @
bc1c219d
...
...
@@ -24,12 +24,14 @@
/**
* Settings application.
*/
#include <libfwatch.h>
#include "application.h"
#include "widgets/status_bar.h"
#include "widgets/spinbox.h"
#include "settings/settings.h"
application
set_gmt_ofs
;
static
const
int
DIST_X
=
24
;
static
const
int
POS_X
=
10
;
static
const
int
POS_Y
=
30
;
...
...
@@ -164,7 +166,7 @@ void set_gmt_ofs_main(void* params) {
ui_update
(
NULL
);
// event loop
while
(
1
)
{
while
(
fwatch_is_application_running
(
&
set_gmt_ofs
)
)
{
ret
=
xQueueReceive
(
appQueue
,
&
evt
,
portMAX_DELAY
);
if
(
ret
!=
pdTRUE
)
continue
;
...
...
@@ -172,7 +174,7 @@ void set_gmt_ofs_main(void* params) {
switch
(
evt
.
type
)
{
case
BUTTON_PRESSED
:
if
(
evt
.
data
.
button
==
BUT_TL
)
{
return
;
// go back to the main menu
fwatch_application_stop
(
&
set_gmt_ofs
);
}
else
if
(
evt
.
data
.
button
==
BUT_TR
)
{
if
(
sb_index
<
SPINBOX_NUMBER
-
1
)
{
spinbox_set_active
(
&
sb_time
[
sb_index
],
false
);
...
...
sw/freewatch/src/apps/settings/set_time.c
View file @
bc1c219d
...
...
@@ -23,13 +23,15 @@
/**
* Settings application.
*/
#include <libfwatch.h>
#include "application.h"
#include "widgets/status_bar.h"
#include "widgets/spinbox.h"
#include "clock.h"
#include <time.h>
application
set_time
;
static
const
int
DIST_X
=
24
;
static
const
int
POS_X
=
20
;
static
const
int
POS_Y
=
30
;
...
...
@@ -141,7 +143,7 @@ void set_time_main(void* params) {
ui_update
(
NULL
);
// event loop
while
(
1
)
{
while
(
fwatch_is_application_running
(
&
set_time
)
)
{
ret
=
xQueueReceive
(
appQueue
,
&
evt
,
portMAX_DELAY
);
if
(
ret
!=
pdTRUE
)
continue
;
...
...
@@ -149,7 +151,7 @@ void set_time_main(void* params) {
switch
(
evt
.
type
)
{
case
BUTTON_PRESSED
:
if
(
evt
.
data
.
button
==
BUT_TL
)
{
return
;
// go back to the main menu
fwatch_application_stop
(
&
set_time
);
}
else
if
(
evt
.
data
.
button
==
BUT_TR
)
{
if
(
sb_index
<
SPINBOX_NUMBER
-
1
)
{
spinbox_set_active
(
&
sb_time
[
sb_index
],
false
);
...
...
sw/freewatch/src/apps/settings/set_time_fr_gps.c
View file @
bc1c219d
...
...
@@ -20,6 +20,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <libfwatch.h>
#include "application.h"
#include <time.h>
...
...
@@ -49,6 +50,8 @@ void set_time_fr_gps_main(void *params)
clock_set_time
(
&
time
);
}
fwatch_application_stop
(
&
set_time_fr_gps
);
}
application
set_time_fr_gps
=
{
...
...
sw/freewatch/src/apps/usb_mass_storage.c
View file @
bc1c219d
...
...
@@ -25,6 +25,7 @@
* USB mass storage mode.
*/
#include <libfwatch.h>
#include "application.h"
#include "widgets/status_bar.h"
...
...
@@ -34,6 +35,8 @@
#include <semphr.h>
application
usb_ms
;
static
bool
init_ok
;
static
int
mutexours
=
0
;
...
...
@@ -90,7 +93,7 @@ void usb_ms_main(void* params) {
ui_update
(
NULL
);
while
(
1
)
{
while
(
fwatch_is_application_running
(
&
usb_ms
)
)
{
ret
=
xQueueReceive
(
appQueue
,
&
evt
,
0
);
if
(
ret
!=
pdTRUE
)
{
MSDD_Handler
();
...
...
@@ -106,7 +109,7 @@ void usb_ms_main(void* params) {
USBD_Stop
();
xSemaphoreGive
(
mutexSdCardAccess
);
}
return
;
/* Quit application */
fwatch_application_stop
(
&
usb_ms
);
}
break
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment