5 C Example
1
#i n c l u d e
” N d i g o i n t e r f a c e . h ”
2
#i n c l u d e
<
s t d i o . h
>
3
#i n c l u d e
<
s t d l i b . h
>
4
5
i n t
main
(
i n t
a r g c
,
c h a r
*
a r g v
[ ] )
6
{
7
n d i g o i n i t p a r a m e t e r s params
;
8
n d i g o g e t d e f a u l t i n i t p a r a m e t e r s
(&
params
) ;
9
10
params
.
c a r d i n d e x
= 0 ;
11
params
.
b u f f e r s i z e
[ 0 ] = 1
<<
23;
12
params
.
d r i v e e x t e r n a l c l o c k
=
t r u e
;
13
params
.
i s s l a v e
=
f a l s e
;
14
params
.
u s e e x t e r n a l c l o c k
=
f a l s e
;
15
16
i n t
e r r o r c o d e
;
17
c o n s t c h a r
*
e r r o r m e s s a g e
;
18
n d i g o d e v i c e
*
ndgo
=
n d i g o i n i t
(&
params
, &
e r r o r c o d e
, &
e r r o r m e s s a g e
) ;
19
i f
(
e r r o r c o d e
!=
NDIGO OK
)
{
20
p r i n t f
(
”
\
n E r r o r %d : %s
\
n ”
,
e r r o r c o d e
,
e r r o r m e s s a g e
) ;
21
e x i t
(
−
1) ;
22
}
23
24
n d i g o c o n f i g u r a t i o n
c o n f i g
;
25
n d i g o g e t d e f a u l t c o n f i g u r a t i o n
(
ndgo
, &
c o n f i g
) ;
26
c o n f i g
.
adc mode
=
NDIGO ADC MODE ABCD
;
27
28
// d i s a b l e unused t r i g g e r
b l o c k s
29
c o n f i g
.
t r i g g e r b l o c k
[ 1 ] .
e n a b l e d
=
f a l s e
;
30
c o n f i g
.
t r i g g e r b l o c k
[ 2 ] .
e n a b l e d
=
f a l s e
;
31
c o n f i g
.
t r i g g e r b l o c k
[ 3 ] .
e n a b l e d
=
f a l s e
;
32
c o n f i g
.
t r i g g e r b l o c k
[ 4 ] .
e n a b l e d
=
f a l s e
;
33
34
// c o n f i g u r e
t r i g g e r b l o c k 0
35
c o n f i g
.
t r i g g e r b l o c k
[ 0 ] .
e n a b l e d
=
t r u e
;
36
c o n f i g
.
t r i g g e r b l o c k
[ 0 ] .
m i n i m u m f r e e p a c k e t s
= 1 . 0 ;
37
c o n f i g
.
t r i g g e r b l o c k
[ 0 ] .
p r e c u r s o r
= 0 ;
38
c o n f i g
.
t r i g g e r b l o c k
[ 0 ] .
r e t r i g g e r
= 0 ;
39
40
c o n f i g
.
t r i g g e r b l o c k
[ 0 ] .
s o u r c e s
=
NDIGO TRIGGER SOURCE A0
;
41
c o n f i g
.
t r i g g e r b l o c k
[ 0 ] .
l e n g t h
= 1 6 ;
42
c o n f i g
.
t r i g g e r b l o c k
[ 0 ] .
g a t e s
=
NDIGO TRIGGER GATE NONE
;
43
44
c o n f i g
.
a n a l o g o f f s e t
[ 0 ] = 0 . 1 ;
45
46
c o n f i g
.
t r i g g e r
[
NDIGO TRIGGER A0
] .
e d g e
=
t r u e
;
47
c o n f i g
.
t r i g g e r
[
NDIGO TRIGGER A0
] .
r i s i n g
=
f a l s e
;
48
c o n f i g
.
t r i g g e r
[
NDIGO TRIGGER A0
] .
t h r e s h o l d
= 0 ;
43
Summary of Contents for Ndigo5G-10
Page 2: ......
Page 3: ......
Page 7: ......
Page 45: ...cronologic GmbH Co KG 40 Ndigo5G User Guide...
Page 54: ...on page 47 cronologic GmbH Co KG 49 Ndigo5G User Guide...