/* $Id$ * $URL$ * * GPO widget handling * * Copyright (C) 2005 Michael Reinelt * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* * exported functions: * * WIDGET_CLASS Widget_GPO * the GPO widget * */ #include "config.h" #include #include #include #include #include "debug.h" #include "cfg.h" #include "property.h" #include "timer.h" #include "widget.h" #include "widget_gpo.h" #ifdef WITH_DMALLOC #include #endif void widget_gpo_update(void *Self) { WIDGET *W = (WIDGET *) Self; WIDGET_GPO *GPO = W->data; /* evaluate properties */ property_eval(&GPO->expression); property_eval(&GPO->update); /* finally, draw it! */ if (W->class->draw) W->class->draw(W); /* add a new one-shot timer */ if (P2N(&GPO->update) > 0) { timer_add(widget_gpo_update, Self, P2N(&GPO->update), 1); } } int widget_gpo_init(WIDGET * Self) { char *section; WIDGET_GPO *GPO; /* prepare config section */ /* strlen("Widget:")=7 */ section = malloc(strlen(Self->name) + 8); strcpy(section, "Widget:"); strcat(section, Self->name); GPO = malloc(sizeof(WIDGET_GPO)); memset(GPO, 0, sizeof(WIDGET_GPO)); /* load properties */ property_load(section, "expression", NULL, &GPO->expression); property_load(section, "update", "1000", &GPO->update); /* sanity checks */ if (!property_valid(&GPO->expression)) { error("Warning: widget %s has no expression", section); } free(section); Self->data = GPO; /* fire it the first time */ widget_gpo_update(Self); return 0; } int widget_gpo_quit(WIDGET * Self) { if (Self && Self->data) { WIDGET_GPO *GPO = Self->data; property_free(&GPO->expression); property_free(&GPO->update); free(Self->data); Self->data = NULL; } return 0; } WIDGET_CLASS Widget_GPO = { .name = "gpo", .type = WIDGET_TYPE_GPO, .init = widget_gpo_init, .draw = NULL, .quit = widget_gpo_quit, }; >FilesLines 2008-12-23keypad bug fixedmichael1-1/+1 2008-12-23patch from a.nielsen: inverted parport signals, support GPI on HD44780michael2-24/+89 2008-12-23indent runmichael1-4/+4 2008-11-25fix lcd4linux driver for multible onboard controllersmichux1-4/+4 2008-11-23fix automake - check for libftdimichux4-9/+173 2008-11-22update button_exec plugin - fix segfaultmichux1-3/+2 2008-11-22update fifo plugin - untestedmichux1-1/+1 2008-10-07Replace write to external variable usb_debug by calling usb_set_debug().bwalle7-16/+7 2008-10-06adding GPI to picoLCD for reading button events by Igor Mammedov <niallain@g...michael1-1/+22 2008-10-06properties fixedmichael11-3290/+2675 2008-10-05Rebuild auto-generated autoconf stuff due to last change in drivers.m4.bwalle3-2657/+3297 2008-10-05Add 'ULA200' driver when --with-drivers=all is specifiedbwalle1-0/+1 2008-09-14strftime_tz patch from Bernhard Wallemichael1-0/+11 2008-09-08strftime_tz() plugin by Bernhard Wallemichael1-0/+25 2008-09-03ULA200 driver by Bernhard Wallemichael7-2/+825 2008-09-03indentmichael1-4/+4 2008-08-31Increased the maximum bps to 230400, if defined in <termios.h>.sonic741-2/+7 2008-08-27git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@889 3ae390bd-cb1e-0410-...sonic741-18/+11 2008-08-27D4D updates by Svenmichael1-38/+60 2008-08-03driver for 4D Systems serial displays by Sven Killigmichael9-45/+846 2008-08-03signed/unsigned mismatchmichael1-3/+3 2008-07-26added command functionsmichux1-2/+130 2008-07-15added IRLCD driver by Jean-Philippe Civademichael10-5/+467 2008-07-15'autoreconf -f -i' run & config.rpath addedmichael8-370/+1617