DS2482-RK
|
Finds all of the devices on the 1-wire bus. More...
#include <DS2482-RK.h>
Public Member Functions | |
DS2482DeviceList & | getDeviceList () |
Get the device list that was passed into run. More... | |
const DS2482DeviceList & | getDeviceList () const |
Get the device list that was passed into run a const object. | |
Public Member Functions inherited from DS2482Command | |
DS2482Command (DS2482 &parent) | |
Construct a command object. More... | |
virtual | ~DS2482Command () |
Destructor. | |
Static Public Member Functions | |
static DS2482SearchBusCommand & | run (DS2482 &parent, DS2482DeviceList &deviceList, std::function< void(DS2482SearchBusCommand &, int status)> completion) |
Run a DS18B20 search bus command to find all of the DS18B20s on the 1-wire bus. More... | |
Friends | |
class | DS2482 |
Additional Inherited Members | |
Static Public Attributes inherited from DS2482Command | |
static const int | RESULT_WORKING = 0 |
Asynchronous call still in progress. | |
static const int | RESULT_DONE = 1 |
Asynchronous call completed successfully. | |
static const int | RESULT_I2C_ENDTRANSMISSION_BUSY_ERROR = -1 |
Busy timeout upon entering endTransmission (I2C error) | |
static const int | RESULT_I2C_ENDTRANSMISSION_START_ERROR = -2 |
Start bit generation timeout (I2C error) | |
static const int | RESULT_I2C_ENDTRANSMISSION_ADDRESS_ERROR = -3 |
End of address transmission timeout (I2C error) | |
static const int | RESULT_I2C_ENDTRANSMISSION_TRANSFER_ERROR = -4 |
Data byte transfer timeout (I2C error) | |
static const int | RESULT_I2C_ENDTRANSMISSION_AFTER_TRANSFER_ERROR = -5 |
Data byte transfer succeeded, busy timeout immediately after (I2C error) | |
static const int | RESULT_I2C_READ_TIMEOUT = -100 |
I2C requestFrom did not return bytes. | |
static const int | RESULT_I2C_COMMAND_TIMEOUT = -101 |
An I2C command timed out. | |
static const int | RESULT_1WIRE_SHORT = -200 |
On a 1-wire bus reset, a short was detected (SD flag set) | |
static const int | RESULT_1WIRE_BUSY = -201 |
The previous 1-wire command had not completed yet. | |
static const int | RESULT_1WIRE_NO_DEVICE = -202 |
No device on the 1-wire bus when doing a 1-wire send address (no presence pulse detected) | |
static const int | RESULT_TOO_MANY_RETRIES = -300 |
Specified number of retries exceeded without getting a response with a valid CRC. | |
static const int | RESULT_SEARCH_FAILED = -301 |
During a 1-wire search bus, got an invalid set of bits returned. | |
static const int | RESULT_SET_CHANNEL_FAILED = -303 |
A DS2482-800 set channel operation failed to set the channel. | |
static const uint8_t | TRIPLET_CMD = 0x78 |
DS2482 I2C command code. | |
static const uint8_t | SINGLE_1WIRE_BIT_CMD = 0x87 |
DS2482 I2C command code. | |
static const uint8_t | WRITE_BYTE_CMD = 0xa5 |
DS2482 I2C command code. | |
static const uint8_t | READ_BYTE_CMD = 0x96 |
DS2482 I2C command code. | |
static const uint8_t | RESET_1WIRE_CMD = 0xb4 |
DS2482 I2C command code. | |
static const uint8_t | CHANNEL_SELECT_CMD = 0xc3 |
DS2482 I2C command code. | |
static const uint8_t | WRITE_CONFIG_CMD = 0xd2 |
DS2482 I2C command code. | |
static const uint8_t | SET_READ_PTR_CMD = 0xe1 |
DS2482 I2C command code. | |
static const uint8_t | DEVICE_RESET_CMD = 0xf0 |
DS2482 I2C command code. | |
static const uint8_t | CONFIG_REG = 0xc3 |
DS2482 register code. | |
static const uint8_t | READ_DATA_REG = 0xe1 |
DS2482 register code. | |
static const uint8_t | STATUS_REG = 0xf0 |
DS2482 register code. | |
static const uint8_t | STATUS_DIR_MASK = 0b10000000 |
DS2482 status register bit. | |
static const uint8_t | STATUS_TSB_MASK = 0b01000000 |
DS2482 status register bit. | |
static const uint8_t | STATUS_SBR_MASK = 0b00100000 |
DS2482 status register bit. | |
static const uint8_t | STATUS_RST_MASK = 0b00010000 |
DS2482 status register bit. | |
static const uint8_t | STATUS_LL_MASK = 0b00001000 |
DS2482 status register bit. | |
static const uint8_t | STATUS_SD_MASK = 0b00000100 |
DS2482 status register bit. | |
static const uint8_t | STATUS_PPD_MASK = 0b00000010 |
DS2482 status register bit. | |
static const uint8_t | STATUS_1WB_MASK = 0b00000001 |
DS2482 status register bit. | |
static const uint8_t | CONFIG_1WS_MASK = 0b1000 |
DS2482 config register bit. | |
static const uint8_t | CONFIG_SPU_MASK = 0b0100 |
DS2482 config register bit. | |
static const uint8_t | CONFIG_APU_MASK = 0b0001 |
DS2482 config register bit. | |
static const uint8_t | SEARCH_ROM = 0xf0 |
1-wire ROM select command | |
static const uint8_t | READ_ROM = 0x33 |
1-wire ROM select command | |
static const uint8_t | MATCH_ROM = 0x55 |
1-wire ROM select command | |
static const uint8_t | SKIP_ROM = 0xcc |
1-wire ROM select command | |
static const uint8_t | ALARM_SEARCH = 0xec |
DS18B20 command. | |
static const uint8_t | CONVERT_T = 0x44 |
DS18B20 command. | |
static const uint8_t | WRITE_SCRATCHPAD = 0x4e |
DS18B20 command. | |
static const uint8_t | READ_SCRATCHPAD = 0xbe |
DS18B20 command. | |
static const uint8_t | COPY_SCRATCHPAD = 0x48 |
DS18B20 command. | |
static const uint8_t | RECALL_E2 = 0xb8 |
DS18B20 command. | |
static const uint8_t | READ_POWER_SUPPLY = 0xb4 |
DS18B20 command. | |
static const int | CONVERSION_9BIT = 0 |
9-bit conversion size, resolution of 1/2 degree C, conversion time 94 ms | |
static const int | CONVERSION_10BIT = 1 |
10-bit conversion size, resolution of 1/4 degree C, conversion time 188 ms | |
static const int | CONVERSION_11BIT = 2 |
11-bit conversion size, resolution of 1/8 degree C, conversion time 375 ms | |
static const int | CONVERSION_12BIT = 3 |
12-bit conversion size, resolution of 1/16 degree C, conversion time 750 ms (default) | |
static const int | RETRIES_DEFAULT = 3 |
Default numnber of retries if you don't override it with withRetries() | |
Protected Member Functions inherited from DS2482Command | |
void | pushCommand () |
Add this command to the parent queue. | |
void | pushCommandList () |
Pushes a command list onto the command list stack. This is done when a command needs their own sequence of commands to run. | |
void | popCommandList () |
Pops a command list off the command list stack. This is done when a command needs their own sequence of commands to run. | |
int | readStatus (uint8_t &value, bool setReadPointerFirst=true) |
Reads the status DS2482 status register. | |
int | readData (uint8_t &value, bool setReadPointerFirst=true) |
Reads the status DS2482 data register. | |
int | setReadPointer (uint8_t reg) |
Sets the DS2482 read pointer to a specific register (CONFIG_REG, READ_DATA_REG, READ_DATA_REG) | |
int | readConfig (uint8_t &value) |
Reads the DS2482 config register. Always sets the data pointer first. | |
int | writeConfig (bool speed, bool spu, bool apu) |
Writes the DS2482 config register. | |
int | writeReg0 (uint8_t reg) |
Writes a DS2482 register. | |
int | writeReg1 (uint8_t reg, uint8_t value) |
Writes the DS2482 config register and a value. | |
int | strongPullUp (bool on) |
Enables or disables strong pull-up mode. Used by parasitic power mode. | |
void | beginTransmission () |
Reflects to DS2482 parent to do an I2C operation. | |
uint8_t | endTransmission (bool stop=true) |
Reflects to DS2482 parent to do an I2C operation. | |
uint8_t | requestFrom (uint8_t numBytes, bool stop=true) |
Reflects to DS2482 parent to do an I2C operation. | |
size_t | write (uint8_t val) |
Reflects to DS2482 parent to do an I2C operation. | |
size_t | write (const uint8_t *buf, size_t count) |
Reflects to DS2482 parent to do an I2C operation. | |
int | available (void) |
Reflects to DS2482 parent to do an I2C operation. | |
int | read (void) |
Reflects to DS2482 parent to do an I2C operation. | |
Protected Attributes inherited from DS2482Command | |
DS2482 & | parent |
The DS2482 that this command is being run on. | |
Finds all of the devices on the 1-wire bus.
If you have a multi-drop DS18B20 setup, this will find the 64-bit device addresses for every sensor on the 1-wire bus.
Searching the 1-wire bus temporarily requires about 800 bytes of heap space for the duration of the search.
As with all command objects, you do not typically construct one of these objects. Instead, use the static run method to handle allocating, initializing, and queueing the command.
|
inline |
Get the device list that was passed into run.
You can use this from the completion, however it's not usually necessary since in most cases you'll be able to access the variable you originally passed to run from your capture. But if for some reason you don't want to capture it, you can use this.
|
static |
Run a DS18B20 search bus command to find all of the DS18B20s on the 1-wire bus.
parent | The DS2482 you want to send the command to. If it's a DS2482_800, make sure you set the channel as well. |
deviceList | The DS2482DeviceList object you want to save the list of devices to. The object is cleared before use. |
completion | The completion handler lambda function. status is the result status of the call; if DS2482Command::RESULT_DONE then the call succeeded. If it's any other value an error occurred. |
This call executes asynchronously. The completion function is called when complete or an error occurs.