dacctr library  v0.8
Performs D/A conversion (sets voltages) with a cog's counter modules
dacctr.h
Go to the documentation of this file.
1 
52 #ifndef DACCTR_H
53 #define DACCTR_H
54 
55 #if defined(__cplusplus)
56 extern "C" {
57 #endif
58 
59 #include "simpletools.h"
60 
61 #ifndef DUTY_SE
62 #define DUTY_SE (6 << 26)
63 #endif
64 
65 #ifndef NEW_COG
66 #define NEW_COG 2
67 #endif
68 
69 //extern int dacCtrBits;
70 
71 typedef struct DacControl
72 {
73  volatile int daCog;
74  volatile int daPin;
75  volatile int daBitX;
76  volatile int daCh;
77  volatile int daCtr;
78  volatile int daVal;
79 } dac;
80 
81 
82 typedef struct DacAddr
83 {
84  volatile unsigned int daDt;
85  dac* da0;
86  dac* da1;
87 } daca;
88 
89 
90 typedef struct DacCogMemory
91 {
92  unsigned int stack[(160 + 200) / 4];
93 } dacmem;
94 
118 dac dac_setup(int pin, int channel, int bits);
119 
131 void dac_set(dac* da, int value);
132 
140 void dac_close(dac* da);
141 
162 int dac_start(dacmem mem, int sampleRate, dac* da0, dac* da1);
163 
169 int dac_stop(int cogid);
170 
171 #if defined(__cplusplus)
172 }
173 #endif
174 /* __cplusplus */
175 #endif
176 /* DACCTR_H */
177