diff --git a/dev/adc.c b/device/adc.c similarity index 99% rename from dev/adc.c rename to device/adc.c index 369ad48..a9044d0 100644 --- a/dev/adc.c +++ b/device/adc.c @@ -6,7 +6,7 @@ * @date 2023-11-06 MacRsh First version */ -#include "adc.h" +#include "include/device/adc.h" #ifdef MR_USING_ADC diff --git a/dev/dac.c b/device/dac.c similarity index 99% rename from dev/dac.c rename to device/dac.c index 6d1368e..fb40197 100644 --- a/dev/dac.c +++ b/device/dac.c @@ -6,7 +6,7 @@ * @date 2023-11-08 MacRsh First version */ -#include "dac.h" +#include "include/device/dac.h" #ifdef MR_USING_DAC diff --git a/dev/gpio.c b/device/gpio.c similarity index 98% rename from dev/gpio.c rename to device/gpio.c index 59587ec..1715bf5 100644 --- a/dev/gpio.c +++ b/device/gpio.c @@ -6,7 +6,7 @@ * @date 2023-11-08 MacRsh First version */ -#include "gpio.h" +#include "include/device/gpio.h" #ifdef MR_USING_GPIO diff --git a/dev/i2c.c b/device/i2c.c similarity index 99% rename from dev/i2c.c rename to device/i2c.c index b67b24d..7d2e3d9 100644 --- a/dev/i2c.c +++ b/device/i2c.c @@ -6,7 +6,7 @@ * @date 2023-11-09 MacRsh First version */ -#include "i2c.h" +#include "include/device/i2c.h" #ifdef MR_USING_I2C diff --git a/dev/spi.c b/device/spi.c similarity index 99% rename from dev/spi.c rename to device/spi.c index ec5a23e..f18a97d 100644 --- a/dev/spi.c +++ b/device/spi.c @@ -6,12 +6,12 @@ * @date 2023-11-01 MacRsh First version */ -#include "spi.h" +#include "include/device/spi.h" #ifdef MR_USING_SPI #ifdef MR_USING_GPIO -#include "gpio.h" +#include "include/device/gpio.h" #else #warning "Please define MR_USING_GPIO. Otherwise SPI-CS will not work." #endif /* MR_USING_GPIO */ diff --git a/dev/timer.c b/device/timer.c similarity index 98% rename from dev/timer.c rename to device/timer.c index 033d222..69ba624 100644 --- a/dev/timer.c +++ b/device/timer.c @@ -6,7 +6,7 @@ * @date 2023-11-15 MacRsh First version */ -#include "timer.h" +#include "include/device/timer.h" #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); ops->start(timer, timer->prescaler, timer->reload); + } else + { + } return wr_size; diff --git a/dev/uart.c b/device/uart.c similarity index 99% rename from dev/uart.c rename to device/uart.c index 952ede8..ac05229 100644 --- a/dev/uart.c +++ b/device/uart.c @@ -6,7 +6,7 @@ * @date 2023-10-20 MacRsh First version */ -#include "uart.h" +#include "include/device/uart.h" #ifdef MR_USING_UART diff --git a/docs/coding_style.md b/document/coding_style.md similarity index 100% rename from docs/coding_style.md rename to document/coding_style.md diff --git a/drv/mr_drv.h b/driver/mr_drv.h similarity index 100% rename from drv/mr_drv.h rename to driver/mr_drv.h diff --git a/dev/adc.h b/include/device/adc.h similarity index 100% rename from dev/adc.h rename to include/device/adc.h diff --git a/dev/dac.h b/include/device/dac.h similarity index 100% rename from dev/dac.h rename to include/device/dac.h diff --git a/dev/gpio.h b/include/device/gpio.h similarity index 100% rename from dev/gpio.h rename to include/device/gpio.h diff --git a/dev/i2c.h b/include/device/i2c.h similarity index 96% rename from dev/i2c.h rename to include/device/i2c.h index 9189607..269ae43 100644 --- a/dev/i2c.h +++ b/include/device/i2c.h @@ -41,7 +41,7 @@ extern "C" { } /** - * @struct I2C configuration structure. + * @brief I2C configuration structure. */ 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 { @@ -87,7 +87,7 @@ struct mr_i2c_bus_ops #define MR_I2C_ADDR_BITS_10 (10) /**< 10 bit address */ /** - * @struct I2C device structure. + * @brief I2C device structure. */ struct mr_i2c_dev { diff --git a/dev/spi.h b/include/device/spi.h similarity index 99% rename from dev/spi.h rename to include/device/spi.h index 63da912..b6a6a29 100644 --- a/dev/spi.h +++ b/include/device/spi.h @@ -127,7 +127,7 @@ struct mr_spi_bus_ops #define MR_SPI_CS_ACTIVE_NONE (2) /**< No active */ /** - * @struct SPI device structure. + * @brief SPI device structure. */ struct mr_spi_dev { diff --git a/dev/timer.h b/include/device/timer.h similarity index 98% rename from dev/timer.h rename to include/device/timer.h index 4352b83..74c6da5 100644 --- a/dev/timer.h +++ b/include/device/timer.h @@ -89,6 +89,7 @@ struct mr_timer_ops int (*channel_configure)(struct mr_timer *timer, int channel, int mode); void (*start)(struct mr_timer *timer, uint32_t prescaler, uint32_t period); void (*stop)(struct mr_timer *timer); + void (*write_duty)(struct mr_timer *timer); }; /** diff --git a/dev/uart.h b/include/device/uart.h similarity index 97% rename from dev/uart.h rename to include/device/uart.h index bdcdc96..70859f3 100644 --- a/dev/uart.h +++ b/include/device/uart.h @@ -67,7 +67,7 @@ extern "C" { } /** - * @struct UART configuration structure. + * @brief UART configuration structure. */ struct mr_uart_config { @@ -81,7 +81,7 @@ struct mr_uart_config }; /** - * @struct UART structure. + * @brief UART structure. */ struct mr_uart { @@ -95,7 +95,7 @@ struct mr_uart }; /** - * @struct UART operations structure. + * @brief UART operations structure. */ struct mr_uart_ops { diff --git a/inc/mr_api.h b/include/mr_api.h similarity index 100% rename from inc/mr_api.h rename to include/mr_api.h diff --git a/inc/mr_def.h b/include/mr_def.h similarity index 98% rename from inc/mr_def.h rename to include/mr_def.h index 2ae1ad8..38dbd4e 100644 --- a/inc/mr_def.h +++ b/include/mr_def.h @@ -192,8 +192,8 @@ struct mr_dev; /** * @brief Descriptor control command. */ -#define MR_CTRL_SET_OFFSET ((0x01|0x80) << 28) /**< Set offset */ -#define MR_CTRL_GET_OFFSET ((0x02|0x00) << 28) /**< Get offset */ +#define MR_CTRL_SET_OFFSET ((0x01|0x80) << 24) /**< Set offset */ +#define MR_CTRL_GET_OFFSET ((0x02|0x00) << 24) /**< Get offset */ /** * @brief Device control general command. diff --git a/inc/mr_lib.h b/include/mr_lib.h similarity index 100% rename from inc/mr_lib.h rename to include/mr_lib.h diff --git a/inc/mr_service.h b/include/mr_service.h similarity index 100% rename from inc/mr_service.h rename to include/mr_service.h diff --git a/src/dev.c b/source/device.c similarity index 100% rename from src/dev.c rename to source/device.c diff --git a/src/service.c b/source/service.c similarity index 99% rename from src/service.c rename to source/service.c index f8377d9..940e347 100644 --- a/src/service.c +++ b/source/service.c @@ -151,7 +151,7 @@ MR_WEAK int mr_printf_output(const char *buf, size_t size) */ int mr_printf(const char *fmt, ...) { - char buf[256] = {0}; + char buf[128] = {0}; va_list args = MR_NULL; va_start(args, fmt);