File: fakeact2.h

package info (click to toggle)
eegdev 0.2-12
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,088 kB
  • sloc: ansic: 32,298; sh: 10,941; makefile: 251; lex: 138; yacc: 130; xml: 29
file content (64 lines) | stat: -rw-r--r-- 1,631 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
    Copyright (C) 2011  EPFL (Ecole Polytechnique Fédérale de Lausanne)
    Laboratory CNBI (Chair in Non-Invasive Brain-Machine Interface)
    Nicolas Bourdaud <nicolas.bourdaud@epfl.ch>

    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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef FAKEACT2_H
#define FAKEACT2_H

#define PERIOD	113

static inline
int32_t get_analog_val(size_t sam, unsigned int ich, int stype)
{
	(void)stype;
	return 256*((ich+1)*((sam % PERIOD) - 50));
}


static inline
float get_analog_valf(size_t sam, unsigned int ich, int stype)
{
	return (1.0f/8192.0f)*get_analog_val(sam, ich, stype);
}

static inline
double get_analog_vald(size_t sam, unsigned int ich, int stype)
{
	return (1.0/8192.0)*get_analog_val(sam, ich, stype);
}

static inline
int32_t compute_trigger(size_t sam, int32_t stateval)
{
	int32_t trval;
	
	trval = 256*(sam % PERIOD);
	trval |= stateval; 

	return trval;
}


static inline
int32_t get_trigger_val(size_t sam, int32_t stateval)
{
	return (compute_trigger(sam, stateval << 8) >> 8) & 0x00FFFFFF;
}


#endif