MCPcopy Create free account
hub / github.com/bmorcelli/Launcher / _setup_gpio

Function _setup_gpio

boards/reaper/interface.cpp:55–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53BQ27220 bq;
54
55void _setup_gpio() {
56
57 pinMode(UP_BTN, INPUT_PULLUP); // Sets the power btn as an INPUT
58 pinMode(SEL_BTN, INPUT_PULLUP);
59 pinMode(DW_BTN, INPUT_PULLUP);
60 pinMode(R_BTN, INPUT_PULLUP);
61 pinMode(L_BTN, INPUT_PULLUP);
62 pinMode(ESC_BTN, INPUT_PULLUP);
63
64 pinMode(CC1101_SS_PIN, OUTPUT);
65 pinMode(NRF24_SS_PIN, OUTPUT);
66 pinMode(SS, OUTPUT); /// NFC PIN
67 digitalWrite(CC1101_SS_PIN, HIGH);
68 digitalWrite(NRF24_SS_PIN, HIGH);
69 digitalWrite(SS, HIGH);
70
71 // Starts SPI instance for CC1101 and NRF24 with CS pins blocking communication at start
72
73 pinMode(TFT_CS, OUTPUT);
74 digitalWrite(TFT_CS, HIGH);
75 pinMode(SDCARD_CS, OUTPUT);
76 digitalWrite(SDCARD_CS, HIGH);
77
78 Wire.setPins(GROVE_SDA, GROVE_SCL);
79 // Wire.begin();
80 // bruceConfig.rfModule = CC1101_SPI_MODULE;
81 // bruceConfig.irRx = RXLED;
82 // bruceConfig.irTx = LED;
83 Wire.begin(GROVE_SDA, GROVE_SCL);
84
85 bool pmu_ret = false;
86 pmu_ret = PPM.init(Wire, GROVE_SDA, GROVE_SCL, BQ25896_SLAVE_ADDRESS);
87 if (pmu_ret) {
88
89 PPM.setSysPowerDownVoltage(3300);
90 PPM.setInputCurrentLimit(2000);
91 Serial.printf("getInputCurrentLimit: %d mA\n", PPM.getInputCurrentLimit());
92 PPM.disableCurrentLimitPin();
93 PPM.setChargeTargetVoltage(4208);
94 PPM.setPrechargeCurr(64);
95 PPM.setChargerConstantCurr(832);
96 PPM.getChargerConstantCurr();
97 Serial.printf("getChargerConstantCurr: %d mA\n", PPM.getChargerConstantCurr());
98 PPM.enableMeasure(PowersBQ25896::CONTINUOUS);
99
100 PPM.disableOTG();
101 // PPM.enableInputDetection();
102 PPM.enableCharge();
103 }
104 if (bq.getDesignCap() != BATTERY_DESIGN_CAPACITY) { bq.setDesignCap(BATTERY_DESIGN_CAPACITY); }
105}
106
107/***************************************************************************************
108** Function name: getBattery()

Callers

nothing calls this directly

Calls 3

getDesignCapMethod · 0.80
setDesignCapMethod · 0.80
beginMethod · 0.45

Tested by

no test coverage detected