Browse Source

AP_HAL: add helper method to write register

This just forwards to the transfer() method, avoiding the need in driver
code to have a similar method.
mission-4.1.18
Lucas De Marchi 9 years ago
parent
commit
b4ff2d7595
  1. 6
      libraries/AP_HAL/Device.h

6
libraries/AP_HAL/Device.h

@ -53,6 +53,12 @@ public: @@ -53,6 +53,12 @@ public:
virtual bool transfer(const uint8_t *send, uint32_t send_len,
uint8_t *recv, uint32_t recv_len) = 0;
bool write_register(uint8_t reg, uint8_t val)
{
uint8_t buf[2] = { reg, val };
return transfer(buf, sizeof(buf), nullptr, 0);
}
/*
* Get the semaphore for the bus this device is in. This is intended for
* drivers to use during initialization phase only.

Loading…
Cancel
Save