Skip to content

Commit

Permalink
adding flag
Browse files Browse the repository at this point in the history
  • Loading branch information
snhobbs committed Jun 5, 2024
1 parent 9f26db6 commit 191ab13
Show file tree
Hide file tree
Showing 3 changed files with 492 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/Modbus/DataStores/RegisterDataStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ class UpdatingRegisterDataStore : public RegisterDataStore {
UpdatingRegisterDataStore(uint16_t* data, const size_t length, bool* flags) :
RegisterDataStore{data, length}, flags_{flags, length}{}

bool flag_set(const std::size_t address) const {
return flags_.first[std::min(address, flags_.second-1)];
}

void set_register_callback(std::size_t address, uint16_t) {
flags_.first[GetIndex(address)] = true;
}
Expand Down
Loading

0 comments on commit 191ab13

Please sign in to comment.