thank you johannes. I checked the whole archive/test/Io spi examples. It helps much to understand, how to get spi running and communicate to other devices. Are there any more I2C examples? I'm trying to connect MPR121 touch sensor and can't get it working.
What do you and the others think about a database, where user can share their patches and objects etc. like www.maxforlive.com?
here is a fixed version of script object. Is it now correct or are there any misstakes?
// by paul for axoloti script2 objekt.
// inlet1 = DACout A
// inlet2 = DACout B
uint8_t *txbuf;
void setup(void){
static uint8_t _txbuf[32] __attribute__ ((section (".sram2")));
txbuf = _txbuf;
}
void loop(void){
//MCP4922 DAC (MCP4822: Bit 14 is ignored)
// dacA: 0x7 (Bits: 0111)= select output A, Buffer enable, Gain *1, SHDN (active mode operation) + 12bit Value of in1
// dacB: 0xF (Bits: 1111)= select output A, Buffer enable, Gain *1, SHDN (active mode operation) + 12bit Value of in2
uint16_t dacOutA = (0x7 << 12) | ( in1>>15 );
uint16_t dacOutB = (0xF << 12) | ( in2>>15 );
spiSelect(&SPID1);
txbuf[0] = (dacOutA >> 8);
txbuf[1] = (dacOutA & 0xFF);
spiSend(&SPID1,2,txbuf);
spiUnselect(&SPID1);
spiSelect(&SPID1);
txbuf[0] = (dacOutB >> 8);
txbuf[1] = (dacOutB & 0xFF);
spiSend(&SPID1,2,txbuf);
spiUnselect(&SPID1);
chThdSleepMilliseconds(1);
}