Merge branch 'master' of https://github.com/RT-Thread/rt-thread
This commit is contained in:
commit
33e1ef436a
|
@ -35,16 +35,16 @@ RT-Thread对树莓派的支持主要从树莓派2B开始,它是一个四核Cor
|
||||||
|
|
||||||
Windows环境下推荐使用[env工具][1]进行编译。
|
Windows环境下推荐使用[env工具][1]进行编译。
|
||||||
|
|
||||||
Linux下推荐使用gcc工具 [gcc-arm-none-eabi-4_8-2014q1_linux][2],如果还没有编译工具,下载后,解开文件。
|
Linux下推荐使用gcc工具 gcc-arm-none-eabi-5_4-2016q3,如果还没有编译工具,下载后,解开文件。
|
||||||
|
|
||||||
```
|
```
|
||||||
tar vxf gcc-arm-none-eabi-4_8-2014q1_linux.tar.bz2
|
tar vxf gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2
|
||||||
```
|
```
|
||||||
|
|
||||||
Linux环境下需要修改编译器目录设置,修改`bsp/raspi3-32/rtconfig.py`中的
|
Linux环境下需要修改编译器目录设置,修改`bsp/raspi3-32/rtconfig.py`中的
|
||||||
|
|
||||||
```
|
```
|
||||||
EXEC_PATH = r'/opt/gcc-arm-none-eabi-4_8-2014q1_gri/bin'
|
EXEC_PATH = r'/opt/gcc-arm-none-eabi-5_4-2016q3/bin'
|
||||||
```
|
```
|
||||||
|
|
||||||
为编译工具的实际所在目录,这里注意要加上后缀 `/bin`
|
为编译工具的实际所在目录,这里注意要加上后缀 `/bin`
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
void spi_gpio_write(rt_uint8_t pin, rt_uint8_t val)
|
void spi_gpio_write(rt_uint8_t pin, rt_uint8_t val)
|
||||||
{
|
{
|
||||||
if (val)
|
if (val)
|
||||||
BCM283X_GPIO_GPSET(pin / 32) = 1 << (pin % 32);
|
BCM283X_GPIO_GPSET((pin / 32)) = 1 << (pin % 32);
|
||||||
else
|
else
|
||||||
BCM283X_GPIO_GPCLR(pin / 32) = 0 << (pin % 32);
|
BCM283X_GPIO_GPCLR((pin / 32)) = 1 << (pin % 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct raspi_spi_hw_config
|
struct raspi_spi_hw_config
|
||||||
|
@ -147,11 +147,10 @@ static rt_uint32_t raspi_spi_xfer(struct rt_spi_device *device, struct rt_spi_me
|
||||||
flag = 0;
|
flag = 0;
|
||||||
else
|
else
|
||||||
flag = 1;
|
flag = 1;
|
||||||
|
if (message->cs_take);
|
||||||
if (message->cs_take)
|
// (config.mode & RT_SPI_CS_HIGH)?
|
||||||
(config.mode & RT_SPI_CS_HIGH)?
|
// spi_gpio_write(cs_pin, 1):
|
||||||
spi_gpio_write(cs_pin, 1):
|
// spi_gpio_write(cs_pin, 0);
|
||||||
spi_gpio_write(cs_pin, 0);
|
|
||||||
|
|
||||||
/* deal data */
|
/* deal data */
|
||||||
res = spi_transfernb((rt_uint8_t *)message->send_buf, (rt_uint8_t *)message->recv_buf,
|
res = spi_transfernb((rt_uint8_t *)message->send_buf, (rt_uint8_t *)message->recv_buf,
|
||||||
|
|
|
@ -213,6 +213,42 @@ void rt_hw_cpu_reset(void)
|
||||||
tls_sys_reset();
|
tls_sys_reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The time delay function.
|
||||||
|
*
|
||||||
|
* @param microseconds.
|
||||||
|
*/
|
||||||
|
#include "wm_regs.h"
|
||||||
|
void rt_hw_us_delay(rt_uint32_t us)
|
||||||
|
{
|
||||||
|
rt_uint32_t ticks;
|
||||||
|
rt_uint32_t told, tnow, tcnt = 0;
|
||||||
|
rt_uint32_t reload = SysTick->LOAD;
|
||||||
|
|
||||||
|
ticks = us * reload / (1000000 / RT_TICK_PER_SECOND);
|
||||||
|
told = SysTick->VAL;
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
tnow = SysTick->VAL;
|
||||||
|
if (tnow != told)
|
||||||
|
{
|
||||||
|
if (tnow < told)
|
||||||
|
{
|
||||||
|
tcnt += told - tnow;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tcnt += reload - tnow + told;
|
||||||
|
}
|
||||||
|
told = tnow;
|
||||||
|
if (tcnt >= ticks)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef RT_USING_FINSH
|
#ifdef RT_USING_FINSH
|
||||||
#include <finsh.h>
|
#include <finsh.h>
|
||||||
static void reboot(uint8_t argc, char **argv)
|
static void reboot(uint8_t argc, char **argv)
|
||||||
|
|
|
@ -138,40 +138,7 @@ static rt_int32_t w60x_get_scl(void *data)
|
||||||
|
|
||||||
return tls_gpio_read((enum tls_io_name)scl);
|
return tls_gpio_read((enum tls_io_name)scl);
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* The time delay function.
|
|
||||||
*
|
|
||||||
* @param microseconds.
|
|
||||||
*/
|
|
||||||
static void w60x_udelay(rt_uint32_t us)
|
|
||||||
{
|
|
||||||
rt_uint32_t ticks;
|
|
||||||
rt_uint32_t told, tnow, tcnt = 0;
|
|
||||||
rt_uint32_t reload = SysTick->LOAD;
|
|
||||||
|
|
||||||
ticks = us * reload / (1000000 / RT_TICK_PER_SECOND);
|
|
||||||
told = SysTick->VAL;
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
tnow = SysTick->VAL;
|
|
||||||
if (tnow != told)
|
|
||||||
{
|
|
||||||
if (tnow < told)
|
|
||||||
{
|
|
||||||
tcnt += told - tnow;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tcnt += reload - tnow + told;
|
|
||||||
}
|
|
||||||
told = tnow;
|
|
||||||
if (tcnt >= ticks)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct rt_i2c_bit_ops w60x_bit_ops_default =
|
static const struct rt_i2c_bit_ops w60x_bit_ops_default =
|
||||||
{
|
{
|
||||||
|
@ -180,7 +147,7 @@ static const struct rt_i2c_bit_ops w60x_bit_ops_default =
|
||||||
.set_scl = w60x_set_scl,
|
.set_scl = w60x_set_scl,
|
||||||
.get_sda = w60x_get_sda,
|
.get_sda = w60x_get_sda,
|
||||||
.get_scl = w60x_get_scl,
|
.get_scl = w60x_get_scl,
|
||||||
.udelay = w60x_udelay,
|
.udelay = rt_hw_us_delay,
|
||||||
.delay_us = 1,
|
.delay_us = 1,
|
||||||
.timeout = 100
|
.timeout = 100
|
||||||
};
|
};
|
||||||
|
@ -201,9 +168,9 @@ static rt_err_t w60x_i2c_bus_unlock(const struct w60x_soft_i2c_config *cfg)
|
||||||
while (i++ < 9)
|
while (i++ < 9)
|
||||||
{
|
{
|
||||||
rt_pin_write(cfg->scl, PIN_HIGH);
|
rt_pin_write(cfg->scl, PIN_HIGH);
|
||||||
w60x_udelay(100);
|
rt_hw_us_delay(100);
|
||||||
rt_pin_write(cfg->scl, PIN_LOW);
|
rt_pin_write(cfg->scl, PIN_LOW);
|
||||||
w60x_udelay(100);
|
rt_hw_us_delay(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (PIN_LOW == rt_pin_read(cfg->sda))
|
if (PIN_LOW == rt_pin_read(cfg->sda))
|
||||||
|
|
|
@ -538,7 +538,7 @@ void rt_show_version(void)
|
||||||
rt_kprintf("- RT - Thread Operating System\n");
|
rt_kprintf("- RT - Thread Operating System\n");
|
||||||
rt_kprintf(" / | \\ %d.%d.%d build %s\n",
|
rt_kprintf(" / | \\ %d.%d.%d build %s\n",
|
||||||
RT_VERSION, RT_SUBVERSION, RT_REVISION, __DATE__);
|
RT_VERSION, RT_SUBVERSION, RT_REVISION, __DATE__);
|
||||||
rt_kprintf(" 2006 - 2019 Copyright by rt-thread team\n");
|
rt_kprintf(" 2006 - 2020 Copyright by rt-thread team\n");
|
||||||
}
|
}
|
||||||
RTM_EXPORT(rt_show_version);
|
RTM_EXPORT(rt_show_version);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue