Skip to content
Snippets Groups Projects
Commit 121acb75 authored by Pietro Bortolus's avatar Pietro Bortolus
Browse files

[ND015X] changed variable declaration

the SPIDataIn and SPIDataOut varaibles are now
declared in the sampleimpl function rather than as
a member variable
parent 3b5f4dde
No related branches found
No related tags found
No related merge requests found
...@@ -88,7 +88,7 @@ void ND015A::setNotch(NotchEnable ntc) ...@@ -88,7 +88,7 @@ void ND015A::setNotch(NotchEnable ntc)
ND015XData ND015A::sampleImpl() ND015XData ND015A::sampleImpl()
{ {
ND015XData data; ND015XData data;
SPIDataOut = (modeByte << 8) | rateByte; uint16_t SPIDataOut = (modeByte << 8) | rateByte;
SPITransaction spi(slave); SPITransaction spi(slave);
...@@ -96,7 +96,7 @@ ND015XData ND015A::sampleImpl() ...@@ -96,7 +96,7 @@ ND015XData ND015A::sampleImpl()
// reading the data to make sure the proper // reading the data to make sure the proper
// settings are used // settings are used
SPIDataIn = spi.transfer16(SPIDataOut); uint16_t SPIDataIn = spi.transfer16(SPIDataOut);
data.pressure = data.pressure =
((short)SPIDataIn - 0.05 * pow(2, 16)) / (0.9 * pow(2, 16)) * 15; ((short)SPIDataIn - 0.05 * pow(2, 16)) / (0.9 * pow(2, 16)) * 15;
......
...@@ -111,8 +111,6 @@ private: ...@@ -111,8 +111,6 @@ private:
SPISlave slave; SPISlave slave;
uint8_t modeByte = 0xF7; // settings for the mode control register uint8_t modeByte = 0xF7; // settings for the mode control register
uint8_t rateByte = 0x1C; // settings for the rate control register uint8_t rateByte = 0x1C; // settings for the rate control register
uint16_t SPIDataIn;
uint16_t SPIDataOut;
enum RegisterMask : uint8_t enum RegisterMask : uint8_t
{ {
......
...@@ -123,7 +123,7 @@ void ND015D::setNotch(NotchEnable ntc) ...@@ -123,7 +123,7 @@ void ND015D::setNotch(NotchEnable ntc)
ND015XData ND015D::sampleImpl() ND015XData ND015D::sampleImpl()
{ {
ND015XData data; ND015XData data;
SPIDataOut = (modeByte << 8) | rateByte; uint16_t SPIDataOut = (modeByte << 8) | rateByte;
SPITransaction spi(slave); SPITransaction spi(slave);
...@@ -131,7 +131,7 @@ ND015XData ND015D::sampleImpl() ...@@ -131,7 +131,7 @@ ND015XData ND015D::sampleImpl()
// reading the data to make sure the proper // reading the data to make sure the proper
// settings are used // settings are used
SPIDataIn = spi.transfer16(SPIDataOut); uint16_t SPIDataIn = spi.transfer16(SPIDataOut);
data.pressure = (short)SPIDataIn / (0.9 * pow(2, 15)) * range; data.pressure = (short)SPIDataIn / (0.9 * pow(2, 15)) * range;
data.pressureTimestamp = TimestampTimer::getTimestamp(); data.pressureTimestamp = TimestampTimer::getTimestamp();
......
...@@ -113,8 +113,6 @@ private: ...@@ -113,8 +113,6 @@ private:
SPISlave slave; SPISlave slave;
uint8_t modeByte = 0xF3; // settings for the mode control register uint8_t modeByte = 0xF3; // settings for the mode control register
uint8_t rateByte = 0x1C; // settings for the rate control register uint8_t rateByte = 0x1C; // settings for the rate control register
uint16_t SPIDataIn;
uint16_t SPIDataOut;
short range = 1; short range = 1;
enum RegisterMask : uint8_t enum RegisterMask : uint8_t
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment