mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-08 05:31:25 +00:00
Initial implementation of I2C
This commit is contained in:
parent
423b8ad603
commit
14d03a2bda
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
#include "concurrency/LockGuard.h"
|
#include "concurrency/LockGuard.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
|
#if defined(ARCH_RASPBERRY_PI)
|
||||||
|
#include "linux/LinuxHardwareI2C.h"
|
||||||
|
#endif
|
||||||
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
||||||
#include "main.h" // atecc
|
#include "main.h" // atecc
|
||||||
#endif
|
#endif
|
||||||
@ -162,7 +164,14 @@ void ScanI2CTwoWire::scanPort(I2CPort port)
|
|||||||
|
|
||||||
for (addr.address = 1; addr.address < 127; addr.address++) {
|
for (addr.address = 1; addr.address < 127; addr.address++) {
|
||||||
i2cBus->beginTransmission(addr.address);
|
i2cBus->beginTransmission(addr.address);
|
||||||
|
#ifdef ARCH_PORTDUINO
|
||||||
|
if (i2cBus->read() != -1)
|
||||||
|
err = 0;
|
||||||
|
else
|
||||||
|
err = 2;
|
||||||
|
#else
|
||||||
err = i2cBus->endTransmission();
|
err = i2cBus->endTransmission();
|
||||||
|
#endif
|
||||||
type = NONE;
|
type = NONE;
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
LOG_DEBUG("I2C device found at address 0x%x\n", addr.address);
|
LOG_DEBUG("I2C device found at address 0x%x\n", addr.address);
|
||||||
|
@ -1564,7 +1564,7 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
|
|||||||
// Jm
|
// Jm
|
||||||
void DebugInfo::drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
void DebugInfo::drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||||
{
|
{
|
||||||
#if HAS_WIFI
|
#if HAS_WIFI && !defined(ARCH_RASPBERRY_PI)
|
||||||
const char *wifiName = config.network.wifi_ssid;
|
const char *wifiName = config.network.wifi_ssid;
|
||||||
|
|
||||||
display->setFont(FONT_SMALL);
|
display->setFont(FONT_SMALL);
|
||||||
|
@ -68,6 +68,7 @@ NRF52Bluetooth *nrf52Bluetooth;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ARCH_RASPBERRY_PI
|
#ifdef ARCH_RASPBERRY_PI
|
||||||
|
#include "linux/LinuxHardwareI2C.h"
|
||||||
#include "platform/portduino/PortduinoGlue.h"
|
#include "platform/portduino/PortduinoGlue.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -16,4 +16,4 @@
|
|||||||
#endif
|
#endif
|
||||||
#ifndef HAS_TELEMETRY
|
#ifndef HAS_TELEMETRY
|
||||||
#define HAS_TELEMETRY 1
|
#define HAS_TELEMETRY 1
|
||||||
#endif
|
#endif
|
@ -1,5 +1,6 @@
|
|||||||
#if defined(ARCH_RASPBERRY_PI)
|
#if defined(ARCH_RASPBERRY_PI)
|
||||||
#define NO_SCREEN
|
#define HAS_WIRE 1
|
||||||
|
#define HAS_SCREEN 1
|
||||||
|
|
||||||
#else // Pine64 mode.
|
#else // Pine64 mode.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user