Exemple #1
0
        public void InitializeAnalogOutput()
        {
            if (_bcm2835.bcm2835_init() == 0)
            {
                throw new InvalidOperationException("bcm2835_init failed. Are you running as root?");
            }

            InitializeSpi();

            //it would be 'op1 1 && op2 0' for no voltage
            SetAnalogOutputValue(AnalogOutput.None, 0);             //all register would be 0 as starting position (init), -1 can be ignored
            pe2a_AO_OP1OP2_choosing(2, ref AO_tbuf1[0]);            //mode 2: write all registers and update outputs

            //transferring to dac124s085 by TI
            _bcm2835.bcm2835_spi_transfernb(AO_tbuf1, AO_rbuf1, (uint)AO_tbuf1.Length);
        }