target.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #pragma once
  2. #define RADIOLIB_STATIC_ONLY 1
  3. #include <RadioLib.h>
  4. #include <helpers/radiolib/RadioLibWrappers.h>
  5. #include <helpers/stm32/STM32Board.h>
  6. #include <helpers/radiolib/CustomSTM32WLxWrapper.h>
  7. #include <helpers/ArduinoHelpers.h>
  8. #include <helpers/SensorManager.h>
  9. #define PIN_VBAT_READ A0
  10. #define ADC_MULTIPLIER (5 * 1.73 * 1000)
  11. class RAK3x72Board : public STM32Board {
  12. public:
  13. const char* getManufacturerName() const override {
  14. return "RAK 3x72";
  15. }
  16. uint16_t getBattMilliVolts() override {
  17. analogReadResolution(12);
  18. uint32_t raw = 0;
  19. for (int i=0; i<8;i++) {
  20. raw += analogRead(PIN_VBAT_READ);
  21. }
  22. return ((double)raw) * ADC_MULTIPLIER / 8 / 4096;
  23. }
  24. };
  25. extern RAK3x72Board board;
  26. extern WRAPPER_CLASS radio_driver;
  27. extern VolatileRTCClock rtc_clock;
  28. extern SensorManager sensors;
  29. bool radio_init();
  30. uint32_t radio_get_rng_seed();
  31. void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr);
  32. void radio_set_tx_power(uint8_t dbm);
  33. mesh::LocalIdentity radio_new_identity();