TImpulsePlusBoard.cpp 977 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include <Arduino.h>
  2. #include <Wire.h>
  3. #include "TImpulsePlusBoard.h"
  4. void TImpulsePlusBoard::begin() {
  5. NRF52BoardDCDC::begin();
  6. // turn on 3.3v
  7. pinMode(RT9080_EN, OUTPUT);
  8. digitalWrite(RT9080_EN, HIGH);
  9. delay(100);
  10. // init gps pins
  11. pinMode(GPS_EN, OUTPUT);
  12. digitalWrite(GPS_EN, HIGH); // gps off by default
  13. // configure battery measurement
  14. pinMode(BATTERY_ADC_DATA, INPUT);
  15. pinMode(BATTERY_MEASUREMENT_CONTROL, OUTPUT);
  16. digitalWrite(BATTERY_MEASUREMENT_CONTROL, LOW); // turn off battery voltage measurement
  17. // set the analog reference to 3.0V (default = 3.6V)
  18. analogReference(AR_INTERNAL_3_0);
  19. // set the resolution to 12-bit (0..4095)
  20. analogReadResolution(12); // Can be 8, 10, 12 or 14
  21. // configure user button
  22. pinMode(TTP223_KEY, INPUT_PULLDOWN);
  23. #if defined(PIN_WIRE_SDA) && defined(PIN_WIRE_SCL)
  24. Wire.setPins(PIN_WIRE_SDA, PIN_WIRE_SCL);
  25. #endif
  26. Wire.begin();
  27. delay(10); // give sx1262 some time to power up
  28. }