Skip to content

Commit

Permalink
Change config parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
GOB52 committed Sep 12, 2024
1 parent 69bc05d commit de6fd37
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/unit/unit_ADS1113.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace unit {
@brief ADS1113 unit
*/
class UnitADS1113 : public UnitADS111x {
M5_UNIT_COMPONENT_HPP_BUILDER(UnitADS1113, 0x00F);
M5_UNIT_COMPONENT_HPP_BUILDER(UnitADS1113, 0x00);

public:
explicit UnitADS1113(const uint8_t addr = DEFAULT_ADDRESS) : UnitADS111x(addr) {
Expand Down
7 changes: 4 additions & 3 deletions src/unit/unit_ADS111x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ const types::uid_t UnitADS111x::uid{"UnitADS111x"_mmh3};
const types::uid_t UnitADS111x::attr{0};

bool UnitADS111x::begin() {
assert(_cfg.stored_size && "stored_size must be greater than zero");
if (_cfg.stored_size != _data->capacity()) {
_data.reset(new m5::container::CircularBuffer<Data>(_cfg.stored_size));
auto ssize = stored_size();
assert(ssize && "stored_size must be greater than zero");
if (ssize != _data->capacity()) {
_data.reset(new m5::container::CircularBuffer<Data>(ssize));
if (!_data) {
M5_LIB_LOGE("Failed to allocate");
return false;
Expand Down
3 changes: 3 additions & 0 deletions src/unit/unit_ADS111x.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ class UnitADS111x : public Component, public PeriodicMeasurementAdapter<UnitADS1

explicit UnitADS111x(const uint8_t addr = DEFAULT_ADDRESS)
: Component(addr), _data{new m5::container::CircularBuffer<ads111x::Data>(1)} {
auto ccfg = component_config();
ccfg.clock = 400 * 1000U;
component_config(ccfg);
}
virtual ~UnitADS111x() {
}
Expand Down

0 comments on commit de6fd37

Please sign in to comment.