[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
|
||||||
|
@ -33,14 +19,14 @@ 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];
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* 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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
@ -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,21 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* 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
|
||||||
|
|
|
@ -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)
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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