Commit 5f803468 authored by Projects's avatar Projects

Fixed xQueueReceive() ticks-to-wait parameter in tasks.

parent 347afa14
......@@ -31,8 +31,6 @@
#include <em_gpio.h>
#include <em_timer.h>
#define BUZZER_PWM_FREQ 10000
void buzzer_init(void)
{
// Configure buzzer pin as push/pull output
......
......@@ -105,7 +105,7 @@ void clock_main(void* params) {
// Event loop
while(1) {
if(xQueueReceive(appQueue, &evt, 0)) {
if(xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch(evt.type) {
case BUTTON_PRESSED:
if(evt.data.button == BUT_TR)
......
......@@ -132,7 +132,7 @@ void compass_main(void *params)
/*main loop*/
while(1) {
if(xQueueReceive(appQueue, &evt, 0)) {
if(xQueueReceive(appQueue, &evt, 100 / portTICK_RATE_MS)) {
switch(evt.type) {
case BUTTON_PRESSED:
if(evt.data.button == BUT_TR)
......
......@@ -69,14 +69,14 @@ static void widget_event(struct ui_widget *w, const struct event *evt)
// short vibration
vibra_enable();
vTaskDelay(100);
vTaskDelay(400 / portTICK_RATE_MS);
vibra_disable();
break;
case RTC_TICK:
// tick-tock with a buzzer
buzzer_enable();
vTaskDelay(100);
vTaskDelay(400 / portTICK_RATE_MS);
buzzer_disable();
// ok, we do not need redrawing
w->flags &= ~WF_DIRTY;
......@@ -137,7 +137,7 @@ void example_main(void* params) {
// "0" in the line below, if you set it to a positive value then
// you may have a block of code that is executed when no event arrives
// for details, see below (else block)
if(xQueueReceive(appQueue, &evt, 0)) {
if(xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch(evt.type) {
// decide which events are relevant and should be handled
// you may save some cycles if you list them here instead of
......
......@@ -126,7 +126,7 @@ void game_main(void *params)
/*main loop*/
while(1) {
if(xQueueReceive(appQueue, &evt, 0)) {
if(xQueueReceive(appQueue, &evt, 30 / portTICK_RATE_MS)) {
switch(evt.type) {
case BUTTON_PRESSED:
if(evt.data.button == BUT_TR) {
......@@ -173,7 +173,7 @@ void game_main(void *params)
win_y1 = S_WIN_Y1;
vibra_enable();
buzzer_enable();
vTaskDelay(100);
vTaskDelay(300 / portTICK_RATE_MS);
vibra_disable();
buzzer_disable();
} else {
......
......@@ -153,7 +153,7 @@ void gpscoord_main(void *params)
ui_update(NULL);
while (1) {
if (xQueueReceive(appQueue, &evt, 0)) {
if (xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch (evt.type) {
case BUTTON_PRESSED:
if (evt.data.button == BUT_TR)
......
......@@ -195,7 +195,7 @@ void menu_main(void* params) {
// Once it is deactivated - display the menu
while(1) {
if(xQueueReceive(appQueue, &evt, 0)) {
if(xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch(evt.type) {
case BUTTON_PRESSED:
if(evt.data.button == BUT_TL) {
......
......@@ -60,7 +60,7 @@ void reset_main(void *params)
ui_update(NULL);
while(1) {
if (xQueueReceive(appQueue, &evt, 0)) {
if (xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch (evt.type) {
case BUTTON_PRESSED:
if (evt.data.button == BUT_TR)
......
......@@ -175,7 +175,7 @@ void set_date_main(void* params) {
// event loop
while(1) {
if(xQueueReceive(appQueue, &evt, 0)) {
if(xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch(evt.type) {
case BUTTON_PRESSED:
if(evt.data.button == BUT_TL) {
......
......@@ -165,7 +165,7 @@ void set_gmt_ofs_main(void* params) {
// event loop
while(1) {
if(xQueueReceive(appQueue, &evt, 0)) {
if(xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch(evt.type) {
case BUTTON_PRESSED:
if(evt.data.button == BUT_TL) {
......
......@@ -140,7 +140,7 @@ void set_time_main(void* params) {
// event loop
while(1) {
if(xQueueReceive(appQueue, &evt, 0)) {
if(xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch(evt.type) {
case BUTTON_PRESSED:
if(evt.data.button == BUT_TL) {
......
......@@ -90,7 +90,7 @@ void usb_ms_main(void* params) {
while(1) {
if(xQueueReceive(appQueue, &evt, 1)) {
if(xQueueReceive(appQueue, &evt, portMAX_DELAY)) {
switch(evt.type) {
case BUTTON_PRESSED:
if(evt.data.button == BUT_TR) {
......
......@@ -36,7 +36,7 @@
#include <stdbool.h>
///> Number of ticks between battery status polling
#define BATTERY_TASK_PERIOD 4000
#define BATTERY_TASK_PERIOD (4000 / portTICK_RATE_MS)
///> Timer handle
static xTimerHandle timer_handle;
......
......@@ -35,7 +35,7 @@
#include <drivers/light_sensor.h>
///> Number of ticks between backlight adjustments
#define BLIGHT_TASK_PERIOD 3000
#define BLIGHT_TASK_PERIOD (5000 / portTICK_RATE_MS)
///> Entry that stores an appropriate backlight level value
///> depending on the light sensor readings.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment