Skip to content

Commit 3396b0e

Browse files
committed
Nicla Sense: Remove dangerous CD operations
1 parent 79b31d9 commit 3396b0e

File tree

2 files changed

+0
-25
lines changed

2 files changed

+0
-25
lines changed

libraries/Nicla_System/src/Nicla_System.cpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,6 @@ bool nicla::begin()
3636
return true;
3737
}
3838

39-
void nicla::enableCD()
40-
{
41-
pinMode(p25, OUTPUT);
42-
digitalWrite(p25, HIGH);
43-
}
44-
45-
void nicla::disableCD()
46-
{
47-
pinMode(p25, OUTPUT);
48-
digitalWrite(p25, LOW);
49-
}
50-
5139
/*
5240
LDO reg:
5341
| B7 | B6 | B5 | B4 | B3 | B2 | B1 | B0 |
@@ -68,49 +56,38 @@ void nicla::disableCD()
6856

6957
bool nicla::enable3V3LDO()
7058
{
71-
enableCD();
7259
uint8_t ldo_reg = 0xE4;
7360
_pmic.writeByte(BQ25120A_ADDRESS, BQ25120A_LDO_CTRL, ldo_reg);
7461
if (_pmic.readByte(BQ25120A_ADDRESS, BQ25120A_LDO_CTRL) != ldo_reg) {
75-
disableCD();
7662
return false;
7763
}
78-
disableCD();
7964
return true;
8065
}
8166

8267
bool nicla::enable1V8LDO()
8368
{
84-
enableCD();
8569
uint8_t ldo_reg = 0xA8;
8670
_pmic.writeByte(BQ25120A_ADDRESS, BQ25120A_LDO_CTRL, ldo_reg);
8771
if (_pmic.readByte(BQ25120A_ADDRESS, BQ25120A_LDO_CTRL) != ldo_reg) {
88-
disableCD();
8972
return false;
9073
}
91-
disableCD();
9274
return true;
9375
}
9476

9577
bool nicla::disableLDO()
9678
{
97-
enableCD();
9879
uint8_t ldo_reg = _pmic.readByte(BQ25120A_ADDRESS, BQ25120A_LDO_CTRL);
9980
ldo_reg &= 0x7F;
10081
_pmic.writeByte(BQ25120A_ADDRESS, BQ25120A_LDO_CTRL, ldo_reg);
10182
if (_pmic.readByte(BQ25120A_ADDRESS, BQ25120A_LDO_CTRL) != ldo_reg) {
102-
disableCD();
10383
return false;
10484
}
105-
disableCD();
10685
return true;
10786
}
10887

10988
uint8_t nicla::readLDOreg()
11089
{
111-
enableCD();
11290
uint8_t ldo_reg = _pmic.readByte(BQ25120A_ADDRESS, BQ25120A_LDO_CTRL);
113-
disableCD();
11491
return ldo_reg;
11592
}
11693

libraries/Nicla_System/src/Nicla_System.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ class nicla {
2727

2828
private:
2929
static void pingI2CThd();
30-
static void enableCD();
31-
static void disableCD();
3230
static uint8_t readLDOreg();
3331
static rtos::Mutex i2c_mutex;
3432
};

0 commit comments

Comments
 (0)