HapticLib  0.7
Haptic Feedback Library for embedded systems
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
hl_patterns.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012, Leonardo Guardati <leonardo@guardati.it>
3  *
4  * Permission to use, copy, modify, and/or distribute this
5  * software for any purpose with or without fee is hereby
6  * granted, provided that the above copyright notice and this
7  * permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS
10  * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
11  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
12  * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
13  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
15  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
17  * USE OR PERFORMANCE OF THIS SOFTWARE.
18  *
19  */
41 #include <stdint.h>
42 #include <stdlib.h>
43 
44 #ifdef HL_DEBUG
45 #include "hl_debug.h"
46 #endif
47 
48 /*
49  * Platform Specific Hardware Level
50  *
51  */
52 #ifdef STM32VLDISCOVERY
53 #include "hl_STM32VLDISCOVERY.h"
54 #elif OTHERS
55 #include "hl_OTHERS.h"
56 #endif
57 
58 #include "test.h"
59 #include "generic.h"
60 #include "impact.h"
61 #include "constant.h"
62 
84 #define MAX_PATTERNS 10
85 
99 typedef enum pattern_name {
101 
106 
108 } pattern_name;
109 
126 typedef union status_param {
139 } status_param;
140 
170 typedef union user_param {
177 } user_param;
178 
179 struct haptor_desc;
180 
181 struct pattern_desc;
182 
202 typedef uint8_t(* pattern_continuator)(struct pattern_desc *);
203 
211 typedef struct pattern_desc {
212 
215  user_param *userParams;
219  status_param statusParams;
224  pattern_continuator continuator;
227  struct haptor_desc *activeHaptorList;
233 } pattern_desc;
234 
251 typedef uint8_t(* pattern_initiator)(pattern_desc *);
252 
253 void patternScheduler(void);
254 void cleanList(struct haptor_desc *);
255 uint16_t dutyConverter(uint16_t , struct haptor_desc *);