Skip to content

Commit

Permalink
add softRest() method
Browse files Browse the repository at this point in the history
makes for more reliable warm restart without retries
  • Loading branch information
Michael Haberler committed Jun 5, 2024
1 parent c7636d6 commit 47c1624
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/Dps3xx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,9 @@ int16_t Dps3xx::flushFIFO()
{
return writeByteBitfield(1U, registers[FIFO_FL]);
}


int16_t Dps3xx::softReset()
{
return writeByteBitfield(0x09, registers[SOFT_RST]);
}
1 change: 1 addition & 0 deletions src/Dps3xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Dps3xx : public DpsClass
* @return status code
*/
int16_t setInterruptSources(uint8_t intr_source, uint8_t polarity = 1);
int16_t softReset();

protected:
uint8_t m_tempSensor;
Expand Down
4 changes: 3 additions & 1 deletion src/util/dps3xx_config.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef DPS3xx_CONFIG_H_
#define DPS3xx_CONFIG_H_

#define DPS3xx_NUM_OF_REGMASKS 16
#define DPS3xx_NUM_OF_REGMASKS 17

enum Interrupt_source_3xx_e
{
Expand All @@ -28,6 +28,7 @@ namespace dps3xx
FIFO_FULL, // FIFO full
INT_HL,
INT_SEL, // interrupt select
SOFT_RST // soft reset
};

const RegMask_t registers[DPS3xx_NUM_OF_REGMASKS] = {
Expand All @@ -42,6 +43,7 @@ namespace dps3xx
{0x0B, 0x02, 1}, // FIFO_FULL
{0x09, 0x80, 7}, // INT_HL
{0x09, 0x70, 4}, // INT_SEL
{0x0C, 0x09, 0}, // SOFT_RST
};

const RegBlock_t coeffBlock = {0x10, 18};
Expand Down

0 comments on commit 47c1624

Please # to comment.