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

Function _setup_gpio

boards/m5stack-sticks3/interface.cpp:57–94  ·  view source on GitHub ↗

** Function name: _setup_gpio() ** Location: main.cpp ** Description: initial setup for the device ***************************************************************************************/

Source from the content-addressed store, hash-verified

55** Description: initial setup for the device
56***************************************************************************************/
57void _setup_gpio() {
58 M5.begin();
59 Wire1.begin(47, 48);
60
61 pinMode(SEL_BTN, INPUT);
62 pinMode(DW_BTN, INPUT);
63
64 M5.Power.setExtOutput(false); // It buzzes it ext power is turned on
65
66 /*
67| Device | SCK | MISO | MOSI | CS | GDO0/CE |
68| --- | :---: | :---: | :---: | :---: | :---: |
69| SD Card | 5 | 4 | 6 | 7 | --- |
70| CC1101 | 5 | 4 | 6 | 2 | 3 |
71| NRF24 | 5 | 4 | 6 | 8 | 1 |
72| PN532 | 5 | 4 | 6 | 43 | -- |
73| WS500 | 5 | 4 | 6 | ** | ** |
74| LoRa | 5 | 4 | 6 | ** | ** |
75 */
76 pinMode(7, OUTPUT);
77 digitalWrite(7, HIGH); // SD Card CS
78 pinMode(2, OUTPUT);
79 digitalWrite(2, HIGH); // CC1101 CS
80 pinMode(8, OUTPUT);
81 digitalWrite(8, HIGH); // nRF24L01 CS
82 pinMode(43, OUTPUT);
83 digitalWrite(43, HIGH); // PN532 CS
84 pinMode(9, OUTPUT);
85 digitalWrite(9, LOW); // M5RF433 avoid Jamming
86 pinMode(46, OUTPUT);
87 digitalWrite(46, LOW); // Infrared LED Off
88
89 pinMode(SEL_BTN, INPUT_PULLUP);
90 pinMode(DW_BTN, INPUT_PULLUP);
91 attachInterrupt(DW_BTN, isr_dw_btn, CHANGE);
92 pinMode(TFT_BL, OUTPUT);
93 bruceConfig.colorInverted = 0;
94}
95/***************************************************************************************
96** Function name: _post_setup_gpio()
97** Location: main.cpp

Callers

nothing calls this directly

Calls 1

beginMethod · 0.45

Tested by

no test coverage detected