MCPcopy Create free account
hub / github.com/BruceDevices/firmware / _setup_gpio

Function _setup_gpio

boards/smoochiee-board/interface.cpp:16–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14#endif
15
16void _setup_gpio() {
17
18 pinMode(UP_BTN, INPUT); // Sets the power btn as an INPUT
19 pinMode(SEL_BTN, INPUT);
20 pinMode(DW_BTN, INPUT);
21 pinMode(R_BTN, INPUT);
22 pinMode(L_BTN, INPUT);
23
24 pinMode(CC1101_SS_PIN, OUTPUT);
25 pinMode(NRF24_SS_PIN, OUTPUT);
26
27 digitalWrite(CC1101_SS_PIN, HIGH);
28 digitalWrite(NRF24_SS_PIN, HIGH);
29 // Starts SPI instance for CC1101 and NRF24 with CS pins blocking communication at start
30
31 bruceConfigPins.rfModule = CC1101_SPI_MODULE;
32 bruceConfigPins.irRx = RXLED;
33 Wire.setPins(GROVE_SDA, GROVE_SCL);
34 // Wire.begin();
35 bool pmu_ret = false;
36 Wire.begin(GROVE_SDA, GROVE_SCL);
37 pmu_ret = PPM.init(Wire, GROVE_SDA, GROVE_SCL, BQ25896_SLAVE_ADDRESS);
38 if (pmu_ret) {
39 PPM.setSysPowerDownVoltage(3300);
40 PPM.setInputCurrentLimit(3250);
41 Serial.printf("getInputCurrentLimit: %d mA\n", PPM.getInputCurrentLimit());
42 PPM.disableCurrentLimitPin();
43 PPM.setChargeTargetVoltage(4208);
44 PPM.setPrechargeCurr(64);
45 PPM.setChargerConstantCurr(832);
46 PPM.getChargerConstantCurr();
47 Serial.printf("getChargerConstantCurr: %d mA\n", PPM.getChargerConstantCurr());
48 PPM.enableMeasure(PowersBQ25896::CONTINUOUS);
49 PPM.disableOTG();
50 PPM.enableCharge();
51 }
52}
53bool isCharging() {
54 // PPM.disableBatterPowerPath();
55 return PPM.isCharging();

Callers

nothing calls this directly

Calls 4

setPinsMethod · 0.80
beginMethod · 0.45
initMethod · 0.45
printfMethod · 0.45

Tested by

no test coverage detected