MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / SPIDevice

Method SPIDevice

libraries/AP_HAL_Linux/SPIDevice.cpp:239–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237
238
239SPIDevice::SPIDevice(SPIBus &bus, SPIDesc &device_desc)
240 : _bus(bus)
241 , _desc(device_desc)
242{
243 set_device_bus(_bus.bus);
244 set_device_address(_desc.subdev);
245 _speed = _desc.highspeed;
246
247 if (_desc.cs_pin != SPI_CS_KERNEL) {
248 _cs = hal.gpio->channel(_desc.cs_pin);
249 if (!_cs) {
250 AP_HAL::panic("Unable to instantiate cs pin");
251 }
252
253 _cs->mode(HAL_GPIO_OUTPUT);
254
255 // do not hold the SPI bus initially
256 _cs_release();
257 }
258}
259
260SPIDevice::~SPIDevice()
261{

Callers

nothing calls this directly

Calls 3

panicFunction · 0.70
channelMethod · 0.45
modeMethod · 0.45

Tested by

no test coverage detected