 |
PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
|
Go to the documentation of this file.
19 void dac_ctr_cog(
void *par);
22 #define DUTY_SE (0b110 << 26)
25 static unsigned int stack[44 + 16];
27 static int dacCtrBits;
28 static unsigned int cog;
29 static volatile int ctra, ctrb, frqa, frqb;
36 void dac_ctr(
int pin,
int channel,
int dacVal)
38 if(dacCtrBits == 0) dacCtrBits = 8;
39 int dacBitX = 32 - dacCtrBits;
41 if(!cog) cog =
cogstart(dac_ctr_cog, NULL,
42 stack,
sizeof(stack)) + 1;
46 frqa = (dacVal << dacBitX);
51 frqb = (dacVal << dacBitX);
55 void dac_ctr_cog(
void *par)
64 pin =
CTRA & 0b111111;
71 pin =
CTRA & 0b111111;
80 pin =
CTRB & 0b111111;
87 pin =
CTRB & 0b111111;
void dac_ctr(int pin, int channel, int dacVal)
Set D/A voltage.
void dac_ctr_res(int bits)
Set D/A voltage resolution.
#define FRQA
Counter A frequency register.
#define FRQB
Counter B frequency register.
#define CTRB
Counter B control register.
#define cogstop(a)
Stop a COG.
#define DIRA
Use to set pins to input (0) or output (1).
void dac_ctr_stop(void)
Stop the cog that's transmitting the DAC signal(s).
int cogstart(void(*func)(void *), void *par, void *stack, size_t stacksize)
Start a new propeller LMM function/thread in another COG.
#define CTRA
Counter A control register.