mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-09-29 05:17:33 +00:00
Updated debug printing for raspi + added persistent_open setting for raspi spi
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
|
||||
namespace sta
|
||||
{
|
||||
class RaspiGpioPin : GpioPin
|
||||
class RaspiGpioPin : public GpioPin
|
||||
{
|
||||
public:
|
||||
enum class GpioMode {
|
||||
@@ -31,18 +31,18 @@ namespace sta
|
||||
|
||||
void setState(GpioPinState state) override;
|
||||
|
||||
static RaspiGpioPin DUMMY_GPIO;
|
||||
static RaspiGpioPin * DUMMY_GPIO;
|
||||
|
||||
private:
|
||||
uint8_t pin_;
|
||||
GpioMode mode_;
|
||||
};
|
||||
|
||||
class DummyGpioPin : RaspiGpioPin {
|
||||
class DummyGpioPin : public RaspiGpioPin {
|
||||
DummyGpioPin();
|
||||
|
||||
void setState(GpioPinState state) override;
|
||||
}
|
||||
};
|
||||
} // namespace sta
|
||||
|
||||
#endif // STA_RASPI_GPIO_ENABLED
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define STA_CORE_RASPI_HAL_HPP
|
||||
|
||||
#include <wiringPi.h>
|
||||
#include <wiringPiI2C.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#endif //STA_CORE_RASPI_HAL_HPP
|
||||
|
13
include/sta/raspi/mcu/common.hpp
Normal file
13
include/sta/raspi/mcu/common.hpp
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief Common configuration for Raspberry Pi MCUs
|
||||
*/
|
||||
#ifndef STA_CORE_RASPI_MCU_COMMON_HPP
|
||||
#define STA_CORE_RASPI_MCU_COMMON_HPP
|
||||
|
||||
#define STA_MCU_LITTLE_ENDIAN
|
||||
|
||||
// Enable STM32 platform
|
||||
#define STA_PLATFORM_RASPI
|
||||
|
||||
#endif // STA_CORE_RASPI_MCU_COMMON_HPP
|
@@ -9,10 +9,15 @@
|
||||
|
||||
namespace sta
|
||||
{
|
||||
enum class SPINode {
|
||||
DEV_0_0,
|
||||
DEV_0_1
|
||||
};
|
||||
|
||||
class RaspiSPI : public SPI
|
||||
{
|
||||
public:
|
||||
RaspiSPI(const char * dev, const SPISettings & settings, Mutex * mutex = nullptr);
|
||||
RaspiSPI(SPINode node, const SPISettings & settings, Mutex * mutex = nullptr, bool persistent_open = true);
|
||||
~RaspiSPI();
|
||||
|
||||
void transfer(uint8_t value) override;
|
||||
@@ -30,18 +35,17 @@ namespace sta
|
||||
char * spidev_;
|
||||
int spifd_;
|
||||
bool open_;
|
||||
const bool persistent_open_;
|
||||
|
||||
void update_setting(int setting, int value);
|
||||
int get_setting(int setting, void * rslt_ptr);
|
||||
void update_settings();
|
||||
};
|
||||
|
||||
class RaspiSPIDevice : SPIDevice
|
||||
class RaspiSPIDevice : public SPIDevice
|
||||
{
|
||||
public:
|
||||
RaspiSPIDevice(RaspiSPI * intf);
|
||||
|
||||
void select() override;
|
||||
|
||||
void deselect() override;
|
||||
};
|
||||
} // namespace sta
|
||||
|
||||
|
Reference in New Issue
Block a user