mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-09 20:45:41 +08:00
Merge pull request #1019 from TanekLiang/stm32l476-update-pin
[bsp] stm32l476 bsp update
This commit is contained in:
18 files changed
+1875
-535
No files matched your search
@@ -0,0 +1,184 @@
|
||||
#
|
||||
# Automatically generated file; DO NOT EDIT.
|
||||
# RT-Thread Configuration
|
||||
#
|
||||
|
||||
#
|
||||
# RT-Thread Kernel
|
||||
#
|
||||
CONFIG_RT_NAME_MAX=8
|
||||
CONFIG_RT_ALIGN_SIZE=4
|
||||
# CONFIG_RT_THREAD_PRIORITY_8 is not set
|
||||
CONFIG_RT_THREAD_PRIORITY_32=y
|
||||
# CONFIG_RT_THREAD_PRIORITY_256 is not set
|
||||
CONFIG_RT_THREAD_PRIORITY_MAX=32
|
||||
CONFIG_RT_TICK_PER_SECOND=100
|
||||
CONFIG_RT_DEBUG=y
|
||||
CONFIG_RT_USING_OVERFLOW_CHECK=y
|
||||
CONFIG_RT_DEBUG_INIT=0
|
||||
CONFIG_RT_DEBUG_THREAD=0
|
||||
CONFIG_RT_USING_HOOK=y
|
||||
CONFIG_IDLE_THREAD_STACK_SIZE=256
|
||||
# CONFIG_RT_USING_TIMER_SOFT is not set
|
||||
|
||||
#
|
||||
# Inter-Thread communication
|
||||
#
|
||||
CONFIG_RT_USING_SEMAPHORE=y
|
||||
CONFIG_RT_USING_MUTEX=y
|
||||
CONFIG_RT_USING_EVENT=y
|
||||
CONFIG_RT_USING_MAILBOX=y
|
||||
CONFIG_RT_USING_MESSAGEQUEUE=y
|
||||
# CONFIG_RT_USING_SIGNALS is not set
|
||||
|
||||
#
|
||||
# Memory Management
|
||||
#
|
||||
CONFIG_RT_USING_MEMPOOL=y
|
||||
# CONFIG_RT_USING_MEMHEAP is not set
|
||||
# CONFIG_RT_USING_NOHEAP is not set
|
||||
CONFIG_RT_USING_SMALL_MEM=y
|
||||
# CONFIG_RT_USING_SLAB is not set
|
||||
CONFIG_RT_USING_HEAP=y
|
||||
|
||||
#
|
||||
# Kernel Device Object
|
||||
#
|
||||
CONFIG_RT_USING_DEVICE=y
|
||||
# CONFIG_RT_USING_INTERRUPT_INFO is not set
|
||||
CONFIG_RT_USING_CONSOLE=y
|
||||
CONFIG_RT_CONSOLEBUF_SIZE=128
|
||||
CONFIG_RT_CONSOLE_DEVICE_NAME="uart2"
|
||||
# CONFIG_RT_USING_MODULE is not set
|
||||
|
||||
#
|
||||
# RT-Thread Components
|
||||
#
|
||||
CONFIG_RT_USING_COMPONENTS_INIT=y
|
||||
# CONFIG_RT_USING_USER_MAIN is not set
|
||||
|
||||
#
|
||||
# C++ features
|
||||
#
|
||||
# CONFIG_RT_USING_CPLUSPLUS is not set
|
||||
|
||||
#
|
||||
# Command shell
|
||||
#
|
||||
CONFIG_RT_USING_FINSH=y
|
||||
CONFIG_FINSH_USING_HISTORY=y
|
||||
CONFIG_FINSH_USING_SYMTAB=y
|
||||
CONFIG_FINSH_USING_DESCRIPTION=y
|
||||
CONFIG_FINSH_THREAD_PRIORITY=20
|
||||
CONFIG_FINSH_THREAD_STACK_SIZE=4096
|
||||
CONFIG_FINSH_CMD_SIZE=80
|
||||
# CONFIG_FINSH_USING_AUTH is not set
|
||||
CONFIG_FINSH_USING_MSH=y
|
||||
CONFIG_FINSH_USING_MSH_DEFAULT=y
|
||||
# CONFIG_FINSH_USING_MSH_ONLY is not set
|
||||
|
||||
#
|
||||
# Device virtual file system
|
||||
#
|
||||
# CONFIG_RT_USING_DFS is not set
|
||||
|
||||
#
|
||||
# Device Drivers
|
||||
#
|
||||
CONFIG_RT_USING_DEVICE_IPC=y
|
||||
CONFIG_RT_USING_SERIAL=y
|
||||
# CONFIG_RT_USING_CAN is not set
|
||||
# CONFIG_RT_USING_HWTIMER is not set
|
||||
# CONFIG_RT_USING_I2C is not set
|
||||
CONFIG_RT_USING_PIN=y
|
||||
# CONFIG_RT_USING_MTD_NOR is not set
|
||||
# CONFIG_RT_USING_MTD_NAND is not set
|
||||
# CONFIG_RT_USING_RTC is not set
|
||||
# CONFIG_RT_USING_SDIO is not set
|
||||
# CONFIG_RT_USING_SPI is not set
|
||||
# CONFIG_RT_USING_WDT is not set
|
||||
# CONFIG_RT_USING_USB_HOST is not set
|
||||
# CONFIG_RT_USING_USB_DEVICE is not set
|
||||
|
||||
#
|
||||
# POSIX layer and C standard library
|
||||
#
|
||||
# CONFIG_RT_USING_LIBC is not set
|
||||
# CONFIG_RT_USING_PTHREADS is not set
|
||||
|
||||
#
|
||||
# Network stack
|
||||
#
|
||||
|
||||
#
|
||||
# light weight TCP/IP stack
|
||||
#
|
||||
# CONFIG_RT_USING_LWIP is not set
|
||||
|
||||
#
|
||||
# Modbus master and slave stack
|
||||
#
|
||||
# CONFIG_RT_USING_MODBUS is not set
|
||||
|
||||
#
|
||||
# RT-Thread UI Engine
|
||||
#
|
||||
# CONFIG_RT_USING_GUIENGINE is not set
|
||||
|
||||
#
|
||||
# VBUS(Virtual Software BUS)
|
||||
#
|
||||
# CONFIG_RT_USING_VBUS is not set
|
||||
|
||||
#
|
||||
# RT-Thread online packages
|
||||
#
|
||||
|
||||
#
|
||||
# system packages
|
||||
#
|
||||
# CONFIG_PKG_USING_PARTITION is not set
|
||||
# CONFIG_PKG_USING_SQLITE is not set
|
||||
|
||||
#
|
||||
# IoT - internet of things
|
||||
#
|
||||
# CONFIG_PKG_USING_PAHOMQTT is not set
|
||||
# CONFIG_PKG_USING_WEBCLIENT is not set
|
||||
# CONFIG_PKG_USING_MONGOOSE is not set
|
||||
# CONFIG_PKG_USING_WEBTERMINAL is not set
|
||||
# CONFIG_PKG_USING_CJSON is not set
|
||||
# CONFIG_PKG_USING_EZXML is not set
|
||||
|
||||
#
|
||||
# Marvell WiFi
|
||||
#
|
||||
# CONFIG_PKG_USING_MARVELLWIFI is not set
|
||||
|
||||
#
|
||||
# security packages
|
||||
#
|
||||
# CONFIG_PKG_USING_MBEDTLS is not set
|
||||
|
||||
#
|
||||
# language packages
|
||||
#
|
||||
# CONFIG_PKG_USING_JERRYSCRIPT is not set
|
||||
|
||||
#
|
||||
# multimedia packages
|
||||
#
|
||||
# CONFIG_PKG_USING_FASTLZ is not set
|
||||
|
||||
#
|
||||
# tools packages
|
||||
#
|
||||
# CONFIG_PKG_USING_CMBACKTRACE is not set
|
||||
# CONFIG_PKG_USING_EASYLOGGER is not set
|
||||
# CONFIG_PKG_USING_SYSTEMVIEW is not set
|
||||
|
||||
#
|
||||
# miscellaneous packages
|
||||
#
|
||||
# CONFIG_PKG_USING_HELLO is not set
|
||||
CONFIG_RT_USING_UART2=y
|
||||
@@ -0,0 +1,23 @@
|
||||
mainmenu "RT-Thread Configuration"
|
||||
|
||||
config $BSP_DIR
|
||||
string
|
||||
option env="BSP_ROOT"
|
||||
default "."
|
||||
|
||||
config $RTT_DIR
|
||||
string
|
||||
option env="RTT_ROOT"
|
||||
default: "rt-thread"
|
||||
|
||||
# you can change the RTT_ROOT default: "rt-thread"
|
||||
# example : default "F:/git_repositories/rt-thread"
|
||||
|
||||
config $PKGS_DIR
|
||||
string
|
||||
option env="PKGS_ROOT"
|
||||
default "packages"
|
||||
|
||||
source "$RTT_DIR/KConfig"
|
||||
source "$PKGS_DIR/KConfig"
|
||||
source "$BSP_DIR/drivers/Kconfig"
|
||||
@@ -15,7 +15,7 @@ except:
|
||||
print RTT_ROOT
|
||||
exit(-1)
|
||||
|
||||
TARGET = 'rtthread-stm32f42x.' + rtconfig.TARGET_EXT
|
||||
TARGET = 'rtthread-stm32l476.' + rtconfig.TARGET_EXT
|
||||
|
||||
env = Environment(tools = ['mingw'],
|
||||
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
|
||||
|
||||
@@ -1,16 +1,25 @@
|
||||
/*
|
||||
* File : application.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Development Team
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* 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:
|
||||
* Date Author Notes
|
||||
* 2009-01-05 Bernard the first version
|
||||
* 2014-04-27 Bernard make code cleanup.
|
||||
* 2017-11-20 tanek first implementation
|
||||
*/
|
||||
|
||||
#include <board.h>
|
||||
@@ -44,8 +53,8 @@
|
||||
#include <rtgui/driver.h>
|
||||
#endif
|
||||
|
||||
//rt_module_t module_ptr;
|
||||
#define DATA_PATH "/Data"
|
||||
extern void rt_hw_userled_init(void);
|
||||
|
||||
void rt_init_thread_entry(void* parameter)
|
||||
{
|
||||
/* initialization RT-Thread Components */
|
||||
@@ -53,6 +62,8 @@ void rt_init_thread_entry(void* parameter)
|
||||
rt_components_init();
|
||||
#endif
|
||||
|
||||
rt_hw_userled_init();
|
||||
|
||||
}
|
||||
int rt_application_init()
|
||||
{
|
||||
@@ -65,8 +76,6 @@ int rt_application_init()
|
||||
|
||||
if (tid != RT_NULL)
|
||||
rt_thread_startup(tid);
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : startup.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Develop Team
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://openlab.rt-thread.com/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* 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:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* File : userled.c
|
||||
* 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
|
||||
* 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:
|
||||
* Date Author Notes
|
||||
* 2012-09-20 heyuanjie first version
|
||||
* 2012-09-29 lgnq re-fromat the coding style
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include "drv_led.h"
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(FINSH_USING_MSH)
|
||||
#include <finsh.h>
|
||||
#endif
|
||||
|
||||
static rt_thread_t tid;
|
||||
|
||||
/**
|
||||
* This function is the entry of the led thread
|
||||
*
|
||||
* @param param parameter of the led thread
|
||||
*/
|
||||
static void rt_userled_thread_init(void *param)
|
||||
{
|
||||
led_init();
|
||||
|
||||
led_set(1);
|
||||
|
||||
/* leds blink */
|
||||
while (1)
|
||||
{
|
||||
led_set(0);
|
||||
rt_thread_delay(RT_TICK_PER_SECOND / 100);
|
||||
led_clear(0);
|
||||
rt_thread_delay(RT_TICK_PER_SECOND);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will create and start a led thread
|
||||
*/
|
||||
void rt_hw_userled_init(void)
|
||||
{
|
||||
tid = rt_thread_create("userled",
|
||||
rt_userled_thread_init,
|
||||
RT_NULL,
|
||||
512,
|
||||
8,
|
||||
1);
|
||||
if (tid != RT_NULL)
|
||||
rt_thread_startup(tid);
|
||||
}
|
||||
|
||||
void rt_hw_userled_cleanup(void)
|
||||
{
|
||||
rt_enter_critical();
|
||||
|
||||
led_clear(0);
|
||||
|
||||
if (tid != RT_NULL && tid->stat != RT_THREAD_CLOSE)
|
||||
{
|
||||
rt_kprintf("delete led thread success\n");
|
||||
rt_thread_delete(tid);
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("delete led thread faild\n");
|
||||
if (tid == RT_NULL)
|
||||
rt_kprintf("tid is null\n");
|
||||
else
|
||||
rt_kprintf("tid stat is %d\n", tid->stat);
|
||||
}
|
||||
|
||||
rt_exit_critical();
|
||||
}
|
||||
#if defined(RT_USING_FINSH) && defined(FINSH_USING_MSH)
|
||||
MSH_CMD_EXPORT_ALIAS(rt_hw_userled_cleanup, led_cleanup, delete led task);
|
||||
#endif
|
||||
|
||||
|
||||
void rt_hw_userled_input(void)
|
||||
{
|
||||
led_deinit();
|
||||
}
|
||||
#if defined(RT_USING_FINSH) && defined(FINSH_USING_MSH)
|
||||
MSH_CMD_EXPORT_ALIAS(rt_hw_userled_input, led_as_input, delete led task);
|
||||
#endif
|
||||
@@ -0,0 +1,7 @@
|
||||
config RT_USING_UART2
|
||||
bool "Enable UART2"
|
||||
default y
|
||||
|
||||
config RT_USING_PIN
|
||||
bool "Enable PIN"
|
||||
default y
|
||||
@@ -8,6 +8,8 @@ cwd = os.path.join(str(Dir('#')), 'drivers')
|
||||
src = Split("""
|
||||
board.c
|
||||
usart.c
|
||||
drv_led.c
|
||||
gpio.c
|
||||
""")
|
||||
|
||||
CPPPATH = [cwd]
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : board.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2009 RT-Thread Develop Team
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* 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:
|
||||
* Date Author Notes
|
||||
@@ -143,15 +153,13 @@ void rt_hw_board_init()
|
||||
|
||||
SystemClock_Config();
|
||||
|
||||
stm32_hw_usart_init();
|
||||
#ifdef RT_USING_CONSOLE
|
||||
rt_console_set_device(CONSOLE_DEVICE);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
rt_components_board_init();
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_CONSOLE
|
||||
rt_console_set_device(CONSOLE_DEVICE);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* File : board.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2009, RT-Thread Development Team
|
||||
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* 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:
|
||||
* Date Author Notes
|
||||
@@ -56,6 +66,12 @@ void rt_hw_board_init(void);
|
||||
#define CONSOLE_DEVICE "uart2"
|
||||
#elif STM32_CONSOLE_USART == 3
|
||||
#define CONSOLE_DEVICE "uart3"
|
||||
#elif STM32_CONSOLE_USART == 4
|
||||
#define CONSOLE_DEVICE "uart4"
|
||||
#elif STM32_CONSOLE_USART == 5
|
||||
#define CONSOLE_DEVICE "uart5"
|
||||
#elif STM32_CONSOLE_USART == 6
|
||||
#define CONSOLE_DEVICE "lpuart1"
|
||||
#endif
|
||||
|
||||
#define FINSH_DEVICE_NAME CONSOLE_DEVICE
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* File : drv_led.c
|
||||
* 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
|
||||
* 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:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
#include "board.h"
|
||||
#include "drv_led.h"
|
||||
#include <drivers/pin.h>
|
||||
|
||||
//the pin number can be find in :goip.c pins[].
|
||||
//in nucleo-l476rg board,the green led is attached to PA5 which the number is 21.
|
||||
#define LED 21
|
||||
|
||||
/**
|
||||
* This function light up LED
|
||||
*
|
||||
* @param led LED number (6)
|
||||
*/
|
||||
void led_set(int led)
|
||||
{
|
||||
if (led == 0)
|
||||
{
|
||||
rt_pin_write(LED, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function return LED status, on or off
|
||||
*
|
||||
* @param led LED number (0-1)
|
||||
*/
|
||||
int led_get(int led)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (led == 0)
|
||||
{
|
||||
ret = rt_pin_read(LED);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function turn off LED
|
||||
*
|
||||
* @param led LED number (0-1)
|
||||
*/
|
||||
void led_clear(int led)
|
||||
{
|
||||
if (led == 0)
|
||||
{
|
||||
rt_pin_write(LED, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function toggle LED, switch from on to off or vice versa
|
||||
*
|
||||
* @param led LED number (0-1)
|
||||
*/
|
||||
void led_toggle(int led)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret = rt_pin_read(LED);
|
||||
|
||||
if(ret==1)
|
||||
{
|
||||
ret=0;
|
||||
}
|
||||
else if(ret==0)
|
||||
{
|
||||
ret=1;
|
||||
}
|
||||
|
||||
if (led == 0)
|
||||
{
|
||||
rt_pin_write(LED, ret);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function light up LEDs according value of 2 least significat bits
|
||||
*
|
||||
* @param value Bit pattern
|
||||
*/
|
||||
void led_value(int value)
|
||||
{
|
||||
rt_pin_write(LED, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function initialize LED interface
|
||||
*/
|
||||
void led_init(void)
|
||||
{
|
||||
rt_pin_mode(LED, PIN_MODE_OUTPUT);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function initialize LED interface
|
||||
*/
|
||||
void led_deinit(void)
|
||||
{
|
||||
rt_pin_mode(LED, PIN_MODE_INPUT);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* File : drv_led.h
|
||||
* 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
|
||||
* 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:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
#ifndef __DRV_LED_H__
|
||||
#define __DRV_LED_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void led_init(void);
|
||||
void led_set(int led);
|
||||
int led_get(int led);
|
||||
void led_clear(int led);
|
||||
void led_toggle(int led);
|
||||
void led_value(int value);
|
||||
void led_deinit(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* File : gpio.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2015, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2015-01-05 Bernard the first version
|
||||
*/
|
||||
#ifndef GPIO_H__
|
||||
#define GPIO_H__
|
||||
|
||||
|
||||
struct stm32_hw_pin_userdata
|
||||
{
|
||||
int pin;
|
||||
uint32_t mode;
|
||||
};
|
||||
|
||||
#define PIN_USERDATA_END {-1,0}
|
||||
|
||||
extern struct stm32_hw_pin_userdata stm32_pins[];
|
||||
|
||||
int rt_hw_pin_init(void);
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
+125
-124
File diff suppressed because it is too large.
Load diff
@@ -28,7 +28,7 @@ if os.getenv('RTT_EXEC_PATH'):
|
||||
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
|
||||
|
||||
BUILD = 'debug'
|
||||
STM32_TYPE = 'STM32F429xx'
|
||||
STM32_TYPE = 'STM32L4x6'
|
||||
|
||||
if PLATFORM == 'gcc':
|
||||
# toolchains
|
||||
|
||||
Reference in new issue
Block a user