Skip to content

Commit

Permalink
define rename
Browse files Browse the repository at this point in the history
  • Loading branch information
pilotak committed Aug 23, 2018
1 parent faf4c56 commit c3e0f77
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions MCP342X.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,13 @@ int32_t MCP342X::read(uint8_t channel) {
timer.start();

while (isConversionFinished(channel) == 1) {
if (timer.read_ms() >= DEFAULT_TIMEOUT) {
if (timer.read_ms() >= MCP342X_DEFAULT_TIMEOUT) {
timer.stop();
debug("ADC timeout\n");
return 0;
}
}



switch (resolution) {
case _12bit: {
int16_t tmp = ((_Buffer[0] << 8) | _Buffer[1]);
Expand Down
6 changes: 3 additions & 3 deletions MCP342X.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ Edited for mbed by www.github.com/pilotak

#include "mbed.h"

#define DEFAULT_ADDRESS 0x68 << 1
#define DEFAULT_TIMEOUT 100 // ms
#define MCP342X_DEFAULT_ADDRESS 0x68 << 1
#define MCP342X_DEFAULT_TIMEOUT 100 // ms

class MCP342X {
public:
Expand All @@ -52,7 +52,7 @@ class MCP342X {
_18bit
} Resolution;

explicit MCP342X(uint8_t slave_adr = DEFAULT_ADDRESS);
explicit MCP342X(uint8_t slave_adr = MCP342X_DEFAULT_ADDRESS);
virtual ~MCP342X(void);
void init(I2C * i2c_obj);
bool config(uint8_t channel, Resolution res = _12bit, Conversion mode = Continuous, PGA gain = x1);
Expand Down

0 comments on commit c3e0f77

Please sign in to comment.