mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-08-05 18:21:54 +00:00
Added some buxfixes to spi code
This commit is contained in:
11
include/sta/config.hpp
Normal file
11
include/sta/config.hpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef STA_CONFIG
|
||||
#define STA_CONFIG
|
||||
|
||||
// Use the raspberry pi for this project.
|
||||
#include <sta/raspi/mcu/common.hpp>
|
||||
|
||||
// #define DEBUG
|
||||
#define STA_PRINTF_USE_STDLIB
|
||||
#define STA_DEBUG_PRINTF
|
||||
|
||||
#endif
|
@@ -70,14 +70,6 @@ namespace sta
|
||||
*/
|
||||
void print(uint32_t num, IntegerBase base = IntegerBase::DEC);
|
||||
|
||||
/**
|
||||
* @brief Print integer in selected base.
|
||||
*
|
||||
* @param num Integer
|
||||
* @param base Integer base
|
||||
*/
|
||||
void print(size_t num, IntegerBase base = IntegerBase::DEC);
|
||||
|
||||
/**
|
||||
* @brief Print c-string.
|
||||
*
|
||||
@@ -143,14 +135,6 @@ namespace sta
|
||||
*/
|
||||
void println(uint32_t num, IntegerBase base = IntegerBase::DEC);
|
||||
|
||||
/**
|
||||
* @brief Print integer in selected base followed by a new-line.
|
||||
*
|
||||
* @param num Integer
|
||||
* @param base Integer base
|
||||
*/
|
||||
void println(size_t num, IntegerBase base = IntegerBase::DEC);
|
||||
|
||||
/**
|
||||
* @brief Print c-string followed by a new-line.
|
||||
*
|
||||
|
44
include/sta/raspi/delay.hpp
Normal file
44
include/sta/raspi/delay.hpp
Normal file
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief Delay functions.
|
||||
*
|
||||
* Configuration:
|
||||
* * STA_RASPI_DELAY_US_TIM: 1 MHz TIM instance used by sta::delayUs
|
||||
*
|
||||
* NOTE: TIM time base must be started before use of sta::delayUs by calling sta::initHAL.
|
||||
* When using startup system task this is handled automatically.
|
||||
*/
|
||||
#ifndef STA_CORE_RASPI_DELAY_HPP
|
||||
#define STA_CORE_RASPI_DELAY_HPP
|
||||
|
||||
|
||||
// Only enable module on RASPI platform
|
||||
#include <sta/config.hpp>
|
||||
|
||||
|
||||
#if defined(STA_PLATFORM_RASPI) || defined(DOXYGEN)
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
/**
|
||||
* @brief Millisecond delay.
|
||||
*
|
||||
* @param ms Milliseconds
|
||||
*/
|
||||
void delayMs(uint32_t ms);
|
||||
|
||||
/**
|
||||
* @brief Microsecond delay.
|
||||
*
|
||||
* @param us Microseconds
|
||||
*/
|
||||
void delayUs(uint32_t us);
|
||||
} // namespace sta
|
||||
|
||||
|
||||
#endif // STA_PLATFORM_RASPI
|
||||
|
||||
#endif // STA_CORE_RASPI_DELAY_HPP
|
@@ -37,12 +37,6 @@ namespace sta
|
||||
uint8_t pin_;
|
||||
GpioMode mode_;
|
||||
};
|
||||
|
||||
class DummyGpioPin : public RaspiGpioPin {
|
||||
DummyGpioPin();
|
||||
|
||||
void setState(GpioPinState state) override;
|
||||
};
|
||||
} // namespace sta
|
||||
|
||||
#endif // STA_RASPI_GPIO_ENABLED
|
||||
|
@@ -36,9 +36,15 @@ namespace sta
|
||||
int spifd_;
|
||||
bool open_;
|
||||
const bool persistent_open_;
|
||||
SPISettings settings_;
|
||||
|
||||
uint8_t mode_;
|
||||
uint8_t dataSize_;
|
||||
uint8_t bitOrder_;
|
||||
uint32_t clkSpeed_;
|
||||
|
||||
void update_setting(int setting, int value);
|
||||
int get_setting(int setting, void * rslt_ptr);
|
||||
void get_setting(int setting, void * rslt_ptr);
|
||||
void update_settings();
|
||||
};
|
||||
|
||||
|
@@ -81,8 +81,7 @@ namespace sta
|
||||
*
|
||||
* @return %SPI settings
|
||||
*/
|
||||
const SPISettings & settings() const;
|
||||
|
||||
const SPISettings & settings();
|
||||
|
||||
/**
|
||||
* @brief Acquire usage rights to use the interface.
|
||||
|
Reference in New Issue
Block a user