card installation checking
This commit is contained in:
parent
1862887d30
commit
1481c08d3a
10 changed files with 122 additions and 37 deletions
|
@ -3,7 +3,9 @@
|
|||
AnalogCard::AnalogCard() : dac0(DAC0_ADDRESS),
|
||||
dac1(DAC1_ADDRESS),
|
||||
dac2(DAC2_ADDRESS),
|
||||
dac3(DAC3_ADDRESS)
|
||||
dac3(DAC3_ADDRESS),
|
||||
analogInputBankA(),
|
||||
analogInputBankB()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -36,16 +38,45 @@ uint16_t AnalogCard::analogRead(uint8_t pin)
|
|||
return this->analogInputBankB.readADC_SingleEnded(pin - 4);
|
||||
}
|
||||
}
|
||||
void AnalogCard::begin()
|
||||
bool AnalogCard::begin()
|
||||
{
|
||||
this->dac0 = MCP4725(DAC0_ADDRESS);
|
||||
this->dac1 = MCP4725(DAC1_ADDRESS);
|
||||
this->dac2 = MCP4725(DAC2_ADDRESS);
|
||||
this->dac3 = MCP4725(DAC3_ADDRESS);
|
||||
this->dac0.begin();
|
||||
this->dac1.begin();
|
||||
this->dac2.begin();
|
||||
this->dac3.begin();
|
||||
this->analogInputBankA.begin(ANALOG_INPUT_BANK_A_ADDRESS);
|
||||
this->analogInputBankB.begin(ANALOG_INPUT_BANK_B_ADDRESS);
|
||||
if (!this->dac0.begin())
|
||||
{
|
||||
Serial.println("Card Analog ERROR: Failed to install DAC0");
|
||||
return false;
|
||||
}
|
||||
if (!this->dac1.begin())
|
||||
{
|
||||
Serial.println("Card Analog ERROR: Failed to install DAC1");
|
||||
return false;
|
||||
}
|
||||
if (!this->dac2.begin())
|
||||
{
|
||||
Serial.println("Card Analog ERROR: Failed to install DAC2");
|
||||
return false;
|
||||
}
|
||||
if (!this->dac3.begin())
|
||||
{
|
||||
Serial.println("Card Analog ERROR: Failed to install DAC3");
|
||||
return false;
|
||||
}
|
||||
if (!this->analogInputBankA.begin())
|
||||
{
|
||||
Serial.println("Card Analog ERROR: Failed to install analog input bank A");
|
||||
return false;
|
||||
}
|
||||
if (!this->analogInputBankB.begin())
|
||||
{
|
||||
Serial.println("Card Analog ERROR: Failed to install analog input bank B");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void AnalogCard::loop()
|
||||
{
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue