Skip to content

Commit

Permalink
doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
orgua committed Feb 29, 2016
1 parent 6a269b8 commit 93d8bdd
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 14 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The main goal is to use modern sensors (mainly [I2C](https://github.com/orgua/iL
- **DS2401 Serial Number**
- **DS2405 Single address switch**
- DS2408 8-Channel Addressable Switch, GPIO Port-expander
- **DS2411 Serial Number** (use DS2401 with same family code 0x01)
- **DS2413 Dual channel addressable switch with input-sensing**
- DS2423 4kb 1-Wire RAM with Counter
- DS2433 4Kb 1-Wire EEPROM
Expand Down Expand Up @@ -70,4 +71,4 @@ The main goal is to use modern sensors (mainly [I2C](https://github.com/orgua/iL
- original pieces seem to be adopted from [OneWireSlave](http://robocraft.ru/blog/arduino/302.html)
- further development was done in [OneWireSlave](https://github.com/MarkusLange/OneWireSlave) from MarkusLange and [OneWire](https://github.com/PaulStoffregen/OneWire)
- first implementation of the [OneWireHub](https://github.com/Shagrat2/OneWireHub) by Shagrat2
- the current state of code has the concepts in common, but the codebase is a (nearly) total rewrite
- the current state of code has the concepts in common, but the codebase is a total rewrite
2 changes: 1 addition & 1 deletion examples/OneWireHubTest/OneWireHubTest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void setup()
hub.attach(ds2401b);
hub.attach(ds2413);
hub.attach(ds2438);
//hub.attach(ds2450); // still breaks the communication ? find out :-)
//hub.attach(ds2450);
hub.attach(ds2890A);
hub.attach(ds2890B);
hub.attach(ds2890C);
Expand Down
2 changes: 0 additions & 2 deletions src/DS2890.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#include "DS2890.h"

DS2890::DS2890(uint8_t ID1, uint8_t ID2, uint8_t ID3, uint8_t ID4, uint8_t ID5, uint8_t ID6, uint8_t ID7) : OneWireItem(ID1, ID2, ID3, ID4, ID5, ID6, ID7)
Expand Down Expand Up @@ -71,7 +70,6 @@ bool DS2890::duty(OneWireHub *hub)

default:
hub->raiseSlaveError(cmd);
break;
}

return true;
Expand Down
7 changes: 2 additions & 5 deletions src/OneWireHub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ bool OneWireHub::search(void)
bool OneWireHub::recvAndProcessCmd(void)
{
uint8_t address[8];
bool flag;
bool flag = false;
uint8_t cmd = recv();

switch (cmd)
Expand All @@ -378,7 +378,6 @@ bool OneWireHub::recvAndProcessCmd(void)
recv(address, 8);
if (_error != Error::NO_ERROR) return false;

flag = false;
slave_selected = 0;

for (uint8_t i = 0; i < ONEWIRESLAVE_LIMIT; ++i)
Expand Down Expand Up @@ -406,7 +405,6 @@ bool OneWireHub::recvAndProcessCmd(void)
if (slave_selected != nullptr) slave_selected->duty(this);
return true;


case 0xCC: // SKIP ROM
slave_selected = nullptr;
return true;
Expand All @@ -417,7 +415,6 @@ bool OneWireHub::recvAndProcessCmd(void)

default: // Unknown command
_error = Error::INCORRECT_ONEWIRE_CMD;

}
return false;
}
Expand Down Expand Up @@ -579,7 +576,7 @@ bool OneWireHub::waitWhilePinIs(const bool value, const uint16_t timeout_us)
if (micros() > time_trigger) return false;
}
#else
uint16_t retries = static_cast<uint16_t>(microsecondsToClockCycles(timeout_us) >> 3);
uint16_t retries = static_cast<uint16_t>(microsecondsToClockCycles(timeout_us)/11);
while (DIRECT_READ(reg, pin_bitMask) == value)
{
if (--retries == 0) return false;
Expand Down
8 changes: 4 additions & 4 deletions src/OneWireHub.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,20 @@ class OneWireHub
static constexpr uint8_t ONEWIRE_TREE_SIZE = 2*ONEWIRESLAVE_LIMIT - 1;


/// the following TIME-values are in us and are taken from the ds2408 datasheet
/// the following TIME-values are in microseconds and are taken from the ds2408 datasheet
// should be --> datasheet
// was --> shagrat-legacy
static constexpr uint16_t ONEWIRE_TIME_BUS_CHANGE_MAX = 5; //
static constexpr uint16_t ONEWIRE_TIME_BUS_CHANGE_MAX = 5; //

static constexpr uint16_t ONEWIRE_TIME_RESET_MIN = 380; // should be 480, and was 470
static constexpr uint16_t ONEWIRE_TIME_RESET_MAX = 960; // from ds2413

static constexpr uint16_t ONEWIRE_TIME_PRESENCE_SAMPLE_MIN = 20; // probe measures 40us
static constexpr uint16_t ONEWIRE_TIME_PRESENCE_LOW_STD = 140; // was 125
static constexpr uint16_t ONEWIRE_TIME_PRESENCE_LOW_MAX = 480; // should be 280, was 480 !!!! why
static constexpr uint16_t ONEWIRE_TIME_PRESENCE_HIGH_MAX = 999; //
static constexpr uint16_t ONEWIRE_TIME_PRESENCE_HIGH_MAX = 9999; //

static constexpr uint16_t ONEWIRE_TIME_SLOT_MAX = 240; // should be 120, was ~1050
static constexpr uint16_t ONEWIRE_TIME_SLOT_MAX = 999; // should be 120, was ~1050

// read and write from the viewpoint of the slave!!!!
static constexpr uint16_t ONEWIRE_TIME_READ_ONE_LOW_MAX = 60; //
Expand Down
2 changes: 1 addition & 1 deletion src/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ void sei(void);
#endif


#ifdef ARDUINO_attiny // Test to make it work on tiny85
#ifdef ARDUINO_attiny // Test to make it work on aTtiny85, 8MHz

#include "inttypes.h"

Expand Down

0 comments on commit 93d8bdd

Please sign in to comment.