[apollo2] auto & manual formatted
This commit is contained in:
parent
1ba020f3c8
commit
fd0ce832e1
|
@ -1,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : main.c
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : adc.c
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
@ -32,15 +18,15 @@
|
||||||
struct rt_messagequeue adcbat_mq;
|
struct rt_messagequeue adcbat_mq;
|
||||||
|
|
||||||
#define BATTERY_GPIO 35 /* Battery */
|
#define BATTERY_GPIO 35 /* Battery */
|
||||||
#define BATTERY_ADC_PIN AM_HAL_PIN_35_ADCSE7
|
#define BATTERY_ADC_PIN AM_HAL_PIN_35_ADCSE7
|
||||||
#define BATTERY_ADC_CHANNEL AM_HAL_ADC_SLOT_CHSEL_SE7 /* BATTERY ADC采集通道 */
|
#define BATTERY_ADC_CHANNEL AM_HAL_ADC_SLOT_CHSEL_SE7 /* BATTERY ADC采集通道 */
|
||||||
#define BATTERY_ADC_CHANNELNUM 7 /* BATTERY ADC采集通道号 */
|
#define BATTERY_ADC_CHANNELNUM 7 /* BATTERY ADC采集通道号 */
|
||||||
|
|
||||||
#define ADC_CTIMER_NUM 3 /* ADC使用定时器 */
|
#define ADC_CTIMER_NUM 3 /* ADC使用定时器 */
|
||||||
#define ADC_CTIMER_COUNT (2048/512 - 1)
|
#define ADC_CTIMER_COUNT (2048/512 - 1)
|
||||||
|
|
||||||
#define ADC_CHANNEL_NUM 1 /* ADC采集通道个数 */
|
#define ADC_CHANNEL_NUM 1 /* ADC采集通道个数 */
|
||||||
#define ADC_SAMPLE_NUM 8 /* ADC采样个数 */
|
#define ADC_SAMPLE_NUM 8 /* ADC采样个数 */
|
||||||
|
|
||||||
rt_uint8_t bat_adc_cnt = 0;
|
rt_uint8_t bat_adc_cnt = 0;
|
||||||
static rt_uint8_t am_adcbat_buffer_pool[256];
|
static rt_uint8_t am_adcbat_buffer_pool[256];
|
||||||
|
@ -52,7 +38,7 @@ rt_uint8_t am_adc_data_get(rt_uint8_t channel, rt_int16_t *buff, rt_uint16_t siz
|
||||||
|
|
||||||
if (channel == BATTERY_ADC_CHANNELNUM)
|
if (channel == BATTERY_ADC_CHANNELNUM)
|
||||||
{
|
{
|
||||||
/* wait adc message forever */
|
/* wait adc message forever */
|
||||||
rt_mq_recv(&adcbat_mq, adc_bufftemp, 32, RT_WAITING_FOREVER);
|
rt_mq_recv(&adcbat_mq, adc_bufftemp, 32, RT_WAITING_FOREVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : adc.h
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : board.c
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : board.h
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : flash.c
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
@ -77,7 +63,7 @@ static rt_err_t rt_flash_control(rt_device_t dev, int cmd, void *args)
|
||||||
ui32CurrentPage = AM_HAL_FLASH_ADDR2PAGE(erase->addrstart);
|
ui32CurrentPage = AM_HAL_FLASH_ADDR2PAGE(erase->addrstart);
|
||||||
ui32CurrentBlock = AM_HAL_FLASH_ADDR2INST(erase->addrstart);
|
ui32CurrentBlock = AM_HAL_FLASH_ADDR2INST(erase->addrstart);
|
||||||
|
|
||||||
am_hal_flash_page_erase(AM_HAL_FLASH_PROGRAM_KEY, ui32CurrentBlock, ui32CurrentPage); //µ¥ÉÈÇø²Á³ýÃüÁî
|
am_hal_flash_page_erase(AM_HAL_FLASH_PROGRAM_KEY, ui32CurrentBlock, ui32CurrentPage); //单扇区擦除命令
|
||||||
erase->addrstart += 8192;
|
erase->addrstart += 8192;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : flash.h
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : gpio.c
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
@ -70,7 +56,7 @@ void am_pin_write(rt_device_t dev, rt_base_t pin, rt_base_t value)
|
||||||
else if (value == PIN_HIGH)
|
else if (value == PIN_HIGH)
|
||||||
{
|
{
|
||||||
am_hal_gpio_out_bit_set(pin);
|
am_hal_gpio_out_bit_set(pin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int am_pin_read(rt_device_t dev, rt_base_t pin)
|
int am_pin_read(rt_device_t dev, rt_base_t pin)
|
||||||
|
|
|
@ -1,27 +1,13 @@
|
||||||
/*
|
/*
|
||||||
* File : gpio.h
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
* 2017-09-16 Haley the first version
|
* 2017-09-16 Haley the first version
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __GPIO_H
|
#ifndef __GPIO_H
|
||||||
#define __GPIO_H
|
#define __GPIO_H
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File :_i2c.c
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
@ -133,7 +119,7 @@ static const struct rt_i2c_bus_device_ops am_i2c_ops =
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef RT_USING_I2C0
|
#ifdef RT_USING_I2C0
|
||||||
static struct am_i2c_bus am_i2c_bus_0 =
|
static struct am_i2c_bus am_i2c_bus_0 =
|
||||||
{
|
{
|
||||||
{0},
|
{0},
|
||||||
AM_I2C0_IOM_INST
|
AM_I2C0_IOM_INST
|
||||||
|
@ -141,7 +127,7 @@ static struct am_i2c_bus am_i2c_bus_0 =
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RT_USING_I2C1
|
#ifdef RT_USING_I2C1
|
||||||
static struct am_i2c_bus am_i2c_bus_1 =
|
static struct am_i2c_bus am_i2c_bus_1 =
|
||||||
{
|
{
|
||||||
{1},
|
{1},
|
||||||
AM_I2C1_IOM_INST
|
AM_I2C1_IOM_INST
|
||||||
|
@ -149,7 +135,7 @@ static struct am_i2c_bus am_i2c_bus_1 =
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RT_USING_I2C2
|
#ifdef RT_USING_I2C2
|
||||||
static struct am_i2c_bus am_i2c_bus_2 =
|
static struct am_i2c_bus am_i2c_bus_2 =
|
||||||
{
|
{
|
||||||
{2},
|
{2},
|
||||||
AM_I2C2_IOM_INST
|
AM_I2C2_IOM_INST
|
||||||
|
@ -157,7 +143,7 @@ static struct am_i2c_bus am_i2c_bus_2 =
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RT_USING_I2C3
|
#ifdef RT_USING_I2C3
|
||||||
static struct am_i2c_bus am_i2c_bus_3 =
|
static struct am_i2c_bus am_i2c_bus_3 =
|
||||||
{
|
{
|
||||||
{3},
|
{3},
|
||||||
AM_I2C3_IOM_INST
|
AM_I2C3_IOM_INST
|
||||||
|
@ -165,7 +151,7 @@ static struct am_i2c_bus am_i2c_bus_3 =
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RT_USING_I2C4
|
#ifdef RT_USING_I2C4
|
||||||
static struct am_i2c_bus am_i2c_bus_4 =
|
static struct am_i2c_bus am_i2c_bus_4 =
|
||||||
{
|
{
|
||||||
{4},
|
{4},
|
||||||
AM_I2C4_IOM_INST
|
AM_I2C4_IOM_INST
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : i2c.h
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File :_led.c
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : led.h
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File :_pdm.c
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
@ -66,7 +52,7 @@ rt_uint8_t am_pdm_data_get(rt_uint8_t *buff, rt_uint16_t size)
|
||||||
{
|
{
|
||||||
rt_uint8_t pdm_rbufftemp[340];
|
rt_uint8_t pdm_rbufftemp[340];
|
||||||
|
|
||||||
/* wait pdm message forever */
|
/* wait pdm message forever */
|
||||||
rt_mq_recv(&pdm_mq, pdm_rbufftemp, 340, RT_WAITING_FOREVER);
|
rt_mq_recv(&pdm_mq, pdm_rbufftemp, 340, RT_WAITING_FOREVER);
|
||||||
|
|
||||||
/* copy the data */
|
/* copy the data */
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : pdm.h
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File :_pwm.c
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : pwm.h
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File :_rtc.c
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
@ -116,7 +102,7 @@ int rt_hw_rtc_init(void)
|
||||||
/* Select LFRC for RTC clock source */
|
/* Select LFRC for RTC clock source */
|
||||||
am_hal_rtc_osc_select(AM_HAL_RTC_OSC_LFRC);
|
am_hal_rtc_osc_select(AM_HAL_RTC_OSC_LFRC);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if RTC_CLK_SRC == XT
|
#if RTC_CLK_SRC == XT
|
||||||
/* Enable the XT for the RTC */
|
/* Enable the XT for the RTC */
|
||||||
am_hal_clkgen_osc_start(AM_HAL_CLKGEN_OSC_XT);
|
am_hal_clkgen_osc_start(AM_HAL_CLKGEN_OSC_XT);
|
||||||
|
@ -129,12 +115,12 @@ int rt_hw_rtc_init(void)
|
||||||
am_hal_rtc_osc_enable();
|
am_hal_rtc_osc_enable();
|
||||||
|
|
||||||
/* register rtc device */
|
/* register rtc device */
|
||||||
rtc.type = RT_Device_Class_RTC;
|
rtc.type = RT_Device_Class_RTC;
|
||||||
rtc.init = RT_NULL;
|
rtc.init = RT_NULL;
|
||||||
rtc.open = rt_rtc_open;
|
rtc.open = rt_rtc_open;
|
||||||
rtc.close = RT_NULL;
|
rtc.close = RT_NULL;
|
||||||
rtc.read = rt_rtc_read;
|
rtc.read = rt_rtc_read;
|
||||||
rtc.write = RT_NULL;
|
rtc.write = RT_NULL;
|
||||||
rtc.control = rt_rtc_control;
|
rtc.control = rt_rtc_control;
|
||||||
|
|
||||||
/* no private */
|
/* no private */
|
||||||
|
|
|
@ -1,27 +1,13 @@
|
||||||
/*
|
/*
|
||||||
* File : rtc.h
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
* 2017-09-14 Haley the first version
|
* 2017-09-14 Haley the first version
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __RTC_H
|
#ifndef __RTC_H
|
||||||
#define __RTC_H
|
#define __RTC_H
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : smbus.c
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
@ -42,8 +28,8 @@
|
||||||
#define mSDA_OUT() am_hal_gpio_pin_config(SMBUS_GPIO_SDA, AM_HAL_GPIO_OUTPUT) /* Set SDA as Output */
|
#define mSDA_OUT() am_hal_gpio_pin_config(SMBUS_GPIO_SDA, AM_HAL_GPIO_OUTPUT) /* Set SDA as Output */
|
||||||
#define mSCL_OUT() am_hal_gpio_pin_config(SMBUS_GPIO_SCL, AM_HAL_GPIO_OUTPUT) /* Set SCL as Output */
|
#define mSCL_OUT() am_hal_gpio_pin_config(SMBUS_GPIO_SCL, AM_HAL_GPIO_OUTPUT) /* Set SCL as Output */
|
||||||
|
|
||||||
#define ACK 0
|
#define ACK 0
|
||||||
#define NACK 1
|
#define NACK 1
|
||||||
|
|
||||||
/* SCL keep time */
|
/* SCL keep time */
|
||||||
static void keep_delay(void)
|
static void keep_delay(void)
|
||||||
|
@ -60,7 +46,7 @@ static void few_delay(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static rt_uint8_t am_smbus_send_bit(rt_uint8_t send_bit)
|
static rt_uint8_t am_smbus_send_bit(rt_uint8_t send_bit)
|
||||||
{
|
{
|
||||||
mSDA_OUT();
|
mSDA_OUT();
|
||||||
few_delay();
|
few_delay();
|
||||||
|
|
||||||
|
@ -128,7 +114,7 @@ static void am_smbus_stop_bit(void)
|
||||||
|
|
||||||
static rt_uint8_t am_smbus_tx_byte(rt_uint8_t tx_byte)
|
static rt_uint8_t am_smbus_tx_byte(rt_uint8_t tx_byte)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
rt_uint8_t ack_bit;
|
rt_uint8_t ack_bit;
|
||||||
rt_uint8_t bit_out;
|
rt_uint8_t bit_out;
|
||||||
|
|
||||||
|
@ -176,7 +162,7 @@ rt_uint8_t am_smbus_tx_then_tx(rt_uint8_t SlaveAddress, rt_uint8_t command, rt_u
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
am_smbus_start_bit(); /* Start condition */
|
am_smbus_start_bit(); /* Start condition */
|
||||||
|
|
||||||
if(am_smbus_tx_byte(SlaveAddress)) /* Send SlaveAddress and write */
|
if(am_smbus_tx_byte(SlaveAddress)) /* Send SlaveAddress and write */
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : smbus.h
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : spi.c
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
@ -180,7 +166,7 @@ static rt_uint32_t xfer(struct rt_spi_device *device, struct rt_spi_message* mes
|
||||||
am_hal_gpio_out_bit_clear(am_spi_cs->chip_select);
|
am_hal_gpio_out_bit_clear(am_spi_cs->chip_select);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ¶ÁÊý¾Ý
|
// 读数据
|
||||||
if (recv_ptr != RT_NULL)
|
if (recv_ptr != RT_NULL)
|
||||||
{
|
{
|
||||||
while (u32BytesRemaining)
|
while (u32BytesRemaining)
|
||||||
|
@ -213,7 +199,7 @@ static rt_uint32_t xfer(struct rt_spi_device *device, struct rt_spi_message* mes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// дÊý¾Ý
|
// 写数据
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
while (u32BytesRemaining)
|
while (u32BytesRemaining)
|
||||||
|
@ -225,7 +211,7 @@ static rt_uint32_t xfer(struct rt_spi_device *device, struct rt_spi_message* mes
|
||||||
u32TransferSize = 64;
|
u32TransferSize = 64;
|
||||||
am_hal_iom_spi_write(am_spi_bus->u32Module, am_spi_cs->chip_select,
|
am_hal_iom_spi_write(am_spi_bus->u32Module, am_spi_cs->chip_select,
|
||||||
(uint32_t *)send_ptr, u32TransferSize, AM_HAL_IOM_RAW);
|
(uint32_t *)send_ptr, u32TransferSize, AM_HAL_IOM_RAW);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -257,7 +243,7 @@ static const struct rt_spi_ops am_spi_ops =
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef RT_USING_SPI0
|
#ifdef RT_USING_SPI0
|
||||||
static struct am_spi_bus am_spi_bus_0 =
|
static struct am_spi_bus am_spi_bus_0 =
|
||||||
{
|
{
|
||||||
{0},
|
{0},
|
||||||
AM_SPI0_IOM_INST
|
AM_SPI0_IOM_INST
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : spi.h
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
@ -27,7 +13,7 @@
|
||||||
|
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
|
|
||||||
/* ƬѡÐźŽṹÉùÃ÷ */
|
/* 片选信号结构声明 */
|
||||||
struct am_spi_cs
|
struct am_spi_cs
|
||||||
{
|
{
|
||||||
rt_uint32_t chip_select;
|
rt_uint32_t chip_select;
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : uart.c
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
@ -164,11 +150,11 @@ static rt_err_t am_configure(struct rt_serial_device *serial, struct serial_conf
|
||||||
else if (cfg->stop_bits == STOP_BITS_2)
|
else if (cfg->stop_bits == STOP_BITS_2)
|
||||||
uart_cfg.bTwoStopBits = true;
|
uart_cfg.bTwoStopBits = true;
|
||||||
|
|
||||||
if (cfg->parity == PARITY_NONE)
|
if (cfg->parity == PARITY_NONE)
|
||||||
uart_cfg.ui32Parity = AM_HAL_UART_PARITY_NONE;
|
uart_cfg.ui32Parity = AM_HAL_UART_PARITY_NONE;
|
||||||
else if (cfg->parity == PARITY_ODD)
|
else if (cfg->parity == PARITY_ODD)
|
||||||
uart_cfg.ui32Parity = AM_HAL_UART_PARITY_ODD;
|
uart_cfg.ui32Parity = AM_HAL_UART_PARITY_ODD;
|
||||||
else if (cfg->parity == PARITY_EVEN)
|
else if (cfg->parity == PARITY_EVEN)
|
||||||
uart_cfg.ui32Parity = AM_HAL_UART_PARITY_EVEN;
|
uart_cfg.ui32Parity = AM_HAL_UART_PARITY_EVEN;
|
||||||
|
|
||||||
uart_cfg.ui32FlowCtrl = AM_HAL_UART_FLOW_CTRL_NONE;
|
uart_cfg.ui32FlowCtrl = AM_HAL_UART_FLOW_CTRL_NONE;
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : uart.h
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
|
Loading…
Reference in New Issue