mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-03-24 09:30:19 +08:00
[bsp][lpc54114] 移除PCT2075温度传感器驱动, 考虑在package中实现.
This commit is contained in:
@@ -418,10 +418,5 @@ CONFIG_BSP_USING_SPI2=y
|
||||
# Select i2c bus drivers
|
||||
#
|
||||
CONFIG_BSP_USING_I2C4=y
|
||||
|
||||
#
|
||||
# Select spi bus drivers
|
||||
#
|
||||
CONFIG_BSP_USING_SDCARD=y
|
||||
CONFIG_BSP_USING_SPIFLASH=y
|
||||
CONFIG_BSP_USING_PCT2075=y
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# RT1050 bsp Config!
|
||||
# LPC54110 bsp Config
|
||||
menu "LPC54110 Bsp Config"
|
||||
|
||||
menu "Select uart drivers"
|
||||
@@ -29,9 +29,4 @@ menu "LPC54110 Bsp Config"
|
||||
select BSP_USING_SPI2
|
||||
default y
|
||||
|
||||
config BSP_USING_PCT2075
|
||||
bool "Enable PCT2075"
|
||||
select BSP_USING_I2C4
|
||||
default y
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -25,9 +25,6 @@ if GetDepend('BSP_USING_SDCARD'):
|
||||
if GetDepend('BSP_USING_SPIFLASH'):
|
||||
src = src + ['drv_spi_flash.c']
|
||||
|
||||
if GetDepend('BSP_USING_PCT2075'):
|
||||
src = src + ['drv_pct2075.c']
|
||||
|
||||
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "drv_pct2075.h"
|
||||
|
||||
#define PCT2075_I2C_NAME "i2c4"
|
||||
#define PCT2075_I2C_ADDR (0x4C)
|
||||
|
||||
static struct rt_i2c_bus_device *i2c_bus = RT_NULL;
|
||||
|
||||
float pct2075_read(void)
|
||||
{
|
||||
struct rt_i2c_msg msg = {0};
|
||||
rt_uint8_t buf[2] = {0};
|
||||
float data = -0.666666f;
|
||||
|
||||
if(i2c_bus == RT_NULL)
|
||||
{
|
||||
return -0.666666f;
|
||||
}
|
||||
|
||||
msg.addr = PCT2075_I2C_ADDR;
|
||||
msg.flags = RT_I2C_RD;
|
||||
msg.len = 2;
|
||||
msg.buf = buf;
|
||||
|
||||
if (rt_i2c_transfer(i2c_bus, &msg, 1) != 1)
|
||||
{
|
||||
rt_kprintf("I2C write data failed.\n");
|
||||
return data;
|
||||
}
|
||||
|
||||
if((buf[0]&0x80) == 0x00)
|
||||
{
|
||||
data = ((float)(((buf[0]<<8) + buf[1])>>5) * 0.125f);
|
||||
}
|
||||
else
|
||||
{
|
||||
data = 0x800 - ((buf[0]<<8) + buf[1]>>5 );
|
||||
data = -(((float)(data)) * 0.125f);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
MSH_CMD_EXPORT(pct2075_read, read pct2075 oC);
|
||||
|
||||
int rt_hw_pct2075_init(void)
|
||||
{
|
||||
rt_err_t ret = RT_EOK;
|
||||
|
||||
i2c_bus = rt_i2c_bus_device_find(PCT2075_I2C_NAME);
|
||||
if(i2c_bus == RT_NULL)
|
||||
{
|
||||
rt_kprintf("I2c bus not find.\n");
|
||||
ret = (-RT_EIO);
|
||||
goto __fail;
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
|
||||
__fail:
|
||||
return ret;
|
||||
}
|
||||
INIT_DEVICE_EXPORT(rt_hw_pct2075_init);
|
||||
@@ -1,16 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef __DRV_PCT2075_H__
|
||||
#define __DRV_PCT2075_H__
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
int rt_hw_pct2075_init(void);
|
||||
float pct2075_read(void);
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -432,11 +432,6 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\drv_spi_flash.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>drv_pct2075.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\drv_pct2075.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
|
||||
@@ -205,11 +205,7 @@
|
||||
/* Select i2c bus drivers */
|
||||
|
||||
#define BSP_USING_I2C4
|
||||
|
||||
/* Select spi bus drivers */
|
||||
|
||||
#define BSP_USING_SDCARD
|
||||
#define BSP_USING_SPIFLASH
|
||||
#define BSP_USING_PCT2075
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user