forked from xuos/xiuos
remove adc string
This commit is contained in:
parent
efd8999988
commit
f942af6c43
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020 AIIT XUOS Lab
|
* Copyright (c) 2022 AIIT XUOS Lab
|
||||||
* XiUOS is licensed under Mulan PSL v2.
|
* XiUOS is licensed under Mulan PSL v2.
|
||||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
* You may obtain a copy of Mulan PSL v2 at:
|
* You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
@ -37,14 +37,6 @@
|
||||||
|
|
||||||
#define adc_print KPrintf
|
#define adc_print KPrintf
|
||||||
|
|
||||||
#define ADC1_BUS_NAME "adc1"
|
|
||||||
#define ADC1_DRV_NAME "adc1_drv"
|
|
||||||
#define ADC1_DEV_NAME "adc1_dev"
|
|
||||||
|
|
||||||
#define ADC2_BUS_NAME "adc2"
|
|
||||||
#define ADC2_DRV_NAME "adc2_drv"
|
|
||||||
#define ADC2_DEV_NAME "adc2_dev"
|
|
||||||
|
|
||||||
volatile bool adc1_flag;
|
volatile bool adc1_flag;
|
||||||
volatile uint32_t adc1_val;
|
volatile uint32_t adc1_val;
|
||||||
volatile uint32_t adc1_irq_cnt;
|
volatile uint32_t adc1_irq_cnt;
|
||||||
|
@ -92,7 +84,7 @@ uint32 Imrt1052AdcOpen(void *dev)
|
||||||
adc_config_t adc_cfg;
|
adc_config_t adc_cfg;
|
||||||
|
|
||||||
#ifdef BSP_USING_ADC1
|
#ifdef BSP_USING_ADC1
|
||||||
if (0 == strncmp(adc_dev->haldev.dev_name, ADC1_DEV_NAME, NAME_NUM_MAX)) {
|
if (0 == strncmp(adc_dev->haldev.dev_name, ADC_1_DEVICE_NAME_0, NAME_NUM_MAX)) {
|
||||||
EnableIRQ(ADC1_IRQn);
|
EnableIRQ(ADC1_IRQn);
|
||||||
ADC_GetDefaultConfig(&adc_cfg);
|
ADC_GetDefaultConfig(&adc_cfg);
|
||||||
ADC_Init(ADC1, &adc_cfg);
|
ADC_Init(ADC1, &adc_cfg);
|
||||||
|
@ -112,7 +104,7 @@ uint32 Imrt1052AdcOpen(void *dev)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BSP_USING_ADC2
|
#ifdef BSP_USING_ADC2
|
||||||
if (0 == strncmp(adc_dev->haldev.dev_name, ADC2_DEV_NAME, NAME_NUM_MAX)) {
|
if (0 == strncmp(adc_dev->haldev.dev_name, ADC_2_DEVICE_NAME_0, NAME_NUM_MAX)) {
|
||||||
EnableIRQ(ADC2_IRQn);
|
EnableIRQ(ADC2_IRQn);
|
||||||
ADC_GetDefaultConfig(&adc_cfg);
|
ADC_GetDefaultConfig(&adc_cfg);
|
||||||
ADC_Init(ADC2, &adc_cfg);
|
ADC_Init(ADC2, &adc_cfg);
|
||||||
|
@ -145,7 +137,7 @@ uint32 Imrt1052AdcRead(void *dev, struct BusBlockReadParam *read_param)
|
||||||
adc_channel_config_t ch_cfg;
|
adc_channel_config_t ch_cfg;
|
||||||
|
|
||||||
#ifdef BSP_USING_ADC1
|
#ifdef BSP_USING_ADC1
|
||||||
if (0 == strncmp(adc_dev->haldev.dev_name, ADC1_DEV_NAME, NAME_NUM_MAX)) {
|
if (0 == strncmp(adc_dev->haldev.dev_name, ADC_1_DEVICE_NAME_0, NAME_NUM_MAX)) {
|
||||||
/* Configure the user channel and interrupt. */
|
/* Configure the user channel and interrupt. */
|
||||||
ch_cfg.channelNumber = ADC1_USER_CHANNEL;
|
ch_cfg.channelNumber = ADC1_USER_CHANNEL;
|
||||||
ch_cfg.enableInterruptOnConversionCompleted = true;
|
ch_cfg.enableInterruptOnConversionCompleted = true;
|
||||||
|
@ -160,7 +152,7 @@ uint32 Imrt1052AdcRead(void *dev, struct BusBlockReadParam *read_param)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BSP_USING_ADC2
|
#ifdef BSP_USING_ADC2
|
||||||
if (0 == strncmp(adc_dev->haldev.dev_name, ADC2_DEV_NAME, NAME_NUM_MAX)) {
|
if (0 == strncmp(adc_dev->haldev.dev_name, ADC_2_DEVICE_NAME_0, NAME_NUM_MAX)) {
|
||||||
/* Configure the user channel and interrupt. */
|
/* Configure the user channel and interrupt. */
|
||||||
ch_cfg.channelNumber = ADC2_USER_CHANNEL;
|
ch_cfg.channelNumber = ADC2_USER_CHANNEL;
|
||||||
ch_cfg.enableInterruptOnConversionCompleted = true;
|
ch_cfg.enableInterruptOnConversionCompleted = true;
|
||||||
|
@ -226,18 +218,18 @@ int Imrt1052HwAdcInit(void)
|
||||||
|
|
||||||
adc1_drv.configure = Imrt1052AdcDrvConfigure;
|
adc1_drv.configure = Imrt1052AdcDrvConfigure;
|
||||||
|
|
||||||
ret = AdcBusInit(&adc1_bus, ADC1_BUS_NAME);
|
ret = AdcBusInit(&adc1_bus, ADC_BUS_NAME_1);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("ADC1 bus init error %d\n", ret);
|
KPrintf("ADC1 bus init error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = AdcDriverInit(&adc1_drv, ADC1_DRV_NAME);
|
ret = AdcDriverInit(&adc1_drv, ADC_DRV_NAME_1);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("ADC1 driver init error %d\n", ret);
|
KPrintf("ADC1 driver init error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
ret = AdcDriverAttachToBus(ADC1_DRV_NAME, ADC1_BUS_NAME);
|
ret = AdcDriverAttachToBus(ADC_DRV_NAME_1, ADC_BUS_NAME_1);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("ADC1 driver attach error %d\n", ret);
|
KPrintf("ADC1 driver attach error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
|
@ -245,13 +237,13 @@ int Imrt1052HwAdcInit(void)
|
||||||
|
|
||||||
adc1_dev.adc_dev_done = &dev_done;
|
adc1_dev.adc_dev_done = &dev_done;
|
||||||
|
|
||||||
ret = AdcDeviceRegister(&adc1_dev, (void *)&adc1_cfg, ADC1_DEV_NAME);
|
ret = AdcDeviceRegister(&adc1_dev, (void *)&adc1_cfg, ADC_1_DEVICE_NAME_0);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("ADC1 device register error %d\n", ret);
|
KPrintf("ADC1 device register error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = AdcDeviceAttachToBus(ADC1_DEV_NAME, ADC1_BUS_NAME);
|
ret = AdcDeviceAttachToBus(ADC_1_DEVICE_NAME_0, ADC_BUS_NAME_1);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("ADC1 device register error %d\n", ret);
|
KPrintf("ADC1 device register error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
|
@ -266,18 +258,18 @@ int Imrt1052HwAdcInit(void)
|
||||||
|
|
||||||
adc2_drv.configure = Imrt1052AdcDrvConfigure;
|
adc2_drv.configure = Imrt1052AdcDrvConfigure;
|
||||||
|
|
||||||
ret = AdcBusInit(&adc2_bus, ADC2_BUS_NAME);
|
ret = AdcBusInit(&adc2_bus, ADC_BUS_NAME_2);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("ADC2 bus init error %d\n", ret);
|
KPrintf("ADC2 bus init error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = AdcDriverInit(&adc2_drv, ADC2_DRV_NAME);
|
ret = AdcDriverInit(&adc2_drv, ADC_DRV_NAME_2);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("ADC2 driver init error %d\n", ret);
|
KPrintf("ADC2 driver init error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
ret = AdcDriverAttachToBus(ADC2_DRV_NAME, ADC2_BUS_NAME);
|
ret = AdcDriverAttachToBus(ADC_DRV_NAME_2, ADC_BUS_NAME_2);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("ADC2 driver attach error %d\n", ret);
|
KPrintf("ADC2 driver attach error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
|
@ -285,13 +277,13 @@ int Imrt1052HwAdcInit(void)
|
||||||
|
|
||||||
adc2_dev.adc_dev_done = &dev_done;
|
adc2_dev.adc_dev_done = &dev_done;
|
||||||
|
|
||||||
ret = AdcDeviceRegister(&adc2_dev, (void *)&adc2_cfg, ADC2_DEV_NAME);
|
ret = AdcDeviceRegister(&adc2_dev, (void *)&adc2_cfg, ADC_2_DEVICE_NAME_0);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("ADC2 device register error %d\n", ret);
|
KPrintf("ADC2 device register error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = AdcDeviceAttachToBus(ADC2_DEV_NAME, ADC2_BUS_NAME);
|
ret = AdcDeviceAttachToBus(ADC_2_DEVICE_NAME_0, ADC_BUS_NAME_2);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("ADC2 device register error %d\n", ret);
|
KPrintf("ADC2 device register error %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
|
|
|
@ -9,4 +9,3 @@ if BSP_USING_I2C
|
||||||
string "i2c bus 1 device 0 name"
|
string "i2c bus 1 device 0 name"
|
||||||
default "i2c1_dev0"
|
default "i2c1_dev0"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -1,32 +1,34 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020 RT-Thread Development Team
|
* Copyright (c) 2022 AIIT XUOS Lab
|
||||||
*
|
* XiUOS is licensed under Mulan PSL v2.
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
*
|
* You may obtain a copy of Mulan PSL v2 at:
|
||||||
* Change Logs:
|
* http://license.coscl.org.cn/MulanPSL2
|
||||||
* Date Author Notes
|
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
* 2012-04-25 weety first version
|
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
* See the Mulan PSL v2 for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file connect_i2c.c
|
* @file connect_i2c.c
|
||||||
* @brief support stm32f407-st-discovery-board i2c function and register to bus framework
|
* @brief support ok1052-c-board i2c function and register to bus framework
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @author AIIT XUOS Lab
|
* @author AIIT XUOS Lab
|
||||||
* @date 2021-04-25
|
* @date 2022-1-25
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*************************************************
|
/*************************************************
|
||||||
File name: connect_i2c.c
|
File name: connect_i2c.c
|
||||||
Description: support stm32f407-st-discovery-board i2c configure and i2c bus register function
|
Description: support ok1052-c-board i2c configure and i2c bus register function
|
||||||
Others: take RT-Thread v4.0.2/components/drivers/i2c/i2c-bit-ops.c for references
|
Others: take RT-Thread v4.0.2/components/drivers/i2c/i2c-bit-ops.c for references
|
||||||
https://github.com/RT-Thread/rt-thread/tree/v4.0.2
|
https://github.com/RT-Thread/rt-thread/tree/v4.0.2
|
||||||
History:
|
History:
|
||||||
1. Date: 2021-04-25
|
1. Date: 2022-1-25
|
||||||
Author: AIIT XUOS Lab
|
Author: AIIT XUOS Lab
|
||||||
Modification:
|
Modification:
|
||||||
1. support stm32f407-st-discovery-board i2c bit configure, write and read
|
1. support ok1052-c-board i2c bit configure, write and read
|
||||||
2. support stm32f407-st-discovery-board i2c bus device and driver register
|
2. support ok1052-c-board i2c bus device and driver register
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
#include <board.h>
|
#include <board.h>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file connect_flash_spi.c
|
* @file connect_flash_spi.c
|
||||||
* @brief support stm32f407-st-discovery-board spi flash function and register to bus framework
|
* @brief support ok1052-c-board spi flash function and register to bus framework
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @author AIIT XUOS Lab
|
* @author AIIT XUOS Lab
|
||||||
* @date 2021-04-25
|
* @date 2021-04-25
|
||||||
|
@ -18,15 +18,15 @@
|
||||||
|
|
||||||
/*************************************************
|
/*************************************************
|
||||||
File name: connect_flash_spi.c
|
File name: connect_flash_spi.c
|
||||||
Description: support stm32f407-st-discovery-board spi flash bus register function
|
Description: support ok1052-c-board spi flash bus register function
|
||||||
Others: take RT-Thread v4.0.2/bsp/stm32/stm32f407-atk-explorer/board/ports/spi-flash-init.c
|
Others: take RT-Thread v4.0.2/bsp/stm32/stm32f407-atk-explorer/board/ports/spi-flash-init.c
|
||||||
https://github.com/RT-Thread/rt-thread/tree/v4.0.2
|
https://github.com/RT-Thread/rt-thread/tree/v4.0.2
|
||||||
History:
|
History:
|
||||||
1. Date: 2021-04-25
|
1. Date: 2021-04-25
|
||||||
Author: AIIT XUOS Lab
|
Author: AIIT XUOS Lab
|
||||||
Modification:
|
Modification:
|
||||||
1. support stm32f407-st-discovery-board spi flash register to spi bus
|
1. support ok1052-c-board spi flash register to spi bus
|
||||||
2. support stm32f407-st-discovery-board spi flash init
|
2. support ok1052-c-board spi flash init
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
//#include "connect_spi.h"
|
//#include "connect_spi.h"
|
||||||
|
|
|
@ -1,39 +1,23 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020 RT-Thread Development Team
|
* Copyright (c) 2022 AIIT XUOS Lab
|
||||||
*
|
* XiUOS is licensed under Mulan PSL v2.
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
*
|
* You may obtain a copy of Mulan PSL v2 at:
|
||||||
* Change Logs:
|
* http://license.coscl.org.cn/MulanPSL2
|
||||||
* Date Author Notes
|
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
* 2018-11-5 SummerGift first version
|
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
* 2018-12-11 greedyhao Porting for stm32f7xx
|
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
* 2019-01-03 zylx modify DMA initialization and spixfer function
|
* See the Mulan PSL v2 for more details.
|
||||||
* 2020-01-15 whj4674672 Porting for stm32h7xx
|
|
||||||
* 2020-06-18 thread-liu Porting for stm32mp1xx
|
|
||||||
* 2020-10-14 Dozingfiretruck Porting for stm32wbxx
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file connect_spi.c
|
* @file connect_adc.c
|
||||||
* @brief support stm32f407-st-discovery-board spi function and register to bus framework
|
* @brief Demo for ADC function
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @author AIIT XUOS Lab
|
* @author AIIT XUOS Lab
|
||||||
* @date 2021-04-25
|
* @date 2022.1.18
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*************************************************
|
|
||||||
File name: connect_spi.c
|
|
||||||
Description: support stm32f407-st-discovery-board spi configure and spi bus register function
|
|
||||||
Others: take RT-Thread v4.0.2/bsp/stm32/libraries/HAL_Drivers/drv_spi.c for references
|
|
||||||
https://github.com/RT-Thread/rt-thread/tree/v4.0.2
|
|
||||||
History:
|
|
||||||
1. Date: 2021-04-25
|
|
||||||
Author: AIIT XUOS Lab
|
|
||||||
Modification:
|
|
||||||
1. support stm32f407-st-discovery-board spi configure, write and read
|
|
||||||
2. support stm32f407-st-discovery-board spi bus device and driver register
|
|
||||||
*************************************************/
|
|
||||||
|
|
||||||
#include "stm32f4xx.h"
|
#include "stm32f4xx.h"
|
||||||
#include "connect_spi.h"
|
#include "connect_spi.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
|
Loading…
Reference in New Issue