| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #include "MeshtinyBoard.h"
- #include <Arduino.h>
- #include <Wire.h>
- #include <bluefruit.h>
- static BLEDfu bledfu;
- static void connect_callback(uint16_t conn_handle) {
- (void)conn_handle;
- MESH_DEBUG_PRINTLN("BLE client connected");
- }
- static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
- (void)conn_handle;
- (void)reason;
- MESH_DEBUG_PRINTLN("BLE client disconnected");
- }
- void MeshtinyBoard::begin() {
- NRF52BoardDCDC::begin();
- btn_prev_state = HIGH;
- pinMode(PIN_VBAT_READ, INPUT); // VBAT ADC input
- // Set all button pins to INPUT_PULLUP
- pinMode(PIN_BUTTON1, INPUT_PULLUP);
- pinMode(PIN_BUTTON2, INPUT_PULLUP);
- pinMode(PIN_BUTTON3, INPUT_PULLUP);
- pinMode(PIN_BUTTON4, INPUT_PULLUP);
- #if defined(PIN_WIRE_SDA) && defined(PIN_WIRE_SCL)
- Wire.setPins(PIN_WIRE_SDA, PIN_WIRE_SCL);
- #endif
- Wire.begin();
- pinMode(SX126X_POWER_EN, OUTPUT);
- digitalWrite(SX126X_POWER_EN, HIGH);
- delay(10); // give sx1262 some time to power up
- }
|