dacctr library  v0.85
Performs D/A conversion (sets voltages) with a cog's counter modules
dacctr.h
Go to the documentation of this file.
1 
60 #ifndef DACCTR_H
61 #define DACCTR_H
62 
63 #if defined(__cplusplus)
64 extern "C" {
65 #endif
66 
67 #include "simpletools.h"
68 
69 #ifndef DUTY_SE
70 #define DUTY_SE (6 << 26)
71 #endif
72 
73 #ifndef NEW_COG
74 #define NEW_COG 2
75 #endif
76 
77 //extern int dacCtrBits;
78 
79 typedef struct DacControl
80 {
81  volatile int daCog;
82  volatile int daPin;
83  volatile int daBitX;
84  volatile int daCh;
85  volatile int daCtr;
86  volatile int daVal;
87 } dac;
88 
89 
90 typedef struct DacAddr
91 {
92  volatile unsigned int daDt;
93  dac* da0;
94  dac* da1;
95 } daca;
96 
97 
98 typedef struct DacCogMemory
99 {
100  unsigned int stack[(160 + 200) / 4];
101 } dacmem;
102 
126 dac dac_setup(int pin, int channel, int bits);
127 
139 void dac_set(dac* da, int value);
140 
148 void dac_close(dac* da);
149 
170 int dac_start(dacmem mem, int sampleRate, dac* da0, dac* da1);
171 
177 int dac_stop(int cogid);
178 
179 #if defined(__cplusplus)
180 }
181 #endif
182 /* __cplusplus */
183 #endif
184 /* DACCTR_H */
185