1.路径优化。
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
* @date 2023-11-06 MacRsh First version
|
* @date 2023-11-06 MacRsh First version
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "adc.h"
|
#include "include/device/adc.h"
|
||||||
|
|
||||||
#ifdef MR_USING_ADC
|
#ifdef MR_USING_ADC
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
* @date 2023-11-08 MacRsh First version
|
* @date 2023-11-08 MacRsh First version
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dac.h"
|
#include "include/device/dac.h"
|
||||||
|
|
||||||
#ifdef MR_USING_DAC
|
#ifdef MR_USING_DAC
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
* @date 2023-11-08 MacRsh First version
|
* @date 2023-11-08 MacRsh First version
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gpio.h"
|
#include "include/device/gpio.h"
|
||||||
|
|
||||||
#ifdef MR_USING_GPIO
|
#ifdef MR_USING_GPIO
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
* @date 2023-11-09 MacRsh First version
|
* @date 2023-11-09 MacRsh First version
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "i2c.h"
|
#include "include/device/i2c.h"
|
||||||
|
|
||||||
#ifdef MR_USING_I2C
|
#ifdef MR_USING_I2C
|
||||||
|
|
||||||
@@ -6,12 +6,12 @@
|
|||||||
* @date 2023-11-01 MacRsh First version
|
* @date 2023-11-01 MacRsh First version
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "spi.h"
|
#include "include/device/spi.h"
|
||||||
|
|
||||||
#ifdef MR_USING_SPI
|
#ifdef MR_USING_SPI
|
||||||
|
|
||||||
#ifdef MR_USING_GPIO
|
#ifdef MR_USING_GPIO
|
||||||
#include "gpio.h"
|
#include "include/device/gpio.h"
|
||||||
#else
|
#else
|
||||||
#warning "Please define MR_USING_GPIO. Otherwise SPI-CS will not work."
|
#warning "Please define MR_USING_GPIO. Otherwise SPI-CS will not work."
|
||||||
#endif /* MR_USING_GPIO */
|
#endif /* MR_USING_GPIO */
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
* @date 2023-11-15 MacRsh First version
|
* @date 2023-11-15 MacRsh First version
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "timer.h"
|
#include "include/device/timer.h"
|
||||||
|
|
||||||
#ifdef MR_USING_TIMER
|
#ifdef MR_USING_TIMER
|
||||||
|
|
||||||
@@ -53,6 +53,9 @@ static ssize_t mr_timer_write(struct mr_dev *dev, int off, const void *buf, size
|
|||||||
timer->reload = (uint32_t)(((float)timeout / 1000000.0f) * (float)timer->config.freq + 0.5f);
|
timer->reload = (uint32_t)(((float)timeout / 1000000.0f) * (float)timer->config.freq + 0.5f);
|
||||||
|
|
||||||
ops->start(timer, timer->prescaler, timer->reload);
|
ops->start(timer, timer->prescaler, timer->reload);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return wr_size;
|
return wr_size;
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
* @date 2023-10-20 MacRsh First version
|
* @date 2023-10-20 MacRsh First version
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "uart.h"
|
#include "include/device/uart.h"
|
||||||
|
|
||||||
#ifdef MR_USING_UART
|
#ifdef MR_USING_UART
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @struct I2C configuration structure.
|
* @brief I2C configuration structure.
|
||||||
*/
|
*/
|
||||||
struct mr_i2c_config
|
struct mr_i2c_config
|
||||||
{
|
{
|
||||||
@@ -68,7 +68,7 @@ struct mr_i2c_bus
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @struct I2C bus operations structure.
|
* @brief I2C bus operations structure.
|
||||||
*/
|
*/
|
||||||
struct mr_i2c_bus_ops
|
struct mr_i2c_bus_ops
|
||||||
{
|
{
|
||||||
@@ -87,7 +87,7 @@ struct mr_i2c_bus_ops
|
|||||||
#define MR_I2C_ADDR_BITS_10 (10) /**< 10 bit address */
|
#define MR_I2C_ADDR_BITS_10 (10) /**< 10 bit address */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @struct I2C device structure.
|
* @brief I2C device structure.
|
||||||
*/
|
*/
|
||||||
struct mr_i2c_dev
|
struct mr_i2c_dev
|
||||||
{
|
{
|
||||||
@@ -127,7 +127,7 @@ struct mr_spi_bus_ops
|
|||||||
#define MR_SPI_CS_ACTIVE_NONE (2) /**< No active */
|
#define MR_SPI_CS_ACTIVE_NONE (2) /**< No active */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @struct SPI device structure.
|
* @brief SPI device structure.
|
||||||
*/
|
*/
|
||||||
struct mr_spi_dev
|
struct mr_spi_dev
|
||||||
{
|
{
|
||||||
@@ -89,6 +89,7 @@ struct mr_timer_ops
|
|||||||
int (*channel_configure)(struct mr_timer *timer, int channel, int mode);
|
int (*channel_configure)(struct mr_timer *timer, int channel, int mode);
|
||||||
void (*start)(struct mr_timer *timer, uint32_t prescaler, uint32_t period);
|
void (*start)(struct mr_timer *timer, uint32_t prescaler, uint32_t period);
|
||||||
void (*stop)(struct mr_timer *timer);
|
void (*stop)(struct mr_timer *timer);
|
||||||
|
void (*write_duty)(struct mr_timer *timer);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,7 +67,7 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @struct UART configuration structure.
|
* @brief UART configuration structure.
|
||||||
*/
|
*/
|
||||||
struct mr_uart_config
|
struct mr_uart_config
|
||||||
{
|
{
|
||||||
@@ -81,7 +81,7 @@ struct mr_uart_config
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @struct UART structure.
|
* @brief UART structure.
|
||||||
*/
|
*/
|
||||||
struct mr_uart
|
struct mr_uart
|
||||||
{
|
{
|
||||||
@@ -95,7 +95,7 @@ struct mr_uart
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @struct UART operations structure.
|
* @brief UART operations structure.
|
||||||
*/
|
*/
|
||||||
struct mr_uart_ops
|
struct mr_uart_ops
|
||||||
{
|
{
|
||||||
@@ -192,8 +192,8 @@ struct mr_dev;
|
|||||||
/**
|
/**
|
||||||
* @brief Descriptor control command.
|
* @brief Descriptor control command.
|
||||||
*/
|
*/
|
||||||
#define MR_CTRL_SET_OFFSET ((0x01|0x80) << 28) /**< Set offset */
|
#define MR_CTRL_SET_OFFSET ((0x01|0x80) << 24) /**< Set offset */
|
||||||
#define MR_CTRL_GET_OFFSET ((0x02|0x00) << 28) /**< Get offset */
|
#define MR_CTRL_GET_OFFSET ((0x02|0x00) << 24) /**< Get offset */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Device control general command.
|
* @brief Device control general command.
|
||||||
@@ -151,7 +151,7 @@ MR_WEAK int mr_printf_output(const char *buf, size_t size)
|
|||||||
*/
|
*/
|
||||||
int mr_printf(const char *fmt, ...)
|
int mr_printf(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
char buf[256] = {0};
|
char buf[128] = {0};
|
||||||
va_list args = MR_NULL;
|
va_list args = MR_NULL;
|
||||||
|
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
Reference in New Issue
Block a user