mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-09 20:45:41 +08:00
[bsp][renesas] add renesas soft spi driver
This commit is contained in:
1 parent
fad78950ea
commit
6aa1442f64
7 files changed
+317
-440
No files matched your search
@@ -41,6 +41,9 @@ if GetDepend(['BSP_USING_SPI']):
|
||||
if GetDepend(['BSP_USING_SCI_SPI']):
|
||||
src += ['drv_sci_spi.c']
|
||||
|
||||
if GetDepend(['BSP_USING_SOFT_SPI']):
|
||||
src += ['drv_soft_spi.c']
|
||||
|
||||
if GetDepend(['BSP_USING_SCI']):
|
||||
src += ['drv_sci.c']
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2023-04-14 Wangyuqiang the first version
|
||||
*/
|
||||
|
||||
#ifndef __DRV_SOFT_SPI__
|
||||
#define __DRV_SOFT_SPI__
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtdevice.h>
|
||||
#include <spi-bit-ops.h>
|
||||
|
||||
/* ra soft spi config */
|
||||
struct ra_soft_spi_config
|
||||
{
|
||||
rt_base_t sck;
|
||||
rt_base_t mosi;
|
||||
rt_base_t miso;
|
||||
const char *bus_name;
|
||||
};
|
||||
|
||||
/* ra soft spi dirver */
|
||||
struct ra_soft_spi
|
||||
{
|
||||
struct rt_spi_bit_obj spi;
|
||||
struct rt_spi_bit_ops ops;
|
||||
struct ra_soft_spi_config *cfg;
|
||||
};
|
||||
|
||||
#ifdef BSP_USING_SOFT_SPI1
|
||||
#define SOFT_SPI1_BUS_CONFIG \
|
||||
{ \
|
||||
.sck = BSP_S_SPI1_SCK_PIN, \
|
||||
.mosi = BSP_S_SPI1_MOSI_PIN, \
|
||||
.miso = BSP_S_SPI1_MISO_PIN, \
|
||||
.bus_name = "sspi1", \
|
||||
}
|
||||
#endif /* BSP_USING_SOFT_SPI1 */
|
||||
#ifdef BSP_USING_SOFT_SPI2
|
||||
#define SOFT_SPI2_BUS_CONFIG \
|
||||
{ \
|
||||
.sck = BSP_S_SPI2_SCK_PIN, \
|
||||
.mosi = BSP_S_SPI2_MOSI_PIN, \
|
||||
.miso = BSP_S_SPI2_MISO_PIN, \
|
||||
.bus_name = "sspi2", \
|
||||
}
|
||||
#endif /* BSP_USING_SOFT_SPI2 */
|
||||
|
||||
rt_err_t rt_soft_spi_device_attach(const char *bus_name, const char *device_name, rt_base_t cs_pin);
|
||||
int rt_soft_spi_init(void);
|
||||
|
||||
#endif /* __DRV_SOFT_SPI__ */
|
||||
@@ -20,6 +20,7 @@
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
<nature>org.rt-thread.studio.rttnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
|
||||
@@ -22,6 +22,8 @@ menu "Hardware Drivers Config"
|
||||
select BSP_USING_PWM8
|
||||
select BSP_USING_SOFT_I2C
|
||||
select BSP_USING_I2C0
|
||||
select BSP_USING_SOFT_SPI
|
||||
select BSP_USING_SOFT_SPI1
|
||||
imply RTDUINO_USING_SERVO
|
||||
imply RTDUINO_USING_WIRE
|
||||
default n
|
||||
@@ -536,6 +538,33 @@ menu "Hardware Drivers Config"
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_SPI
|
||||
bool "Enable soft SPI BUS"
|
||||
default n
|
||||
select RT_USING_PIN
|
||||
select RT_USING_SPI_BITOPS
|
||||
select RT_USING_SPI
|
||||
if BSP_USING_SOFT_SPI
|
||||
config BSP_USING_SOFT_SPI1
|
||||
bool "Enable soft SPI1 BUS (software simulation)"
|
||||
default n
|
||||
if BSP_USING_SOFT_SPI1
|
||||
comment "Please select your spi analog pin, e.g. 'P512': 0x512"
|
||||
config BSP_S_SPI1_SCK_PIN
|
||||
hex "spi1 sck pin number (hex)"
|
||||
range 0x0000 0x0E0F
|
||||
default 0x204
|
||||
config BSP_S_SPI1_MOSI_PIN
|
||||
hex "spi1 mosi pin number (hex)"
|
||||
range 0x0000 0x0E0F
|
||||
default 0x512
|
||||
config BSP_S_SPI1_MISO_PIN
|
||||
hex "spi1 miso pin number (hex)"
|
||||
range 0x0000 0x0E0F
|
||||
default 0x511
|
||||
endif
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C bus"
|
||||
select RT_USING_I2C
|
||||
|
||||
@@ -20,11 +20,11 @@ elif rtconfig.PLATFORM in GetGCCLikePLATFORM():
|
||||
CPPPATH = [ cwd + '/arm/CMSIS_5/CMSIS/Core/Include',
|
||||
cwd + '/fsp/inc',
|
||||
cwd + '/fsp/inc/api',
|
||||
cwd + '/fsp/inc/instances',]
|
||||
cwd + '/fsp/inc/instances',
|
||||
cwd + '/tes/dave2d/inc']
|
||||
|
||||
if GetDepend('BSP_USING_G2D'):
|
||||
src += Glob(cwd + '/tes/dave2d/src/*.c')
|
||||
CPPPATH += [cwd + '/tes/dave2d/inc']
|
||||
|
||||
group = DefineGroup('ra', src, depend = [''], CPPPATH = CPPPATH)
|
||||
Return('group')
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user