libClearCore/src/DigitalInOutAnalogOut.cpp
void DigitalInOutAnalogOut::DacEnable() {
    // Make sure that a valid command has been written to the DAC
    DacRegisterWrite(m_dacZero);

    // Set up the INPUT pin as DAC output
    PMUX_ENABLE(m_inputPort, m_inputDataBit);   // (-) DAC output
    PMUX_ENABLE(m_analogPort, m_analogDataBit); // (+) DAC output

    SYNCBUSY_WAIT(DAC, DAC_SYNCBUSY_ENABLE);
    if (!DAC->CTRLA.bit.ENABLE) {
        DAC->CTRLA.bit.ENABLE = 1;
        SYNCBUSY_WAIT(DAC, DAC_SYNCBUSY_ENABLE);
    }

    while (!DAC->STATUS.vec.READY) {
        continue;
    }

    // Update the LED pattern
    ShiftReg.LedPwmValue(m_clearCorePin, 0);
    ShiftReg.LedInPwm(m_ledMask, true, m_clearCorePin);

    // Set the Cfg00_CFG00_AOUT_BIT to HIGH for use as an Analog Output
    ShiftReg.ShifterStateSet(ShiftRegister::SR_CFG00_AOUT_MASK);
}
/**
    Turn on the DAC (and possibly cause other I/O functions to misbehave on IO-0)
**/
Turn on the DAC (and possibly cause other I/O functions to misbehave on IO-0)
Turn on the DAC ( and possibly cause other I / O functions to misbehave on IO - 0 )
void DigitalInOutAnalogOut::DacEnable() {
    DacRegisterWrite(m_dacZero);
    PMUX_ENABLE(m_inputPort, m_inputDataBit);   
    PMUX_ENABLE(m_analogPort, m_analogDataBit); 
    SYNCBUSY_WAIT(DAC, DAC_SYNCBUSY_ENABLE);
    if (!DAC->CTRLA.bit.ENABLE) {
        DAC->CTRLA.bit.ENABLE = 1;
        SYNCBUSY_WAIT(DAC, DAC_SYNCBUSY_ENABLE);
    }
    while (!DAC->STATUS.vec.READY) {
        continue;
    }
    ShiftReg.LedPwmValue(m_clearCorePin, 0);
    ShiftReg.LedInPwm(m_ledMask, true, m_clearCorePin);
    ShiftReg.ShifterStateSet(ShiftRegister::SR_CFG00_AOUT_MASK);
}
void DigitalInOutAnalogOut :: DacEnable ( ) { DacRegisterWrite ( m_dacZero ) ; PMUX_ENABLE ( m_inputPort , m_inputDataBit ) ; PMUX_ENABLE ( m_analogPort , m_analogDataBit ) ; SYNCBUSY_WAIT ( DAC , DAC_SYNCBUSY_ENABLE ) ; if ( ! DAC -> CTRLA . bit . ENABLE ) { DAC -> CTRLA . bit . ENABLE = 1 ; SYNCBUSY_WAIT ( DAC , DAC_SYNCBUSY_ENABLE ) ; } while ( ! DAC -> STATUS . vec . READY ) { continue ; } ShiftReg . LedPwmValue ( m_clearCorePin , 0 ) ; ShiftReg . LedInPwm ( m_ledMask , true , m_clearCorePin ) ; ShiftReg . ShifterStateSet ( ShiftRegister :: SR_CFG00_AOUT_MASK ) ; }
Turn on the DAC (and possibly cause other I/O functions to misbehave on IO-0)
Turn on the DAC ( and possibly cause other I / O functions to misbehave on IO - 0 )
// Make sure that a valid command has been written to the DAC // Set up the INPUT pin as DAC output // (-) DAC output // (+) DAC output // Update the LED pattern // Set the Cfg00_CFG00_AOUT_BIT to HIGH for use as an Analog Output