MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / updateDevice

Method updateDevice

libraries/DAC8552/DAC8552.cpp:158–179  ·  view source on GitHub ↗

channel = 0, 1, 2, 3 depending on type direct = true ==> write buffers to both channel A and channel B direct = false ==> buffer value

Source from the content-addressed store, hash-verified

156// direct = true ==> write buffers to both channel A and channel B
157// direct = false ==> buffer value
158void DAC8552::updateDevice(uint8_t channel, bool directWrite)
159{
160 uint8_t configRegister = _register[channel];
161 if (directWrite) configRegister |= 0x30;
162
163 digitalWrite(_select, LOW);
164 if (_hwSPI)
165 {
166 mySPI->beginTransaction(_spi_settings);
167 mySPI->transfer(configRegister);
168 mySPI->transfer(_value[channel] >> 8);
169 mySPI->transfer(_value[channel] & 0xFF);
170 mySPI->endTransaction();
171 }
172 else // Software SPI
173 {
174 swSPI_transfer(configRegister);
175 swSPI_transfer(_value[channel] >> 8);
176 swSPI_transfer(_value[channel] & 0xFF);
177 }
178 digitalWrite(_select, HIGH);
179}
180
181
182// simple one mode version

Callers

nothing calls this directly

Calls 1

transferMethod · 0.80

Tested by

no test coverage detected