Initial support for MonteOps's fixed hardware platform (#2582)

* Initial support for MonteOps's fixed hardware platform

* Update platformio env config + cleanup

* Fix platformio build

* Fix platformio build

* Fix wrong definition logic for NCP5623

* Fix another wrong definition logic for NCP5623, it's not board feature

* Fix wrong definition logic for NCP5623 in External Notification code, it's not board feature

* We need for CI magic here

* Another fix related to NCP5623

* Fix cosmetic issue with redifined variable

* Fix typo

* Cleanup and update defs for HW1

* Fix OEM RAK4631

* Fix AQ sensor reading

* Fix AQ sensor reading (better variant)

* Fix build for other nRF52 devices

* Replace HAS_EINK_RAK to RAK_4631
This commit is contained in:
Dmitry Galenko
2023-07-03 16:34:32 +02:00
committed by GitHub
parent b9ad274104
commit 9c141919f6
14 changed files with 340 additions and 23 deletions

View File

@@ -33,7 +33,9 @@ class ScanI2C
PMSA0031,
MPU6050,
LIS3DH,
#ifdef HAS_NCP5623
NCP5623,
#endif
} DeviceType;
// typedef uint8_t DeviceAddress;
@@ -95,4 +97,4 @@ class ScanI2C
private:
bool shouldSuppressScreen = false;
};
};

View File

@@ -212,9 +212,10 @@ void ScanI2CTwoWire::scanPort(I2CPort port)
}
break;
SCAN_SIMPLE_CASE(ST7567_ADDRESS, SCREEN_ST7567, "st7567 display found\n")
SCAN_SIMPLE_CASE(ST7567_ADDRESS, SCREEN_ST7567, "st7567 display found\n");
#ifdef HAS_NCP5623
SCAN_SIMPLE_CASE(NCP5623_ADDR, NCP5623, "NCP5623 RGB LED found\n");
#endif
#ifdef HAS_PMU
SCAN_SIMPLE_CASE(XPOWERS_AXP192_AXP2101_ADDRESS, PMU_AXP192_AXP2101, "axp192/axp2101 PMU found\n")
#endif
@@ -305,4 +306,4 @@ TwoWire *ScanI2CTwoWire::fetchI2CBus(ScanI2C::DeviceAddress address) const
size_t ScanI2CTwoWire::countDevices() const
{
return foundDevices.size();
}
}

View File

@@ -1,6 +1,6 @@
#include "../configuration.h"
#ifdef RAK4630
#ifdef RAK_4631
#include "../main.h"
#include <SPI.h>
@@ -64,4 +64,4 @@ void scanEInkDevice(void)
LOG_DEBUG("EInk display not found\n");
SPI1.end();
}
#endif
#endif

View File

@@ -1,6 +1,6 @@
#include "main.h"
#ifdef RAK4630
#ifdef HAS_NCP5623
#include <NCP5623.h>
extern NCP5623 rgb;

View File

@@ -261,10 +261,11 @@ void setup()
#endif
#ifdef RAK4630
#ifdef PIN_3V3_EN
// We need to enable 3.3V periphery in order to scan it
pinMode(PIN_3V3_EN, OUTPUT);
digitalWrite(PIN_3V3_EN, HIGH);
#endif
#ifndef USE_EINK
// RAK-12039 set pin for Air quality sensor
pinMode(AQ_SET_PIN, OUTPUT);
@@ -352,17 +353,18 @@ void setup()
pmu_found = i2cScanner->exists(ScanI2C::DeviceType::PMU_AXP192_AXP2101);
/*
* There are a bunch of sensors that have no further logic than to be found and stuffed into the
* nodeTelemetrySensorsMap singleton. This wraps that logic in a temporary scope to declare the temporary field
* "found".
*/
/*
* There are a bunch of sensors that have no further logic than to be found and stuffed into the
* nodeTelemetrySensorsMap singleton. This wraps that logic in a temporary scope to declare the temporary field
* "found".
*/
// Only one supported RGB LED currently
// Only one supported RGB LED currently
#ifdef HAS_NCP5623
rgb_found = i2cScanner->find(ScanI2C::DeviceType::NCP5623);
// Start the RGB LED at 50%
#ifdef RAK4630
// Start the RGB LED at 50%
if (rgb_found.type == ScanI2C::NCP5623) {
rgb.begin();
rgb.setCurrent(10);

View File

@@ -10,7 +10,7 @@
#include "main.h"
#ifdef RAK4630
#ifdef HAS_NCP5623
#include <graphics/RAKled.h>
NCP5623 rgb;
@@ -84,7 +84,7 @@ int32_t ExternalNotificationModule::runOnce()
millis()) {
getExternal(2) ? setExternalOff(2) : setExternalOn(2);
}
#ifdef RAK4630
#ifdef HAS_NCP5623
if (rgb_found.type == ScanI2C::NCP5623) {
green = (green + 50) % 255;
red = abs(red - green) % 255;
@@ -127,7 +127,7 @@ void ExternalNotificationModule::setExternalOn(uint8_t index)
digitalWrite(output, (moduleConfig.external_notification.active ? true : false));
break;
}
#ifdef RAK4630
#ifdef HAS_NCP5623
if (rgb_found.type == ScanI2C::NCP5623) {
rgb.setColor(red, green, blue);
}
@@ -153,7 +153,7 @@ void ExternalNotificationModule::setExternalOff(uint8_t index)
break;
}
#ifdef RAK4630
#ifdef HAS_NCP5623
if (rgb_found.type == ScanI2C::NCP5623) {
red = 0;
green = 0;
@@ -235,7 +235,7 @@ ExternalNotificationModule::ExternalNotificationModule()
LOG_INFO("Using Pin %i in PWM mode\n", config.device.buzzer_gpio);
}
}
#ifdef RAK4630
#ifdef HAS_NCP5623
if (rgb_found.type == ScanI2C::NCP5623) {
rgb.begin();
rgb.setCurrent(10);

View File

@@ -170,8 +170,11 @@ void cpuDeepSleep(uint32_t msecToWake)
Serial1.end();
#endif
setBluetoothEnable(false);
#ifdef RAK4630
#ifdef PIN_3V3_EN
digitalWrite(PIN_3V3_EN, LOW);
#endif
#ifndef USE_EINK
// RAK-12039 set pin for Air quality sensor
digitalWrite(AQ_SET_PIN, LOW);