From b76dd4a9d5603039b66edf121d9d8f147dc35680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=81=E5=85=89?= <1004383796@qq.com> Date: Mon, 10 Dec 2018 10:45:31 +0800 Subject: [PATCH] =?UTF-8?q?[bsp][lpc54114]=20=E7=A7=BB=E9=99=A4PCT2075?= =?UTF-8?q?=E6=B8=A9=E5=BA=A6=E4=BC=A0=E6=84=9F=E5=99=A8=E9=A9=B1=E5=8A=A8?= =?UTF-8?q?,=20=E8=80=83=E8=99=91=E5=9C=A8package=E4=B8=AD=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/lpc54114-lite/.config | 5 - bsp/lpc54114-lite/drivers/Kconfig | 7 +- bsp/lpc54114-lite/drivers/SConscript | 3 - bsp/lpc54114-lite/drivers/drv_pct2075.c | 67 ------- bsp/lpc54114-lite/drivers/drv_pct2075.h | 16 -- bsp/lpc54114-lite/project.uvoptx | 224 +++++++++++------------- bsp/lpc54114-lite/project.uvprojx | 5 - bsp/lpc54114-lite/rtconfig.h | 4 - 8 files changed, 107 insertions(+), 224 deletions(-) delete mode 100644 bsp/lpc54114-lite/drivers/drv_pct2075.c delete mode 100644 bsp/lpc54114-lite/drivers/drv_pct2075.h diff --git a/bsp/lpc54114-lite/.config b/bsp/lpc54114-lite/.config index 0be8eec9ac..0b7ccbf108 100644 --- a/bsp/lpc54114-lite/.config +++ b/bsp/lpc54114-lite/.config @@ -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 diff --git a/bsp/lpc54114-lite/drivers/Kconfig b/bsp/lpc54114-lite/drivers/Kconfig index 2332c68a82..5544448da1 100644 --- a/bsp/lpc54114-lite/drivers/Kconfig +++ b/bsp/lpc54114-lite/drivers/Kconfig @@ -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 diff --git a/bsp/lpc54114-lite/drivers/SConscript b/bsp/lpc54114-lite/drivers/SConscript index e666140bac..ced26be9c3 100644 --- a/bsp/lpc54114-lite/drivers/SConscript +++ b/bsp/lpc54114-lite/drivers/SConscript @@ -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') diff --git a/bsp/lpc54114-lite/drivers/drv_pct2075.c b/bsp/lpc54114-lite/drivers/drv_pct2075.c deleted file mode 100644 index 3e24c777cd..0000000000 --- a/bsp/lpc54114-lite/drivers/drv_pct2075.c +++ /dev/null @@ -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); diff --git a/bsp/lpc54114-lite/drivers/drv_pct2075.h b/bsp/lpc54114-lite/drivers/drv_pct2075.h deleted file mode 100644 index 2b12a66789..0000000000 --- a/bsp/lpc54114-lite/drivers/drv_pct2075.h +++ /dev/null @@ -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 -#include - -int rt_hw_pct2075_init(void); -float pct2075_read(void); - -#endif diff --git a/bsp/lpc54114-lite/project.uvoptx b/bsp/lpc54114-lite/project.uvoptx index a5b30827e2..906e23aa03 100644 --- a/bsp/lpc54114-lite/project.uvoptx +++ b/bsp/lpc54114-lite/project.uvoptx @@ -183,7 +183,7 @@ Applications - 1 + 0 0 0 0 @@ -215,7 +215,7 @@ Drivers - 0 + 1 0 0 0 @@ -303,18 +303,6 @@ 0 0 - - 2 - 10 - 1 - 0 - 0 - 0 - drivers\drv_pct2075.c - drv_pct2075.c - 0 - 0 - @@ -325,7 +313,7 @@ 0 3 - 11 + 10 1 0 0 @@ -337,7 +325,7 @@ 3 - 12 + 11 1 0 0 @@ -349,7 +337,7 @@ 3 - 13 + 12 1 0 0 @@ -361,7 +349,7 @@ 3 - 14 + 13 1 0 0 @@ -373,7 +361,7 @@ 3 - 15 + 14 1 0 0 @@ -385,7 +373,7 @@ 3 - 16 + 15 1 0 0 @@ -397,7 +385,7 @@ 3 - 17 + 16 1 0 0 @@ -409,7 +397,7 @@ 3 - 18 + 17 1 0 0 @@ -421,7 +409,7 @@ 3 - 19 + 18 1 0 0 @@ -433,7 +421,7 @@ 3 - 20 + 19 1 0 0 @@ -445,7 +433,7 @@ 3 - 21 + 20 1 0 0 @@ -457,7 +445,7 @@ 3 - 22 + 21 1 0 0 @@ -469,7 +457,7 @@ 3 - 23 + 22 1 0 0 @@ -481,7 +469,7 @@ 3 - 24 + 23 1 0 0 @@ -493,7 +481,7 @@ 3 - 25 + 24 1 0 0 @@ -505,7 +493,7 @@ 3 - 26 + 25 1 0 0 @@ -517,7 +505,7 @@ 3 - 27 + 26 1 0 0 @@ -529,7 +517,7 @@ 3 - 28 + 27 1 0 0 @@ -541,7 +529,7 @@ 3 - 29 + 28 1 0 0 @@ -553,7 +541,7 @@ 3 - 30 + 29 1 0 0 @@ -565,7 +553,7 @@ 3 - 31 + 30 1 0 0 @@ -577,7 +565,7 @@ 3 - 32 + 31 1 0 0 @@ -589,7 +577,7 @@ 3 - 33 + 32 1 0 0 @@ -601,7 +589,7 @@ 3 - 34 + 33 1 0 0 @@ -613,7 +601,7 @@ 3 - 35 + 34 1 0 0 @@ -625,7 +613,7 @@ 3 - 36 + 35 1 0 0 @@ -637,7 +625,7 @@ 3 - 37 + 36 1 0 0 @@ -649,7 +637,7 @@ 3 - 38 + 37 1 0 0 @@ -661,7 +649,7 @@ 3 - 39 + 38 1 0 0 @@ -673,7 +661,7 @@ 3 - 40 + 39 1 0 0 @@ -685,7 +673,7 @@ 3 - 41 + 40 2 0 0 @@ -697,7 +685,7 @@ 3 - 42 + 41 1 0 0 @@ -709,7 +697,7 @@ 3 - 43 + 42 4 0 0 @@ -729,7 +717,7 @@ 0 4 - 44 + 43 1 0 0 @@ -741,7 +729,7 @@ 4 - 45 + 44 1 0 0 @@ -753,7 +741,7 @@ 4 - 46 + 45 1 0 0 @@ -765,7 +753,7 @@ 4 - 47 + 46 1 0 0 @@ -777,7 +765,7 @@ 4 - 48 + 47 1 0 0 @@ -789,7 +777,7 @@ 4 - 49 + 48 1 0 0 @@ -801,7 +789,7 @@ 4 - 50 + 49 1 0 0 @@ -813,7 +801,7 @@ 4 - 51 + 50 1 0 0 @@ -825,7 +813,7 @@ 4 - 52 + 51 1 0 0 @@ -837,7 +825,7 @@ 4 - 53 + 52 1 0 0 @@ -849,7 +837,7 @@ 4 - 54 + 53 1 0 0 @@ -861,7 +849,7 @@ 4 - 55 + 54 1 0 0 @@ -873,7 +861,7 @@ 4 - 56 + 55 1 0 0 @@ -885,7 +873,7 @@ 4 - 57 + 56 1 0 0 @@ -897,7 +885,7 @@ 4 - 58 + 57 1 0 0 @@ -917,7 +905,7 @@ 0 5 - 59 + 58 1 0 0 @@ -929,7 +917,7 @@ 5 - 60 + 59 2 0 0 @@ -941,7 +929,7 @@ 5 - 61 + 60 1 0 0 @@ -953,7 +941,7 @@ 5 - 62 + 61 1 0 0 @@ -965,7 +953,7 @@ 5 - 63 + 62 1 0 0 @@ -985,7 +973,7 @@ 0 6 - 64 + 63 1 0 0 @@ -997,7 +985,7 @@ 6 - 65 + 64 1 0 0 @@ -1009,7 +997,7 @@ 6 - 66 + 65 1 0 0 @@ -1021,7 +1009,7 @@ 6 - 67 + 66 1 0 0 @@ -1033,7 +1021,7 @@ 6 - 68 + 67 1 0 0 @@ -1045,7 +1033,7 @@ 6 - 69 + 68 1 0 0 @@ -1057,7 +1045,7 @@ 6 - 70 + 69 1 0 0 @@ -1069,7 +1057,7 @@ 6 - 71 + 70 1 0 0 @@ -1081,7 +1069,7 @@ 6 - 72 + 71 1 0 0 @@ -1093,7 +1081,7 @@ 6 - 73 + 72 1 0 0 @@ -1105,7 +1093,7 @@ 6 - 74 + 73 1 0 0 @@ -1117,7 +1105,7 @@ 6 - 75 + 74 1 0 0 @@ -1137,7 +1125,7 @@ 0 7 - 76 + 75 1 0 0 @@ -1149,7 +1137,7 @@ 7 - 77 + 76 1 0 0 @@ -1161,7 +1149,7 @@ 7 - 78 + 77 1 0 0 @@ -1173,7 +1161,7 @@ 7 - 79 + 78 1 0 0 @@ -1185,7 +1173,7 @@ 7 - 80 + 79 1 0 0 @@ -1197,7 +1185,7 @@ 7 - 81 + 80 1 0 0 @@ -1209,7 +1197,7 @@ 7 - 82 + 81 1 0 0 @@ -1221,7 +1209,7 @@ 7 - 83 + 82 1 0 0 @@ -1233,7 +1221,7 @@ 7 - 84 + 83 1 0 0 @@ -1245,7 +1233,7 @@ 7 - 85 + 84 1 0 0 @@ -1257,7 +1245,7 @@ 7 - 86 + 85 1 0 0 @@ -1269,7 +1257,7 @@ 7 - 87 + 86 1 0 0 @@ -1281,7 +1269,7 @@ 7 - 88 + 87 1 0 0 @@ -1293,7 +1281,7 @@ 7 - 89 + 88 1 0 0 @@ -1305,7 +1293,7 @@ 7 - 90 + 89 1 0 0 @@ -1317,7 +1305,7 @@ 7 - 91 + 90 1 0 0 @@ -1329,7 +1317,7 @@ 7 - 92 + 91 1 0 0 @@ -1349,7 +1337,7 @@ 0 8 - 93 + 92 1 0 0 @@ -1361,7 +1349,7 @@ 8 - 94 + 93 1 0 0 @@ -1373,7 +1361,7 @@ 8 - 95 + 94 1 0 0 @@ -1385,7 +1373,7 @@ 8 - 96 + 95 1 0 0 @@ -1397,7 +1385,7 @@ 8 - 97 + 96 1 0 0 @@ -1409,7 +1397,7 @@ 8 - 98 + 97 1 0 0 @@ -1421,7 +1409,7 @@ 8 - 99 + 98 1 0 0 @@ -1433,7 +1421,7 @@ 8 - 100 + 99 1 0 0 @@ -1445,7 +1433,7 @@ 8 - 101 + 100 1 0 0 @@ -1457,7 +1445,7 @@ 8 - 102 + 101 1 0 0 @@ -1469,7 +1457,7 @@ 8 - 103 + 102 1 0 0 @@ -1481,7 +1469,7 @@ 8 - 104 + 103 1 0 0 @@ -1493,7 +1481,7 @@ 8 - 105 + 104 1 0 0 @@ -1505,7 +1493,7 @@ 8 - 106 + 105 1 0 0 @@ -1517,7 +1505,7 @@ 8 - 107 + 106 1 0 0 @@ -1529,7 +1517,7 @@ 8 - 108 + 107 1 0 0 @@ -1549,7 +1537,7 @@ 0 9 - 109 + 108 1 0 0 @@ -1561,7 +1549,7 @@ 9 - 110 + 109 1 0 0 @@ -1573,7 +1561,7 @@ 9 - 111 + 110 1 0 0 @@ -1585,7 +1573,7 @@ 9 - 112 + 111 1 0 0 @@ -1597,7 +1585,7 @@ 9 - 113 + 112 1 0 0 @@ -1609,7 +1597,7 @@ 9 - 114 + 113 1 0 0 diff --git a/bsp/lpc54114-lite/project.uvprojx b/bsp/lpc54114-lite/project.uvprojx index 52d1e7a6ea..51f3ba03e9 100644 --- a/bsp/lpc54114-lite/project.uvprojx +++ b/bsp/lpc54114-lite/project.uvprojx @@ -432,11 +432,6 @@ 1 drivers\drv_spi_flash.c - - drv_pct2075.c - 1 - drivers\drv_pct2075.c - diff --git a/bsp/lpc54114-lite/rtconfig.h b/bsp/lpc54114-lite/rtconfig.h index eb70cf74c9..ca76f59014 100644 --- a/bsp/lpc54114-lite/rtconfig.h +++ b/bsp/lpc54114-lite/rtconfig.h @@ -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