Changeset 5902:b82b16021032 in roaraudio


Ignore:
Timestamp:
04/21/13 00:03:55 (6 years ago)
Author:
phi
Branch:
default
Message:
  • Added GPIO service.
  • Added GPIO driver: piface.
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r5895 r5902  
    22        * Added build summery feature to RABS and configure script. 
    33        * Moved away from roar_libroar_get_path_static(). 
     4        * Added GPIO service. 
     5        * Added GPIO driver: piface. 
    46 
    57v. 1.0beta9 - Mon Feb 18 2013 23:28 CET 
  • configure

    r5893 r5902  
    663663test_lib_defmake ROAR_HAVE_H_NETINET_IN  %            'netinet/in.h' c         -- 'netinet/in.h' 
    664664test_lib_defmake ROAR_HAVE_H_LINUX_REBOOT %            linux/reboot.h c        -- linux/reboot.h 
     665test_lib_defmake ROAR_HAVE_H_LINUX_SPI_SPIDEV %            linux/spi/spidev.h c        -- linux/spi/spidev.h 
    665666test_lib_defmake ROAR_HAVE_H_WINDOWS     %            windows.h     c          -- windows.h 
    666667test_lib_defmake ROAR_HAVE_H_WINSOCK     %            winsock.h     c          -- winsock.h 
  • include/libroar/services.h

    r5887 r5902  
    212212}; 
    213213 
     214// GPIO/Sensors: 
     215#define ROAR_SERVICE_GPIO_NAME "gpio" 
     216#define ROAR_SERVICE_GPIO_ABI  "1.0beta10-pr0" 
     217 
     218#define ROAR_SERVICE_GPIO_FINPUT    ((uint_least32_t)0x00000001UL) 
     219#define ROAR_SERVICE_GPIO_FOUTPUT   ((uint_least32_t)0x00000002UL) 
     220#define ROAR_SERVICE_GPIO_FPULLDOWN ((uint_least32_t)0x00000004UL) 
     221#define ROAR_SERVICE_GPIO_FPULLUP   ((uint_least32_t)0x00000008UL) 
     222#define ROAR_SERVICE_GPIO_FCACHED   ((uint_least32_t)0x00000010UL) 
     223 
     224enum roar_service_gpio_type { 
     225 ROAR_SERVICE_GPIO_TERROR = -1, 
     226 ROAR_SERVICE_GPIO_TUNKNOWN = 0, 
     227 ROAR_SERVICE_GPIO_TINT, 
     228 ROAR_SERVICE_GPIO_TENUM, 
     229 ROAR_SERVICE_GPIO_TBOOL, 
     230 ROAR_SERVICE_GPIO_TTRISTATE, 
     231 ROAR_SERVICE_GPIO_TFLOAT 
     232}; 
     233 
     234enum roar_service_gpio_state { 
     235 ROAR_SERVICE_GPIO_SERROR = -1, 
     236 ROAR_SERVICE_GPIO_SUNKNOWN = 0, 
     237 ROAR_SERVICE_GPIO_SFREE, 
     238 ROAR_SERVICE_GPIO_SUNINITED, 
     239 ROAR_SERVICE_GPIO_SREADY, 
     240 ROAR_SERVICE_GPIO_SBUSY, 
     241 ROAR_SERVICE_GPIO_SDISCONNECTED, 
     242 ROAR_SERVICE_GPIO_SDISABLED, 
     243 ROAR_SERVICE_GPIO_SINERROR 
     244}; 
     245 
     246struct roar_service_gpio_port { 
     247 int id; 
     248 const char * name; 
     249 uint_least32_t mode; 
     250 const char * unit; 
     251 enum roar_service_gpio_type type; 
     252 enum roar_service_gpio_state state; 
     253 int irange_min; 
     254 int irange_max; 
     255 double frange_min; 
     256 double frange_max; 
     257}; 
     258 
     259struct roar_service_gpio { 
     260 // get list of gpio IDs. 
     261 // buffer is passed as ids, buffer size (in elements) is passed as len. 
     262 // returns the number of elements stored in ids or -1 on error. 
     263 ssize_t (*list)(int * ids, size_t len); 
     264 // get the number of gpios. See also comments above on what. 
     265 ssize_t (*num)(enum roar_service_num what); 
     266 // get a gpio by ID. The object returned is a copy and must not be motified or freed. 
     267 int (*get)(int id, struct roar_service_gpio_port * port); 
     268 
     269 // Sets up ports. 
     270 // the controler should set mode and state of port to given target mode and state. 
     271 // If id is given as -1 this is about the controler. mode MUST NOT contain any 
     272 // flags beside ROAR_SERVICE_GPIO_FCACHED. If ROAR_SERVICE_GPIO_FCACHED 
     273 // is set it is applied all ports. 
     274 int (*setup)(int id, uint_least32_t mode, enum roar_service_gpio_state state); 
     275 
     276 // get value of port (input or output) as int or float. 
     277 int (*get_int)(int id); 
     278 double (*get_float)(int id); 
     279 
     280 // set value of output (as int or float). 
     281 int (*set_int)(int id, int val); 
     282 int (*set_float)(int id, double val); 
     283 
     284 // convert the value val as returned by the port to the base unit of the port. 
     285 // if rev is set converst from the base unit to the value as used by the port. 
     286 int (*convert_int)(int id, int val, int rev); 
     287 double (*convert_float)(int id, double val, int rev); 
     288}; 
     289 
    214290#endif 
    215291 
  • plugins/universal/Makefile

    r5851 r5902  
    44TARGETS_PROTO=protocol-echo$(SHARED_SUFFIX) protocol-daytime$(SHARED_SUFFIX) protocol-discard$(SHARED_SUFFIX) tic-tac-toe$(SHARED_SUFFIX) protocol-http$(SHARED_SUFFIX) 
    55TARGETS_MISC=plugin-info$(SHARED_SUFFIX) helloworld$(SHARED_SUFFIX) debug-notify$(SHARED_SUFFIX) 
     6TARGETS_IO=piface$(SHARED_SUFFIX) 
    67TARGETS_SERVICE=service-about$(SHARED_SUFFIX) 
    7 TARGETS=$(TARGETS_MISC) $(TARGETS_PROTO) $(TARGETS_SERVICE) 
     8TARGETS=$(TARGETS_MISC) $(TARGETS_PROTO) $(TARGETS_SERVICE) $(TARGETS_IO) 
    89 
    910#DEFINES        = -DDEBUG 
Note: See TracChangeset for help on using the changeset viewer.