sforkowany z mirror/meshtastic-firmware
cubecell WIP
rodzic
5915669f6f
commit
1c63a70673
|
@ -0,0 +1,6 @@
|
|||
|
||||
https://heltec-automation-docs.readthedocs.io/en/latest/cubecell/index.html
|
||||
|
||||
https://github.com/HelTecAutomation/ASR650x-Arduino?utm_source=platformio.org&utm_medium=docs
|
||||
|
||||
* Either portfreertos or make not theaded versions of Lock, WorkerThread, Queue (probably the latter).
|
|
@ -9,7 +9,7 @@
|
|||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[platformio]
|
||||
default_envs = tbeam ; Note: the github actions CI test build can't yet build NRF52 targets
|
||||
default_envs = cubecellplus ; Note: the github actions CI test build can't yet build NRF52 targets
|
||||
|
||||
[common]
|
||||
; common is not currently used
|
||||
|
@ -123,6 +123,16 @@ board = ttgo-lora32-v1
|
|||
build_flags =
|
||||
${esp32_base.build_flags} -D TTGO_LORA_V2
|
||||
|
||||
; The Heltec Cubecell plus
|
||||
[env:cubecellplus]
|
||||
platform = https://github.com/HelTecAutomation/platform-asrmicro650x.git ; we use top-of-tree because stable version has too many bugs - asrmicro650x
|
||||
framework = arduino
|
||||
board = cubecell_board_plus
|
||||
; FIXME, bug in cubecell arduino - they are supposed to set ARDUINO
|
||||
build_flags = ${env.build_flags} -DARDUINO=100
|
||||
src_filter =
|
||||
${env.src_filter} -<esp32/>
|
||||
|
||||
; Common settings for NRF52 based targets
|
||||
[nrf52_base]
|
||||
platform = nordicnrf52
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "WorkerThread.h"
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef configUSE_PREEMPTION
|
||||
|
||||
void Thread::start(const char *name, size_t stackSize, uint32_t priority)
|
||||
{
|
||||
auto r = xTaskCreate(callRun, name, stackSize, this, priority, &taskHandle);
|
||||
|
@ -35,3 +37,5 @@ void NotifiedWorkerThread::block()
|
|||
xTaskNotifyWait(0, // don't clear notification on entry
|
||||
clearOnRead, ¬ification, portMAX_DELAY); // Wait forever
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,5 +1,8 @@
|
|||
#include <Arduino.h>
|
||||
|
||||
// FIXME - ugly check to see if we have freertos
|
||||
#ifdef configUSE_PREEMPTION
|
||||
|
||||
class Thread
|
||||
{
|
||||
protected:
|
||||
|
@ -86,4 +89,6 @@ class NotifiedWorkerThread : public WorkerThread
|
|||
* A method that should block execution - either waiting ona queue/mutex or a "task notification"
|
||||
*/
|
||||
virtual void block();
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
|
@ -73,6 +73,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define BUTTON_PIN PIN_BUTTON1
|
||||
|
||||
// FIXME, use variant.h defs for all of this!!! (even on the ESP32 targets)
|
||||
#elif defined(CubeCell_BoardPlus)
|
||||
|
||||
//
|
||||
// Standard definitions for CubeCell targets
|
||||
//
|
||||
|
||||
#define NO_ESP32 // Don't use ESP32 libs (mainly bluetooth)
|
||||
|
||||
// We bind to the GPS using variant.h instead for this platform (Serial1)
|
||||
|
||||
// FIXME, not yet ready for NRF52
|
||||
#define RTC_DATA_ATTR
|
||||
|
||||
#define LED_PIN PIN_LED1 // LED1 on nrf52840-DK
|
||||
#define BUTTON_PIN PIN_BUTTON1
|
||||
|
||||
#else
|
||||
|
||||
//
|
||||
|
@ -256,9 +272,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#define DEBUG_PORT console // Serial debug port
|
||||
|
||||
#ifdef NO_ESP32
|
||||
// What platforms should use SEGGER?
|
||||
#ifdef NRF52_SERIES
|
||||
#define USE_SEGGER
|
||||
#endif
|
||||
|
||||
#ifdef USE_SEGGER
|
||||
#include "SEGGER_RTT.h"
|
||||
#define DEBUG_MSG(...) SEGGER_RTT_printf(0, __VA_ARGS__)
|
||||
|
|
|
@ -9,8 +9,11 @@
|
|||
#include <freertos/semphr.h>
|
||||
#include <freertos/queue.h>
|
||||
#else
|
||||
// not yet supported on cubecell
|
||||
#ifndef CubeCell_BoardPlus
|
||||
#include <FreeRTOS.h>
|
||||
#include <task.h>
|
||||
#include <semphr.h>
|
||||
#include <queue.h>
|
||||
#endif
|
||||
#endif
|
15
src/lock.cpp
15
src/lock.cpp
|
@ -5,6 +5,7 @@
|
|||
namespace meshtastic
|
||||
{
|
||||
|
||||
#ifdef configUSE_PREEMPTION
|
||||
Lock::Lock()
|
||||
{
|
||||
handle = xSemaphoreCreateBinary();
|
||||
|
@ -21,6 +22,20 @@ void Lock::unlock()
|
|||
{
|
||||
assert(xSemaphoreGive(handle));
|
||||
}
|
||||
#else
|
||||
Lock::Lock()
|
||||
{
|
||||
}
|
||||
|
||||
void Lock::lock()
|
||||
{
|
||||
}
|
||||
|
||||
void Lock::unlock()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
LockGuard::LockGuard(Lock *lock) : lock(lock)
|
||||
{
|
||||
|
|
|
@ -25,7 +25,9 @@ class Lock
|
|||
void unlock();
|
||||
|
||||
private:
|
||||
#ifdef configUSE_PREEMPTION
|
||||
SemaphoreHandle_t handle;
|
||||
#endif
|
||||
};
|
||||
|
||||
// RAII lock guard.
|
||||
|
|
Ładowanie…
Reference in New Issue