Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
james | 55f1858411 |
80
.config
80
.config
|
@ -209,9 +209,7 @@ CONFIG_RT_USING_PWM=y
|
|||
# CONFIG_RT_USING_MTD_NOR is not set
|
||||
# CONFIG_RT_USING_MTD_NAND is not set
|
||||
# CONFIG_RT_USING_PM is not set
|
||||
CONFIG_RT_USING_RTC=y
|
||||
# CONFIG_RT_USING_ALARM is not set
|
||||
CONFIG_RT_USING_SOFT_RTC=y
|
||||
# CONFIG_RT_USING_RTC is not set
|
||||
CONFIG_RT_USING_SDIO=y
|
||||
CONFIG_RT_SDIO_STACK_SIZE=512
|
||||
CONFIG_RT_SDIO_THREAD_PRIORITY=15
|
||||
|
@ -434,7 +432,7 @@ CONFIG_RT_USING_ULOG=y
|
|||
# CONFIG_ULOG_OUTPUT_LVL_I is not set
|
||||
CONFIG_ULOG_OUTPUT_LVL_D=y
|
||||
CONFIG_ULOG_OUTPUT_LVL=7
|
||||
CONFIG_ULOG_USING_ISR_LOG=y
|
||||
# CONFIG_ULOG_USING_ISR_LOG is not set
|
||||
CONFIG_ULOG_ASSERT_ENABLE=y
|
||||
CONFIG_ULOG_LINE_BUF_SIZE=128
|
||||
# CONFIG_ULOG_USING_ASYNC_OUTPUT is not set
|
||||
|
@ -555,24 +553,7 @@ CONFIG_RW007_RST_PIN=111
|
|||
|
||||
# CONFIG_PKG_USING_COAP is not set
|
||||
# CONFIG_PKG_USING_NOPOLL is not set
|
||||
CONFIG_PKG_USING_NETUTILS=y
|
||||
CONFIG_PKG_NETUTILS_PATH="/packages/iot/netutils"
|
||||
# CONFIG_PKG_NETUTILS_TFTP is not set
|
||||
# CONFIG_PKG_NETUTILS_IPERF is not set
|
||||
# CONFIG_PKG_NETUTILS_NETIO is not set
|
||||
CONFIG_PKG_NETUTILS_NTP=y
|
||||
CONFIG_NTP_USING_AUTO_SYNC=y
|
||||
CONFIG_NTP_AUTO_SYNC_FIRST_DELAY=30
|
||||
CONFIG_NTP_AUTO_SYNC_PERIOD=3600
|
||||
CONFIG_NETUTILS_NTP_HOSTNAME="cn.ntp.org.cn"
|
||||
CONFIG_NETUTILS_NTP_HOSTNAME2="ntp.rt-thread.org"
|
||||
CONFIG_NETUTILS_NTP_HOSTNAME3="edu.ntp.org.cn"
|
||||
# CONFIG_PKG_NETUTILS_TELNET is not set
|
||||
# CONFIG_PKG_NETUTILS_TCPDUMP is not set
|
||||
CONFIG_PKG_USING_NETUTILS_LATEST_VERSION=y
|
||||
# CONFIG_PKG_USING_NETUTILS_V133 is not set
|
||||
CONFIG_PKG_NETUTILS_VER="latest"
|
||||
CONFIG_PKG_NETUTILS_VER_NUM=0x99999
|
||||
# CONFIG_PKG_USING_NETUTILS is not set
|
||||
# CONFIG_PKG_USING_CMUX is not set
|
||||
# CONFIG_PKG_USING_PPP_DEVICE is not set
|
||||
# CONFIG_PKG_USING_AT_DEVICE is not set
|
||||
|
@ -776,33 +757,7 @@ CONFIG_PKG_CJSON_VER="v1.7.17"
|
|||
#
|
||||
# LVGL: powerful and easy-to-use embedded GUI library
|
||||
#
|
||||
CONFIG_PKG_USING_LVGL=y
|
||||
CONFIG_PKG_LVGL_PATH="/packages/multimedia/LVGL/LVGL"
|
||||
CONFIG_PKG_LVGL_THREAD_PRIO=20
|
||||
CONFIG_PKG_LVGL_THREAD_STACK_SIZE=4096
|
||||
CONFIG_PKG_LVGL_DISP_REFR_PERIOD=5
|
||||
# CONFIG_PKG_USING_LVGL_SQUARELINE is not set
|
||||
# CONFIG_PKG_LVGL_USING_EXAMPLES is not set
|
||||
CONFIG_PKG_LVGL_USING_DEMOS=y
|
||||
CONFIG_PKG_LVGL_USING_V080311=y
|
||||
# CONFIG_PKG_LVGL_USING_V080310 is not set
|
||||
# CONFIG_PKG_LVGL_USING_V08039 is not set
|
||||
# CONFIG_PKG_LVGL_USING_V08038 is not set
|
||||
# CONFIG_PKG_LVGL_USING_V08037 is not set
|
||||
# CONFIG_PKG_LVGL_USING_V08036 is not set
|
||||
# CONFIG_PKG_LVGL_USING_V08035 is not set
|
||||
# CONFIG_PKG_LVGL_USING_V08034 is not set
|
||||
# CONFIG_PKG_LVGL_USING_V08033 is not set
|
||||
# CONFIG_PKG_LVGL_USING_V08032 is not set
|
||||
# CONFIG_PKG_LVGL_USING_V08031 is not set
|
||||
# CONFIG_PKG_LVGL_USING_V08030 is not set
|
||||
# CONFIG_PKG_LVGL_USING_V08020 is not set
|
||||
# CONFIG_PKG_LVGL_USING_V8_3_LATEST_VERSION is not set
|
||||
# CONFIG_PKG_LVGL_USING_V09000 is not set
|
||||
# CONFIG_PKG_LVGL_USING_V09010 is not set
|
||||
# CONFIG_PKG_LVGL_USING_LATEST_VERSION is not set
|
||||
CONFIG_PKG_LVGL_VER_NUM=0x080311
|
||||
CONFIG_PKG_LVGL_VER="v8.3.11"
|
||||
# CONFIG_PKG_USING_LVGL is not set
|
||||
# CONFIG_PKG_USING_LV_MUSIC_DEMO is not set
|
||||
# CONFIG_PKG_USING_GUI_GUIDER_DEMO is not set
|
||||
# end of LVGL: powerful and easy-to-use embedded GUI library
|
||||
|
@ -1077,14 +1032,7 @@ CONFIG_PKG_USING_AHT10_LATEST_VERSION=y
|
|||
# CONFIG_PKG_USING_AHT10_V300 is not set
|
||||
# CONFIG_PKG_USING_AHT10_V210 is not set
|
||||
CONFIG_PKG_AHT10_VER="latest"
|
||||
CONFIG_PKG_USING_AP3216C=y
|
||||
CONFIG_PKG_AP3216C_PATH="/packages/peripherals/sensors/ap3216c"
|
||||
# CONFIG_AP3216C_USING_SENSOR_DEVICE is not set
|
||||
# CONFIG_AP3216C_USING_HW_INT is not set
|
||||
CONFIG_PKG_USING_AP3216C_LATEST_VERSION=y
|
||||
# CONFIG_PKG_USING_AP3216C_V200 is not set
|
||||
# CONFIG_PKG_USING_AP3216C_V100 is not set
|
||||
CONFIG_PKG_AP3216C_VER="latest"
|
||||
# CONFIG_PKG_USING_AP3216C is not set
|
||||
# CONFIG_PKG_USING_TSL4531 is not set
|
||||
# CONFIG_PKG_USING_DS18B20 is not set
|
||||
# CONFIG_PKG_USING_DHT11 is not set
|
||||
|
@ -1603,13 +1551,7 @@ CONFIG_SOC_SERIES_STM32F4=y
|
|||
# CONFIG_BSP_USING_ARDUINO is not set
|
||||
CONFIG_BSP_USING_USB_TO_USART=y
|
||||
# CONFIG_BSP_USING_COM3 is not set
|
||||
CONFIG_BSP_USING_RS485=y
|
||||
|
||||
#
|
||||
# set rts pin number
|
||||
#
|
||||
CONFIG_BSP_RS485_RTS_PIN=104
|
||||
CONFIG_RS485_UART_DEVICE_NAME="uart6"
|
||||
# CONFIG_BSP_USING_RS485 is not set
|
||||
CONFIG_BSP_USING_SRAM=y
|
||||
CONFIG_BSP_USING_ONBOARD_LCD=y
|
||||
CONFIG_BSP_USING_ONBOARD_LCD_PWM_BL=y
|
||||
|
@ -1627,7 +1569,7 @@ CONFIG_BSP_USING_FAL=y
|
|||
# CONFIG_BSP_USING_EASYFLASH is not set
|
||||
CONFIG_BSP_USING_RW007_WLAN=y
|
||||
CONFIG_BSP_USING_AHT21=y
|
||||
CONFIG_BSP_USING_AP3216C=y
|
||||
# CONFIG_BSP_USING_AP3216C is not set
|
||||
CONFIG_BSP_USING_ICM20608=y
|
||||
# CONFIG_BSP_USING_USB_MOUSE is not set
|
||||
# CONFIG_BSP_USING_CAN is not set
|
||||
|
@ -1646,16 +1588,12 @@ CONFIG_BSP_USING_UART1=y
|
|||
# CONFIG_BSP_USING_UART3 is not set
|
||||
# CONFIG_BSP_USING_UART4 is not set
|
||||
# CONFIG_BSP_USING_UART5 is not set
|
||||
CONFIG_BSP_USING_UART6=y
|
||||
# CONFIG_BSP_UART6_RX_USING_DMA is not set
|
||||
# CONFIG_BSP_UART6_TX_USING_DMA is not set
|
||||
# CONFIG_BSP_USING_UART6 is not set
|
||||
# CONFIG_BSP_USING_TIM is not set
|
||||
CONFIG_BSP_USING_PWM=y
|
||||
# CONFIG_BSP_USING_PWM1 is not set
|
||||
# CONFIG_BSP_USING_PWM2 is not set
|
||||
CONFIG_BSP_USING_PWM3=y
|
||||
CONFIG_BSP_USING_PWM3_CH2=y
|
||||
# CONFIG_BSP_USING_PWM3_CH4 is not set
|
||||
# CONFIG_BSP_USING_PWM3 is not set
|
||||
# CONFIG_BSP_USING_PWM4 is not set
|
||||
CONFIG_BSP_USING_PWM14=y
|
||||
CONFIG_BSP_USING_PWM14_CH1=y
|
||||
|
|
|
@ -6,7 +6,7 @@ for more details.
|
|||
![error](./error.png)
|
||||
大概是没能连接设备,尝试以下方法
|
||||
1. 插好线,摁开关
|
||||
2. 没装驱动,装驱动
|
||||
2. 没装驱动,装驱动(解压+安装)!!!
|
||||
[en.stsw-link007-v3-13-4.zip](./en.stsw-link007-v3-13-4.zip)
|
||||
[en.stsw-link009.zip](./en.stsw-link009.zip)
|
||||
|
||||
|
@ -31,10 +31,6 @@ git remote remove origin
|
|||
git remote set-url --add origin git@github.com:*.git
|
||||
|
||||
git push -u origin master
|
||||
|
||||
# 退到/进到 指定commit的sha码(没得再返回了)
|
||||
|
||||
git reset --hard dde8c25694f34acf8971f0782b1a676f39bf0a46
|
||||
```
|
||||
## SConscript
|
||||
加入这个文件可以使在当前文件夹里的也能被调用
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 23 KiB |
|
@ -4,44 +4,32 @@
|
|||
#define LOG_TAG "pin.irq"
|
||||
#define LOG_LVL LOG_LVL_DBG
|
||||
#include <ulog.h>
|
||||
#include <rtatomic.h>
|
||||
#include "my_func.h"
|
||||
|
||||
#define KEY_UP GET_PIN(C, 5)
|
||||
#define KEY_DOWN GET_PIN(C, 1)
|
||||
#define KEY_LEFT GET_PIN(C, 0)
|
||||
#define KEY_RIGHT GET_PIN(C, 4)
|
||||
extern rt_atomic_t now_direction ;
|
||||
extern rt_atomic_t snake_pressed ;
|
||||
extern int snake_max;
|
||||
void key_up_callback(void *args)
|
||||
|
||||
void key_up_callback(void *args)
|
||||
{
|
||||
rt_atomic_store(&snake_pressed, snake_max+1);
|
||||
if(rt_atomic_load(&now_direction) != 2) rt_atomic_store(&now_direction, 0);
|
||||
int value = rt_pin_read(KEY_UP);
|
||||
LOG_I("key up value: %d\n", value);
|
||||
}
|
||||
|
||||
void key_down_callback(void *args)
|
||||
{
|
||||
rt_atomic_store(&snake_pressed, snake_max+1);
|
||||
int value = rt_pin_read(KEY_DOWN);
|
||||
if(rt_atomic_load(&now_direction) != 0) rt_atomic_store(&now_direction, 2);
|
||||
LOG_I("key down value: %d\n", value);
|
||||
}
|
||||
|
||||
void key_left_callback(void *args)
|
||||
{
|
||||
rt_atomic_store(&snake_pressed, snake_max+1);
|
||||
if(rt_atomic_load(&now_direction) != 3) rt_atomic_store(&now_direction, 1);
|
||||
int value = rt_pin_read(KEY_LEFT);
|
||||
LOG_I("key left value: %d\n", value);
|
||||
}
|
||||
|
||||
void key_right_callback(void *args)
|
||||
{
|
||||
rt_atomic_store(&snake_pressed, snake_max+1);
|
||||
if(rt_atomic_load(&now_direction) != 1) rt_atomic_store(&now_direction, 3);
|
||||
int value = rt_pin_read(KEY_RIGHT);
|
||||
LOG_I("key right value: %d\n", value);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,9 @@ from building import *
|
|||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = [ ]
|
||||
src = [
|
||||
'mqtt.c',
|
||||
]
|
||||
|
||||
CPPPATH = [cwd]
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ void app_lcd_string(void){
|
|||
/* show some string on lcd */
|
||||
lcd_show_string(10, 69, 16, "Hello, RT-Thread!");
|
||||
lcd_show_string(10, 69 + 16, 24, "RT-Thread");
|
||||
lcd_show_string(10, 69 + 16 + 24, 32, "RT-Thread");
|
||||
lcd_show_string(10, 69 + 16 + 24, 32, "123");
|
||||
|
||||
/* draw a line on lcd */
|
||||
lcd_draw_line(0, 69 + 16 + 24 + 32, 240, 69 + 16 + 24 + 32);
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
#include <wlan_mgnt.h>
|
||||
#include <wlan_cfg.h>
|
||||
#include <wlan_prot.h>
|
||||
#include <ap3216c.h>
|
||||
#include "my_func.h"
|
||||
|
||||
static int board_init(void)
|
||||
{
|
||||
|
@ -22,7 +20,7 @@ INIT_PREV_EXPORT(prev_init);
|
|||
|
||||
static int device_init(void)
|
||||
{
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
INIT_DEVICE_EXPORT(device_init);
|
||||
|
@ -49,10 +47,7 @@ INIT_APP_EXPORT(app_init);
|
|||
// extern int wifi_join(int argc, char *argv[]);
|
||||
int main_init(void)
|
||||
{
|
||||
|
||||
char str[] = "wifi join Dong abcd07691234";
|
||||
my_round(20);
|
||||
system(str);
|
||||
|
||||
// rt_thread_mdelay(18000);
|
||||
// char *argv[] = {"wifi", "join", "Dong", "abcd07691234"};
|
||||
// wifi_join(4, argv);
|
||||
|
|
|
@ -1,116 +1,85 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2023-5-10 ShiHao first version
|
||||
*/
|
||||
// /*
|
||||
// * Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
// *
|
||||
// * SPDX-License-Identifier: Apache-2.0
|
||||
// *
|
||||
// * Change Logs:
|
||||
// * Date Author Notes
|
||||
// * 2023-5-10 ShiHao first version
|
||||
// */
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include <board.h>
|
||||
#include "drv_common.h"
|
||||
#include <ntp.h>
|
||||
#define DBG_TAG "main"
|
||||
#define DBG_LVL DBG_LOG
|
||||
#include <rtdbg.h>
|
||||
#include "init.h"
|
||||
#include <drv_lcd.h>
|
||||
#include "my_func.h"
|
||||
#include <drv_gpio.h>
|
||||
|
||||
|
||||
/* 配置 LED 灯引脚 */
|
||||
#define PIN_LED_B GET_PIN(F, 11) // PF11 : LED_B --> LED
|
||||
#define PIN_LED_R GET_PIN(F, 12) // PF12 : LED_R --> LED
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
main_init();
|
||||
rt_pin_mode(PIN_LED_B, PIN_MODE_OUTPUT);
|
||||
rt_pin_write(PIN_LED_B, PIN_LOW);
|
||||
system("snake game");
|
||||
rt_wlan_config_autoreconnect(RT_TRUE);
|
||||
rt_wlan_connect("Dong", "abcd07691234");
|
||||
mytime();
|
||||
|
||||
/* init Wi-Fi auto connect feature */
|
||||
// wlan_autoconnect_init();
|
||||
/* enable auto reconnect on WLAN device */
|
||||
|
||||
// lcd_clear(WHITE);
|
||||
|
||||
// /* show RT-Thread logo */
|
||||
// lcd_show_image(0, 0, 240, 69, image_rttlogo);
|
||||
|
||||
// /* set the background color and foreground color */
|
||||
// lcd_set_color(WHITE, BLACK);
|
||||
|
||||
// /* show some string on lcd */
|
||||
// lcd_show_string(10, 69, 16, "Hello, RT-Thread!");
|
||||
// lcd_show_string(10, 69 + 16, 24, "RT-Thread");
|
||||
// lcd_show_string(10, 69 + 16 + 24, 32, "RT-Thread");
|
||||
|
||||
// /* draw a line on lcd */
|
||||
// lcd_draw_line(0, 69 + 16 + 24 + 32, 240, 69 + 16 + 24 + 32);
|
||||
|
||||
// /* draw a concentric circles */
|
||||
// lcd_draw_point(120, 194);
|
||||
// for (int i = 0; i < 46; i += 4)
|
||||
// {
|
||||
// lcd_draw_circle(120, 194, i);
|
||||
// }
|
||||
return 0;
|
||||
}
|
||||
// #include <rtthread.h>
|
||||
// #include <board.h>
|
||||
// #include "init.h"
|
||||
// #include <drv_gpio.h>
|
||||
// #ifndef RT_USING_NANO
|
||||
// #include <rtdevice.h>
|
||||
// #endif // !RT_USING_NANO
|
||||
// #include <board.h>
|
||||
|
||||
// #define GPIO_LED_B GET_PIN(F,11)
|
||||
// #define GPIO_LED_R GET_PIN(F,12)
|
||||
// #define DBG_TAG "main"
|
||||
// #define DBG_LVL DBG_LOG
|
||||
// #include <rtdbg.h>
|
||||
|
||||
// #include <drv_lcd.h>
|
||||
// #include <rttlogo.h>
|
||||
|
||||
// /* 配置 LED 灯引脚 */
|
||||
// #define PIN_LED_B GET_PIN(F, 11) // PF11 : LED_B --> LED
|
||||
// #define PIN_LED_R GET_PIN(F, 12) // PF12 : LED_R --> LED
|
||||
|
||||
// int main(void)
|
||||
// {
|
||||
// main_init();
|
||||
// // rt_pin_mode(GPIO_LED_B, PIN_MODE_OUTPUT);
|
||||
// // while(1)
|
||||
// // lcd_clear(WHITE);
|
||||
|
||||
// // /* show RT-Thread logo */
|
||||
// // lcd_show_image(0, 0, 240, 69, image_rttlogo);
|
||||
|
||||
// // /* set the background color and foreground color */
|
||||
// // lcd_set_color(WHITE, BLACK);
|
||||
|
||||
// // /* show some string on lcd */
|
||||
// // lcd_show_string(10, 69, 16, "Hello, RT-Thread!");
|
||||
// // lcd_show_string(10, 69 + 16, 24, "RT-Thread");
|
||||
// // lcd_show_string(10, 69 + 16 + 24, 32, "RT-Thread");
|
||||
|
||||
// // /* draw a line on lcd */
|
||||
// // lcd_draw_line(0, 69 + 16 + 24 + 32, 240, 69 + 16 + 24 + 32);
|
||||
|
||||
// // /* draw a concentric circles */
|
||||
// // lcd_draw_point(120, 194);
|
||||
// // for (int i = 0; i < 46; i += 4)
|
||||
// // {
|
||||
// // rt_pin_write(GPIO_LED_B, PIN_HIGH);
|
||||
// // rt_thread_mdelay(500);
|
||||
// // rt_pin_write(GPIO_LED_B, PIN_LOW);
|
||||
// // rt_thread_mdelay(500);
|
||||
// // lcd_draw_circle(120, 194, i);
|
||||
// // }
|
||||
// return 0;
|
||||
// }
|
||||
#include <rtthread.h>
|
||||
#include <board.h>
|
||||
#include "init.h"
|
||||
#include <drv_gpio.h>
|
||||
#ifndef RT_USING_NANO
|
||||
#include <rtdevice.h>
|
||||
#endif // !RT_USING_NANO
|
||||
|
||||
// static int onboard_sdcard_mount(void)
|
||||
// {
|
||||
// if (dfs_mount("sd0", "/sdcard", "elm", 0, 0) == RT_EOK)
|
||||
// {
|
||||
// LOG_I("SD card mount to '/sdcard'");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// LOG_E("SD card mount to '/sdcard' failed!");
|
||||
// }
|
||||
#define GPIO_LED_B GET_PIN(F,11)
|
||||
#define GPIO_LED_R GET_PIN(F,12)
|
||||
|
||||
// return RT_EOK;
|
||||
// }
|
||||
int main(void)
|
||||
{
|
||||
main_init();
|
||||
// rt_pin_mode(GPIO_LED_B, PIN_MODE_OUTPUT);
|
||||
// while(1)
|
||||
// {
|
||||
// rt_pin_write(GPIO_LED_B, PIN_HIGH);
|
||||
// rt_thread_mdelay(500);
|
||||
// rt_pin_write(GPIO_LED_B, PIN_LOW);
|
||||
// rt_thread_mdelay(500);
|
||||
// }
|
||||
return 0;
|
||||
}
|
||||
|
||||
// #define WIFI_CS GET_PIN(F, 10)
|
||||
// void WIFI_CS_PULL_DOWM(void)
|
||||
// #define WIFI_CS GET_PIN(F,10)
|
||||
// void WIFI_CS_PULL_DOWN(void)
|
||||
// {
|
||||
// rt_pin_mode(WIFI_CS, PIN_MODE_OUTPUT);
|
||||
// rt_pin_write(WIFI_CS, PIN_LOW);
|
||||
// }
|
||||
// INIT_BOARD_EXPORT(WIFI_CS_PULL_DOWM);
|
||||
// INIT_BOARD_EXPORT(WIFI_CS_PULL_DOWN);
|
||||
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ path += [cwd + '/CubeMX_Config/Inc']
|
|||
startup_path_prefix = SDK_LIB
|
||||
|
||||
if rtconfig.PLATFORM in ['gcc', 'llvm-arm']:
|
||||
src += [ cwd + '/startup_stm32f407xx.s']
|
||||
src += [startup_path_prefix + '/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f407xx.s']
|
||||
elif rtconfig.PLATFORM in ['armcc', 'armclang']:
|
||||
src += [startup_path_prefix + '/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f407xx.s']
|
||||
elif rtconfig.PLATFORM in ['iccarm']:
|
||||
|
|
|
@ -7,9 +7,10 @@
|
|||
/* Program Entry, set to mark it as "used" and avoid gc */
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024k /* 1024KB - 128kB flash */
|
||||
RAM (rw) : ORIGIN = 0x20000000, LENGTH = 128k /* 128K sram */
|
||||
CCMRAM (rw) : ORIGIN = 0x10000000, LENGTH = 64k /* 64K ccm sram */
|
||||
CODE (rx) : ORIGIN = 0x08000000, LENGTH = 1024k /* 1024KB flash */
|
||||
RAM1 (rw) : ORIGIN = 0x20000000, LENGTH = 128k /* 128K sram */
|
||||
RAM2 (rw) : ORIGIN = 0x10000000, LENGTH = 64k /* 64K sram */
|
||||
MCUlcdgrambysram (rw) : ORIGIN = 0x68000000, LENGTH = 1024k
|
||||
}
|
||||
ENTRY(Reset_Handler)
|
||||
_system_stack_size = 0x400;
|
||||
|
@ -42,6 +43,12 @@ SECTIONS
|
|||
KEEP(*(VSymTab))
|
||||
__vsymtab_end = .;
|
||||
|
||||
/* section information for utest */
|
||||
. = ALIGN(4);
|
||||
__rt_utest_tc_tab_start = .;
|
||||
KEEP(*(UtestTcTab))
|
||||
__rt_utest_tc_tab_end = .;
|
||||
|
||||
/* section information for initial. */
|
||||
. = ALIGN(4);
|
||||
__rt_init_start = .;
|
||||
|
@ -55,16 +62,12 @@ SECTIONS
|
|||
KEEP (*(.init_array))
|
||||
PROVIDE(__ctors_end__ = .);
|
||||
|
||||
/* section information for utest */
|
||||
. = ALIGN(4);
|
||||
__rt_utest_tc_tab_start = .;
|
||||
KEEP(*(UtestTcTab))
|
||||
__rt_utest_tc_tab_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
|
||||
KEEP(*(.eh_frame*))
|
||||
. = ALIGN(4);
|
||||
_etext = .;
|
||||
} > FLASH = 0
|
||||
} > CODE = 0
|
||||
|
||||
/* .ARM.exidx is sorted, so has to go in its own output section. */
|
||||
__exidx_start = .;
|
||||
|
@ -74,13 +77,12 @@ SECTIONS
|
|||
|
||||
/* This is used by the startup in order to initialize the .data secion */
|
||||
_sidata = .;
|
||||
} > FLASH
|
||||
} > CODE
|
||||
__exidx_end = .;
|
||||
|
||||
/* used by the startup to initialize data */
|
||||
_sidata = LOADADDR(.data);
|
||||
/* .data section which is used for initialized data */
|
||||
.data :
|
||||
|
||||
.data : AT (_sidata)
|
||||
{
|
||||
. = ALIGN(4);
|
||||
/* This is used by the startup in order to initialize the .data secion */
|
||||
|
@ -98,86 +100,7 @@ SECTIONS
|
|||
. = ALIGN(4);
|
||||
/* This is used by the startup in order to initialize the .data secion */
|
||||
_edata = . ;
|
||||
} >RAM AT> FLASH
|
||||
|
||||
_siccmdata = LOADADDR(.ccmdata); /* May be already present */
|
||||
|
||||
/* Initialized CCM-RAM section
|
||||
*
|
||||
* IMPORTANT NOTE!
|
||||
* If initialized variables will be placed in this section,
|
||||
* the startup code needs to be modified to copy the init-values.
|
||||
*/
|
||||
.ccmdata :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sccmdata = .; /* create a global symbol at data start */
|
||||
*(.ccmdata) /* .data sections */
|
||||
*(.ccmdata*) /* .data* sections */
|
||||
/*
|
||||
*data_reg.o(.data .data*)
|
||||
*monitor*.o(.data .data*)
|
||||
*sender*.o(.data .data*)
|
||||
*kernel*.o(.data .data*)
|
||||
*/
|
||||
. = ALIGN(4);
|
||||
_eccmdata = .; /* define a global symbol at data end */
|
||||
} >CCMRAM AT> FLASH
|
||||
|
||||
|
||||
/* _siccm_bss = LOADADDR(.ccm_bss); */
|
||||
/* CCM-RAM section
|
||||
*
|
||||
* IMPORTANT NOTE!
|
||||
* If initialized variables will be placed in this section,
|
||||
* the startup code needs to be modified to copy the init-values.
|
||||
*/
|
||||
.ccm_bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sccm_bss = .; /* create a global symbol at ccmram start */
|
||||
*(.ccm_bss)
|
||||
*(.ccm_bss*)
|
||||
|
||||
/* build\\core\\*.o(.bss .bss*) */
|
||||
build\\monitor\\**.o(.bss .bss*)
|
||||
build\\sender\\**.o(.bss .bss*)
|
||||
/* build\\mapping\\**.o(.bss .bss*) */
|
||||
|
||||
/* *board*.o(.bss .bss*) */
|
||||
/* *autosave.o(.bss .bss*)*/
|
||||
/* *application*autosave.o(.bss .bss*) */
|
||||
/* *data_send.o(.bss .bss*) */
|
||||
/* *isee_http.o(.bss .bss*) */
|
||||
/* *config.o(.bss .bss*) */
|
||||
/* *dio.o(.bss .bss*) */
|
||||
/* *eth.o(.bss .bss*) */
|
||||
/* *led.o(.bss .bss*) */
|
||||
|
||||
/* *packages*agile_telnet*.o(.bss .bss*) */
|
||||
/* *packages*agile_console*.o(.bss .bss*) */
|
||||
/* *packages*cJSON*.o(.bss .bss*) */
|
||||
/* *packages*CmBacktrace*.o(.bss .bss*)*/
|
||||
/* *packages*easyblink*.o(.bss .bss*) */
|
||||
/* *packages*webclient*.o(.bss .bss*) */
|
||||
/* *packages*netutils*.o(.bss .bss*) */
|
||||
/* *packages*syswatch*.o(.bss .bss*) */
|
||||
/* *packages*UrlEncode*.o(.bss .bss*) */
|
||||
|
||||
build\\kernel\\src\\*.o(.bss .bss*)
|
||||
/* build\\kernel\\libcpu\\*.o(.bss .bss*) */
|
||||
/* build\\kernel\\components\\libc\\*.o(.bss .bss*)
|
||||
/* build\\kernel\\components\\drivers\\*.o(.bss .bss*) */
|
||||
/* build\\kernel\\components\\dfs\\*.o(.bss .bss*) */
|
||||
build\\kernel\\components\\net\\lwip\\lwip-2.0.3\\*.o(.bss .bss*)
|
||||
/* build\\kernel\\components\\net\\lwip\\port\\**.o(.bss .bss*) */
|
||||
/* build\\kernel\\components\\net\\sal\\*.o(.bss .bss*) */
|
||||
/* build\\kernel\\components\\net\\netdev\\*.o(.bss .bss*) */
|
||||
/* build\\kernel\\components\\net\\sal_socket\\*.o(.bss .bss*) */
|
||||
|
||||
. = ALIGN(4);
|
||||
_eccm_bss = .; /* create a global symbol at ccmram end */
|
||||
} >CCMRAM
|
||||
} >RAM1
|
||||
|
||||
.stack :
|
||||
{
|
||||
|
@ -186,7 +109,7 @@ SECTIONS
|
|||
. = . + _system_stack_size;
|
||||
. = ALIGN(4);
|
||||
_estack = .;
|
||||
} >RAM
|
||||
} >RAM1
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
|
@ -204,9 +127,18 @@ SECTIONS
|
|||
_ebss = . ;
|
||||
|
||||
*(.bss.init)
|
||||
} > RAM
|
||||
} > RAM1
|
||||
__bss_end = .;
|
||||
|
||||
.MCUlcdgrambysram (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*(.MCUlcdgrambysram)
|
||||
*(.MCUlcdgrambysram.*)
|
||||
. = ALIGN(4);
|
||||
__MCUlcdgrambysram_free__ = .;
|
||||
} > MCUlcdgrambysram
|
||||
|
||||
_end = .;
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
|
|
|
@ -56,7 +56,7 @@ static int onboard_fal_mount(void)
|
|||
fal_init();
|
||||
/* 在 spi flash 中名为 "filesystem" 的分区上创建一个块设备 */
|
||||
struct rt_device *flash_dev = fal_blk_device_create(FS_PARTITION_NAME);
|
||||
// fal_blk_device_create("font");
|
||||
fal_blk_device_create("font");
|
||||
if (flash_dev == NULL)
|
||||
{
|
||||
LOG_E("Can't create a block device on '%s' partition.", FS_PARTITION_NAME);
|
||||
|
@ -87,36 +87,36 @@ static int onboard_fal_mount(void)
|
|||
|
||||
int ret;
|
||||
|
||||
// /* 创建目录 */
|
||||
// ret = mkdir("/fal/test", 0x777);
|
||||
// if (ret < 0)
|
||||
// {
|
||||
// /* 创建目录失败 */
|
||||
// rt_kprintf("dir error!\n");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// /* 创建目录成功 */
|
||||
// rt_kprintf("mkdir ok!\n");
|
||||
// }
|
||||
// /* 挂载块设备"font"到 DFS 目录/fal/test中 */
|
||||
// if (dfs_mount("font", "/fal/test", "elm", 0, 0) == 0)
|
||||
// {
|
||||
// LOG_I("font initialized!");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// dfs_mkfs("elm", "font");
|
||||
// if (dfs_mount("font", "/fal/test", "elm", 0, 0) == 0)
|
||||
// {
|
||||
// LOG_I("font initialized!");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// LOG_E("Failed to initialize font!");
|
||||
// LOG_D("You should create a filesystem(font) on the block device first!");
|
||||
// }
|
||||
// }
|
||||
/* 创建目录 */
|
||||
ret = mkdir("/fal/test", 0x777);
|
||||
if (ret < 0)
|
||||
{
|
||||
/* 创建目录失败 */
|
||||
rt_kprintf("dir error!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* 创建目录成功 */
|
||||
rt_kprintf("mkdir ok!\n");
|
||||
}
|
||||
/* 挂载块设备"font"到 DFS 目录/fal/test中 */
|
||||
if (dfs_mount("font", "/fal/test", "elm", 0, 0) == 0)
|
||||
{
|
||||
LOG_I("font initialized!");
|
||||
}
|
||||
else
|
||||
{
|
||||
dfs_mkfs("elm", "font");
|
||||
if (dfs_mount("font", "/fal/test", "elm", 0, 0) == 0)
|
||||
{
|
||||
LOG_I("font initialized!");
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_E("Failed to initialize font!");
|
||||
LOG_D("You should create a filesystem(font) on the block device first!");
|
||||
}
|
||||
}
|
||||
return RT_EOK;
|
||||
}
|
||||
#endif /*BSP_USING_FLASH_FATFS*/
|
||||
|
|
|
@ -1,535 +0,0 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file startup_stm32f407xx.s
|
||||
* @author MCD Application Team
|
||||
* @brief STM32F407xx Devices vector table for GCC based toolchains.
|
||||
* This module performs:
|
||||
* - Set the initial SP
|
||||
* - Set the initial PC == Reset_Handler,
|
||||
* - Set the vector table entries with the exceptions ISR address
|
||||
* - Branches to main in the C library (which eventually
|
||||
* calls main()).
|
||||
* After Reset the Cortex-M4 processor is in Thread mode,
|
||||
* priority is Privileged, and the Stack is set to Main.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
.syntax unified
|
||||
.cpu cortex-m4
|
||||
.fpu softvfp
|
||||
.thumb
|
||||
|
||||
.global g_pfnVectors
|
||||
.global Default_Handler
|
||||
|
||||
/* start address for the initialization values of the .data section.
|
||||
defined in linker script */
|
||||
.word _sidata
|
||||
/* start address for the .data section. defined in linker script */
|
||||
.word _sdata
|
||||
/* end address for the .data section. defined in linker script */
|
||||
.word _edata
|
||||
/* start address for the .bss section. defined in linker script */
|
||||
.word _sbss
|
||||
/* end address for the .bss section. defined in linker script */
|
||||
.word _ebss
|
||||
/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
|
||||
|
||||
/**
|
||||
* @brief This is the code that gets called when the processor first
|
||||
* starts execution following a reset event. Only the absolutely
|
||||
* necessary set is performed, after which the application
|
||||
* supplied main() routine is called.
|
||||
* @param None
|
||||
* @retval : None
|
||||
*/
|
||||
|
||||
.section .text.Reset_Handler
|
||||
.weak Reset_Handler
|
||||
.type Reset_Handler, %function
|
||||
Reset_Handler:
|
||||
ldr sp, =_estack /* set stack pointer */
|
||||
|
||||
/* Copy the data segment initializers from flash to SRAM */
|
||||
movs r1, #0
|
||||
b LoopCopyDataInit
|
||||
|
||||
CopyDataInit:
|
||||
ldr r3, =_sidata
|
||||
ldr r3, [r3, r1]
|
||||
str r3, [r0, r1]
|
||||
adds r1, r1, #4
|
||||
|
||||
LoopCopyDataInit:
|
||||
ldr r0, =_sdata
|
||||
ldr r3, =_edata
|
||||
adds r2, r0, r1
|
||||
cmp r2, r3
|
||||
bcc CopyDataInit
|
||||
|
||||
/* Copy from flash to CCMRAM */
|
||||
ldr r0, =_sccmdata
|
||||
ldr r1, =_eccmdata
|
||||
ldr r2, =_siccmdata
|
||||
movs r3, #0
|
||||
b LoopCopyCcmInit
|
||||
CopyCcmInit:
|
||||
ldr r4, [r2, r3]
|
||||
str r4, [r0, r3]
|
||||
adds r3, r3, #4
|
||||
LoopCopyCcmInit:
|
||||
adds r4, r0, r3
|
||||
cmp r4, r1
|
||||
bcc CopyCcmInit
|
||||
/* End of copy to CCMRAM */
|
||||
|
||||
ldr r2, =_sccm_bss
|
||||
b LoopFillZeroCcm
|
||||
/* Zero fill the ccm bss segment. */
|
||||
FillZeroCcm:
|
||||
movs r3, #0
|
||||
str r3, [r2], #4
|
||||
|
||||
LoopFillZeroCcm:
|
||||
ldr r3, = _eccm_bss
|
||||
cmp r2, r3
|
||||
bcc FillZeroCcm
|
||||
/* End of zero fill to CCMRAM */
|
||||
|
||||
ldr r2, =_sbss
|
||||
b LoopFillZerobss
|
||||
/* Zero fill the bss segment. */
|
||||
FillZerobss:
|
||||
movs r3, #0
|
||||
str r3, [r2], #4
|
||||
|
||||
LoopFillZerobss:
|
||||
ldr r3, = _ebss
|
||||
cmp r2, r3
|
||||
bcc FillZerobss
|
||||
|
||||
/* Call the clock system intitialization function.*/
|
||||
bl SystemInit
|
||||
/* Call static constructors */
|
||||
/* bl __libc_init_array */
|
||||
/* Call the application's entry point.*/
|
||||
bl entry
|
||||
bx lr
|
||||
.size Reset_Handler, .-Reset_Handler
|
||||
|
||||
/**
|
||||
* @brief This is the code that gets called when the processor receives an
|
||||
* unexpected interrupt. This simply enters an infinite loop, preserving
|
||||
* the system state for examination by a debugger.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
.section .text.Default_Handler,"ax",%progbits
|
||||
Default_Handler:
|
||||
Infinite_Loop:
|
||||
b Infinite_Loop
|
||||
.size Default_Handler, .-Default_Handler
|
||||
/******************************************************************************
|
||||
*
|
||||
* The minimal vector table for a Cortex M3. Note that the proper constructs
|
||||
* must be placed on this to ensure that it ends up at physical address
|
||||
* 0x0000.0000.
|
||||
*
|
||||
*******************************************************************************/
|
||||
.section .isr_vector,"a",%progbits
|
||||
.type g_pfnVectors, %object
|
||||
.size g_pfnVectors, .-g_pfnVectors
|
||||
|
||||
|
||||
g_pfnVectors:
|
||||
.word _estack
|
||||
.word Reset_Handler
|
||||
.word NMI_Handler
|
||||
.word HardFault_Handler
|
||||
.word MemManage_Handler
|
||||
.word BusFault_Handler
|
||||
.word UsageFault_Handler
|
||||
.word 0
|
||||
.word 0
|
||||
.word 0
|
||||
.word 0
|
||||
.word SVC_Handler
|
||||
.word DebugMon_Handler
|
||||
.word 0
|
||||
.word PendSV_Handler
|
||||
.word SysTick_Handler
|
||||
|
||||
/* External Interrupts */
|
||||
.word WWDG_IRQHandler /* Window WatchDog */
|
||||
.word PVD_IRQHandler /* PVD through EXTI Line detection */
|
||||
.word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */
|
||||
.word RTC_WKUP_IRQHandler /* RTC Wakeup through the EXTI line */
|
||||
.word FLASH_IRQHandler /* FLASH */
|
||||
.word RCC_IRQHandler /* RCC */
|
||||
.word EXTI0_IRQHandler /* EXTI Line0 */
|
||||
.word EXTI1_IRQHandler /* EXTI Line1 */
|
||||
.word EXTI2_IRQHandler /* EXTI Line2 */
|
||||
.word EXTI3_IRQHandler /* EXTI Line3 */
|
||||
.word EXTI4_IRQHandler /* EXTI Line4 */
|
||||
.word DMA1_Stream0_IRQHandler /* DMA1 Stream 0 */
|
||||
.word DMA1_Stream1_IRQHandler /* DMA1 Stream 1 */
|
||||
.word DMA1_Stream2_IRQHandler /* DMA1 Stream 2 */
|
||||
.word DMA1_Stream3_IRQHandler /* DMA1 Stream 3 */
|
||||
.word DMA1_Stream4_IRQHandler /* DMA1 Stream 4 */
|
||||
.word DMA1_Stream5_IRQHandler /* DMA1 Stream 5 */
|
||||
.word DMA1_Stream6_IRQHandler /* DMA1 Stream 6 */
|
||||
.word ADC_IRQHandler /* ADC1, ADC2 and ADC3s */
|
||||
.word CAN1_TX_IRQHandler /* CAN1 TX */
|
||||
.word CAN1_RX0_IRQHandler /* CAN1 RX0 */
|
||||
.word CAN1_RX1_IRQHandler /* CAN1 RX1 */
|
||||
.word CAN1_SCE_IRQHandler /* CAN1 SCE */
|
||||
.word EXTI9_5_IRQHandler /* External Line[9:5]s */
|
||||
.word TIM1_BRK_TIM9_IRQHandler /* TIM1 Break and TIM9 */
|
||||
.word TIM1_UP_TIM10_IRQHandler /* TIM1 Update and TIM10 */
|
||||
.word TIM1_TRG_COM_TIM11_IRQHandler /* TIM1 Trigger and Commutation and TIM11 */
|
||||
.word TIM1_CC_IRQHandler /* TIM1 Capture Compare */
|
||||
.word TIM2_IRQHandler /* TIM2 */
|
||||
.word TIM3_IRQHandler /* TIM3 */
|
||||
.word TIM4_IRQHandler /* TIM4 */
|
||||
.word I2C1_EV_IRQHandler /* I2C1 Event */
|
||||
.word I2C1_ER_IRQHandler /* I2C1 Error */
|
||||
.word I2C2_EV_IRQHandler /* I2C2 Event */
|
||||
.word I2C2_ER_IRQHandler /* I2C2 Error */
|
||||
.word SPI1_IRQHandler /* SPI1 */
|
||||
.word SPI2_IRQHandler /* SPI2 */
|
||||
.word USART1_IRQHandler /* USART1 */
|
||||
.word USART2_IRQHandler /* USART2 */
|
||||
.word USART3_IRQHandler /* USART3 */
|
||||
.word EXTI15_10_IRQHandler /* External Line[15:10]s */
|
||||
.word RTC_Alarm_IRQHandler /* RTC Alarm (A and B) through EXTI Line */
|
||||
.word OTG_FS_WKUP_IRQHandler /* USB OTG FS Wakeup through EXTI line */
|
||||
.word TIM8_BRK_TIM12_IRQHandler /* TIM8 Break and TIM12 */
|
||||
.word TIM8_UP_TIM13_IRQHandler /* TIM8 Update and TIM13 */
|
||||
.word TIM8_TRG_COM_TIM14_IRQHandler /* TIM8 Trigger and Commutation and TIM14 */
|
||||
.word TIM8_CC_IRQHandler /* TIM8 Capture Compare */
|
||||
.word DMA1_Stream7_IRQHandler /* DMA1 Stream7 */
|
||||
.word FSMC_IRQHandler /* FSMC */
|
||||
.word SDIO_IRQHandler /* SDIO */
|
||||
.word TIM5_IRQHandler /* TIM5 */
|
||||
.word SPI3_IRQHandler /* SPI3 */
|
||||
.word UART4_IRQHandler /* UART4 */
|
||||
.word UART5_IRQHandler /* UART5 */
|
||||
.word TIM6_DAC_IRQHandler /* TIM6 and DAC1&2 underrun errors */
|
||||
.word TIM7_IRQHandler /* TIM7 */
|
||||
.word DMA2_Stream0_IRQHandler /* DMA2 Stream 0 */
|
||||
.word DMA2_Stream1_IRQHandler /* DMA2 Stream 1 */
|
||||
.word DMA2_Stream2_IRQHandler /* DMA2 Stream 2 */
|
||||
.word DMA2_Stream3_IRQHandler /* DMA2 Stream 3 */
|
||||
.word DMA2_Stream4_IRQHandler /* DMA2 Stream 4 */
|
||||
.word ETH_IRQHandler /* Ethernet */
|
||||
.word ETH_WKUP_IRQHandler /* Ethernet Wakeup through EXTI line */
|
||||
.word CAN2_TX_IRQHandler /* CAN2 TX */
|
||||
.word CAN2_RX0_IRQHandler /* CAN2 RX0 */
|
||||
.word CAN2_RX1_IRQHandler /* CAN2 RX1 */
|
||||
.word CAN2_SCE_IRQHandler /* CAN2 SCE */
|
||||
.word OTG_FS_IRQHandler /* USB OTG FS */
|
||||
.word DMA2_Stream5_IRQHandler /* DMA2 Stream 5 */
|
||||
.word DMA2_Stream6_IRQHandler /* DMA2 Stream 6 */
|
||||
.word DMA2_Stream7_IRQHandler /* DMA2 Stream 7 */
|
||||
.word USART6_IRQHandler /* USART6 */
|
||||
.word I2C3_EV_IRQHandler /* I2C3 event */
|
||||
.word I2C3_ER_IRQHandler /* I2C3 error */
|
||||
.word OTG_HS_EP1_OUT_IRQHandler /* USB OTG HS End Point 1 Out */
|
||||
.word OTG_HS_EP1_IN_IRQHandler /* USB OTG HS End Point 1 In */
|
||||
.word OTG_HS_WKUP_IRQHandler /* USB OTG HS Wakeup through EXTI */
|
||||
.word OTG_HS_IRQHandler /* USB OTG HS */
|
||||
.word DCMI_IRQHandler /* DCMI */
|
||||
.word 0 /* CRYP crypto */
|
||||
.word HASH_RNG_IRQHandler /* Hash and Rng */
|
||||
.word FPU_IRQHandler /* FPU */
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Provide weak aliases for each Exception handler to the Default_Handler.
|
||||
* As they are weak aliases, any function with the same name will override
|
||||
* this definition.
|
||||
*
|
||||
*******************************************************************************/
|
||||
.weak NMI_Handler
|
||||
.thumb_set NMI_Handler,Default_Handler
|
||||
|
||||
.weak HardFault_Handler
|
||||
.thumb_set HardFault_Handler,Default_Handler
|
||||
|
||||
.weak MemManage_Handler
|
||||
.thumb_set MemManage_Handler,Default_Handler
|
||||
|
||||
.weak BusFault_Handler
|
||||
.thumb_set BusFault_Handler,Default_Handler
|
||||
|
||||
.weak UsageFault_Handler
|
||||
.thumb_set UsageFault_Handler,Default_Handler
|
||||
|
||||
.weak SVC_Handler
|
||||
.thumb_set SVC_Handler,Default_Handler
|
||||
|
||||
.weak DebugMon_Handler
|
||||
.thumb_set DebugMon_Handler,Default_Handler
|
||||
|
||||
.weak PendSV_Handler
|
||||
.thumb_set PendSV_Handler,Default_Handler
|
||||
|
||||
.weak SysTick_Handler
|
||||
.thumb_set SysTick_Handler,Default_Handler
|
||||
|
||||
.weak WWDG_IRQHandler
|
||||
.thumb_set WWDG_IRQHandler,Default_Handler
|
||||
|
||||
.weak PVD_IRQHandler
|
||||
.thumb_set PVD_IRQHandler,Default_Handler
|
||||
|
||||
.weak TAMP_STAMP_IRQHandler
|
||||
.thumb_set TAMP_STAMP_IRQHandler,Default_Handler
|
||||
|
||||
.weak RTC_WKUP_IRQHandler
|
||||
.thumb_set RTC_WKUP_IRQHandler,Default_Handler
|
||||
|
||||
.weak FLASH_IRQHandler
|
||||
.thumb_set FLASH_IRQHandler,Default_Handler
|
||||
|
||||
.weak RCC_IRQHandler
|
||||
.thumb_set RCC_IRQHandler,Default_Handler
|
||||
|
||||
.weak EXTI0_IRQHandler
|
||||
.thumb_set EXTI0_IRQHandler,Default_Handler
|
||||
|
||||
.weak EXTI1_IRQHandler
|
||||
.thumb_set EXTI1_IRQHandler,Default_Handler
|
||||
|
||||
.weak EXTI2_IRQHandler
|
||||
.thumb_set EXTI2_IRQHandler,Default_Handler
|
||||
|
||||
.weak EXTI3_IRQHandler
|
||||
.thumb_set EXTI3_IRQHandler,Default_Handler
|
||||
|
||||
.weak EXTI4_IRQHandler
|
||||
.thumb_set EXTI4_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Stream0_IRQHandler
|
||||
.thumb_set DMA1_Stream0_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Stream1_IRQHandler
|
||||
.thumb_set DMA1_Stream1_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Stream2_IRQHandler
|
||||
.thumb_set DMA1_Stream2_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Stream3_IRQHandler
|
||||
.thumb_set DMA1_Stream3_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Stream4_IRQHandler
|
||||
.thumb_set DMA1_Stream4_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Stream5_IRQHandler
|
||||
.thumb_set DMA1_Stream5_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Stream6_IRQHandler
|
||||
.thumb_set DMA1_Stream6_IRQHandler,Default_Handler
|
||||
|
||||
.weak ADC_IRQHandler
|
||||
.thumb_set ADC_IRQHandler,Default_Handler
|
||||
|
||||
.weak CAN1_TX_IRQHandler
|
||||
.thumb_set CAN1_TX_IRQHandler,Default_Handler
|
||||
|
||||
.weak CAN1_RX0_IRQHandler
|
||||
.thumb_set CAN1_RX0_IRQHandler,Default_Handler
|
||||
|
||||
.weak CAN1_RX1_IRQHandler
|
||||
.thumb_set CAN1_RX1_IRQHandler,Default_Handler
|
||||
|
||||
.weak CAN1_SCE_IRQHandler
|
||||
.thumb_set CAN1_SCE_IRQHandler,Default_Handler
|
||||
|
||||
.weak EXTI9_5_IRQHandler
|
||||
.thumb_set EXTI9_5_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM1_BRK_TIM9_IRQHandler
|
||||
.thumb_set TIM1_BRK_TIM9_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM1_UP_TIM10_IRQHandler
|
||||
.thumb_set TIM1_UP_TIM10_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM1_TRG_COM_TIM11_IRQHandler
|
||||
.thumb_set TIM1_TRG_COM_TIM11_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM1_CC_IRQHandler
|
||||
.thumb_set TIM1_CC_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM2_IRQHandler
|
||||
.thumb_set TIM2_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM3_IRQHandler
|
||||
.thumb_set TIM3_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM4_IRQHandler
|
||||
.thumb_set TIM4_IRQHandler,Default_Handler
|
||||
|
||||
.weak I2C1_EV_IRQHandler
|
||||
.thumb_set I2C1_EV_IRQHandler,Default_Handler
|
||||
|
||||
.weak I2C1_ER_IRQHandler
|
||||
.thumb_set I2C1_ER_IRQHandler,Default_Handler
|
||||
|
||||
.weak I2C2_EV_IRQHandler
|
||||
.thumb_set I2C2_EV_IRQHandler,Default_Handler
|
||||
|
||||
.weak I2C2_ER_IRQHandler
|
||||
.thumb_set I2C2_ER_IRQHandler,Default_Handler
|
||||
|
||||
.weak SPI1_IRQHandler
|
||||
.thumb_set SPI1_IRQHandler,Default_Handler
|
||||
|
||||
.weak SPI2_IRQHandler
|
||||
.thumb_set SPI2_IRQHandler,Default_Handler
|
||||
|
||||
.weak USART1_IRQHandler
|
||||
.thumb_set USART1_IRQHandler,Default_Handler
|
||||
|
||||
.weak USART2_IRQHandler
|
||||
.thumb_set USART2_IRQHandler,Default_Handler
|
||||
|
||||
.weak USART3_IRQHandler
|
||||
.thumb_set USART3_IRQHandler,Default_Handler
|
||||
|
||||
.weak EXTI15_10_IRQHandler
|
||||
.thumb_set EXTI15_10_IRQHandler,Default_Handler
|
||||
|
||||
.weak RTC_Alarm_IRQHandler
|
||||
.thumb_set RTC_Alarm_IRQHandler,Default_Handler
|
||||
|
||||
.weak OTG_FS_WKUP_IRQHandler
|
||||
.thumb_set OTG_FS_WKUP_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM8_BRK_TIM12_IRQHandler
|
||||
.thumb_set TIM8_BRK_TIM12_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM8_UP_TIM13_IRQHandler
|
||||
.thumb_set TIM8_UP_TIM13_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM8_TRG_COM_TIM14_IRQHandler
|
||||
.thumb_set TIM8_TRG_COM_TIM14_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM8_CC_IRQHandler
|
||||
.thumb_set TIM8_CC_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Stream7_IRQHandler
|
||||
.thumb_set DMA1_Stream7_IRQHandler,Default_Handler
|
||||
|
||||
.weak FSMC_IRQHandler
|
||||
.thumb_set FSMC_IRQHandler,Default_Handler
|
||||
|
||||
.weak SDIO_IRQHandler
|
||||
.thumb_set SDIO_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM5_IRQHandler
|
||||
.thumb_set TIM5_IRQHandler,Default_Handler
|
||||
|
||||
.weak SPI3_IRQHandler
|
||||
.thumb_set SPI3_IRQHandler,Default_Handler
|
||||
|
||||
.weak UART4_IRQHandler
|
||||
.thumb_set UART4_IRQHandler,Default_Handler
|
||||
|
||||
.weak UART5_IRQHandler
|
||||
.thumb_set UART5_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM6_DAC_IRQHandler
|
||||
.thumb_set TIM6_DAC_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM7_IRQHandler
|
||||
.thumb_set TIM7_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA2_Stream0_IRQHandler
|
||||
.thumb_set DMA2_Stream0_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA2_Stream1_IRQHandler
|
||||
.thumb_set DMA2_Stream1_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA2_Stream2_IRQHandler
|
||||
.thumb_set DMA2_Stream2_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA2_Stream3_IRQHandler
|
||||
.thumb_set DMA2_Stream3_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA2_Stream4_IRQHandler
|
||||
.thumb_set DMA2_Stream4_IRQHandler,Default_Handler
|
||||
|
||||
.weak ETH_IRQHandler
|
||||
.thumb_set ETH_IRQHandler,Default_Handler
|
||||
|
||||
.weak ETH_WKUP_IRQHandler
|
||||
.thumb_set ETH_WKUP_IRQHandler,Default_Handler
|
||||
|
||||
.weak CAN2_TX_IRQHandler
|
||||
.thumb_set CAN2_TX_IRQHandler,Default_Handler
|
||||
|
||||
.weak CAN2_RX0_IRQHandler
|
||||
.thumb_set CAN2_RX0_IRQHandler,Default_Handler
|
||||
|
||||
.weak CAN2_RX1_IRQHandler
|
||||
.thumb_set CAN2_RX1_IRQHandler,Default_Handler
|
||||
|
||||
.weak CAN2_SCE_IRQHandler
|
||||
.thumb_set CAN2_SCE_IRQHandler,Default_Handler
|
||||
|
||||
.weak OTG_FS_IRQHandler
|
||||
.thumb_set OTG_FS_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA2_Stream5_IRQHandler
|
||||
.thumb_set DMA2_Stream5_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA2_Stream6_IRQHandler
|
||||
.thumb_set DMA2_Stream6_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA2_Stream7_IRQHandler
|
||||
.thumb_set DMA2_Stream7_IRQHandler,Default_Handler
|
||||
|
||||
.weak USART6_IRQHandler
|
||||
.thumb_set USART6_IRQHandler,Default_Handler
|
||||
|
||||
.weak I2C3_EV_IRQHandler
|
||||
.thumb_set I2C3_EV_IRQHandler,Default_Handler
|
||||
|
||||
.weak I2C3_ER_IRQHandler
|
||||
.thumb_set I2C3_ER_IRQHandler,Default_Handler
|
||||
|
||||
.weak OTG_HS_EP1_OUT_IRQHandler
|
||||
.thumb_set OTG_HS_EP1_OUT_IRQHandler,Default_Handler
|
||||
|
||||
.weak OTG_HS_EP1_IN_IRQHandler
|
||||
.thumb_set OTG_HS_EP1_IN_IRQHandler,Default_Handler
|
||||
|
||||
.weak OTG_HS_WKUP_IRQHandler
|
||||
.thumb_set OTG_HS_WKUP_IRQHandler,Default_Handler
|
||||
|
||||
.weak OTG_HS_IRQHandler
|
||||
.thumb_set OTG_HS_IRQHandler,Default_Handler
|
||||
|
||||
.weak DCMI_IRQHandler
|
||||
.thumb_set DCMI_IRQHandler,Default_Handler
|
||||
|
||||
.weak HASH_RNG_IRQHandler
|
||||
.thumb_set HASH_RNG_IRQHandler,Default_Handler
|
||||
|
||||
.weak FPU_IRQHandler
|
||||
.thumb_set FPU_IRQHandler,Default_Handler
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
Binary file not shown.
Before Width: | Height: | Size: 857 KiB |
|
@ -1,6 +1,6 @@
|
|||
#### LCD 显示温湿度
|
||||
![LCD温湿度](lcdtemp.jpg)
|
||||
左上角是(0,0) →x,↓y
|
||||
|
||||
### 简易贪吃蛇
|
||||
![alt text](660c6c04fddc1bd3ccbe4255df5d449.jpg)
|
||||
### 使能了sd card
|
||||
![alt text](image-2.png)
|
||||
结果
|
||||
![alt text](image.png)
|
||||
关了就好了
|
||||
![alt text](image-1.png)
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
CPPPATH = [cwd]
|
||||
src = Glob('*.c')
|
||||
|
||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
list = os.listdir(cwd)
|
||||
for item in list:
|
||||
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(item, 'SConscript'))
|
||||
|
||||
Return('group')
|
Binary file not shown.
Before Width: | Height: | Size: 26 KiB |
Binary file not shown.
Before Width: | Height: | Size: 222 KiB |
|
@ -1,108 +0,0 @@
|
|||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include <board.h>
|
||||
#include <stdlib.h>
|
||||
#include <drv_lcd.h>
|
||||
#include <ntp.h>
|
||||
|
||||
#define LCD_MAX 240
|
||||
void lcd_black(int x, int y)
|
||||
{
|
||||
lcd_address_set(x, y, x, y);
|
||||
lcd_write_half_word(BLACK);
|
||||
}
|
||||
|
||||
void lcd_white(int x, int y)
|
||||
{
|
||||
lcd_address_set(x, y, x, y);
|
||||
lcd_write_half_word(WHITE);
|
||||
}
|
||||
int roundxy[4][2] = {
|
||||
{0, 0},
|
||||
{0, LCD_MAX},
|
||||
{LCD_MAX, 0},
|
||||
{LCD_MAX, LCD_MAX},
|
||||
};
|
||||
int xymove[4][2] = {
|
||||
{1, 1},
|
||||
{1, -1},
|
||||
{-1, 1},
|
||||
{-1, -1},
|
||||
};
|
||||
void mytime()
|
||||
{
|
||||
rt_thread_mdelay(10000);
|
||||
time_t cur_time;
|
||||
|
||||
cur_time = ntp_get_time(RT_NULL);
|
||||
if (cur_time)
|
||||
{
|
||||
rt_kprintf("NTP Server Time: %s", ctime((const time_t *)&cur_time));
|
||||
}
|
||||
lcd_show_string(20, 2, 16, ctime((const time_t *)&cur_time));
|
||||
}
|
||||
|
||||
void xy_round(int x, int y, int x2, int y2, int r, int ii)
|
||||
{
|
||||
// rt_kprintf("x:%d,y:%d,x2:%d,y2:%d,r:%d\n", x, y, x2, y2, r);
|
||||
for (int i = x; i != x2; i += xymove[ii][0])
|
||||
{
|
||||
for (int j = y; j != y2; j += xymove[ii][1])
|
||||
{
|
||||
int newi = x2 - i;
|
||||
int newj = y2 - j;
|
||||
// rt_kprintf("(%d,%d,%d)",(newi * newi + newj * newj), newi, newj);
|
||||
if ((newi * newi + newj * newj) > (r * r))
|
||||
{
|
||||
// rt_kprintf("x:%d,y:%d\n", i, j);
|
||||
lcd_black(i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void my_round(int r)
|
||||
{
|
||||
// 这个范围涂黑
|
||||
lcd_fill(0, 0, roundxy[2][0], roundxy[2][1], BLACK);
|
||||
lcd_write_half_word(BLACK);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
xy_round(roundxy[i][0], roundxy[i][1], roundxy[i][0] + r * xymove[i][0], roundxy[i][1] + r * xymove[i][1], r, i);
|
||||
}
|
||||
}
|
||||
void xy_sink()
|
||||
{
|
||||
for (int i = 0; i < 240; i++)
|
||||
{
|
||||
for (int j = 0; j <= 240; j++)
|
||||
{
|
||||
lcd_black(j, 240 - i);
|
||||
rt_thread_mdelay(1);
|
||||
}
|
||||
// rt_kprintf("(%d,...) Blacked\n", i);
|
||||
}
|
||||
}
|
||||
void snake_address(int x, int y, int r, const rt_uint16_t da)
|
||||
{
|
||||
int f = 0; // 使蛇身成节
|
||||
if (r > 5)
|
||||
{
|
||||
f = 1;
|
||||
}
|
||||
for (int i = x * r + f; i < x * r + r - f; i++)
|
||||
{
|
||||
for (int j = y * r + f; j < y * r + r - f; j++)
|
||||
{
|
||||
lcd_address_set(i, j, i, j);
|
||||
lcd_write_half_word(da);
|
||||
}
|
||||
}
|
||||
}
|
||||
// bt 命令行
|
||||
int color_cmd(int argc, char **argv)
|
||||
{
|
||||
snake_address(atoi(argv[1]), atoi(argv[2]), atoi(argv[3]), BLACK);
|
||||
return 1;
|
||||
}
|
||||
MSH_CMD_EXPORT_ALIAS(color_cmd, snk, bt 命令行);
|
|
@ -1,23 +0,0 @@
|
|||
#include <drv_lcd.h>
|
||||
#include <rtthread.h>
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
|
||||
// 当前方向
|
||||
void mytime();
|
||||
void xy_round(int x, int y, int x2, int y2, int r, int ii);
|
||||
void my_round(int r);
|
||||
void xy_sink();
|
||||
void lcd_black(int x, int y);
|
||||
void lcd_white(int x, int y);
|
||||
void snake_address(int x, int y, int r, const rt_uint16_t da);
|
||||
|
||||
|
||||
// typedef int QDataType;
|
||||
|
||||
// typedef struct QListNode
|
||||
// {
|
||||
// QDataType data;
|
||||
// struct QListNode* next;
|
||||
|
||||
// } QueueNode;
|
|
@ -1,366 +0,0 @@
|
|||
#include "rtthread.h"
|
||||
#include "dev_sign_api.h"
|
||||
#include "mqtt_api.h"
|
||||
#include <board.h>
|
||||
#include <drv_gpio.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "aht10.h"
|
||||
#include <ap3216c.h>
|
||||
#include <dfs_posix.h>
|
||||
#include <drv_lcd.h>
|
||||
#include "mysnake.h"
|
||||
|
||||
char DEMO_PRODUCT_KEY[IOTX_PRODUCT_KEY_LEN + 1] = {0};
|
||||
char DEMO_DEVICE_NAME[IOTX_DEVICE_NAME_LEN + 1] = {0};
|
||||
char DEMO_DEVICE_SECRET[IOTX_DEVICE_SECRET_LEN + 1] = {0};
|
||||
|
||||
void *HAL_Malloc(uint32_t size);
|
||||
void HAL_Free(void *ptr);
|
||||
void HAL_Printf(const char *fmt, ...);
|
||||
int HAL_GetProductKey(char product_key[IOTX_PRODUCT_KEY_LEN + 1]);
|
||||
int HAL_GetDeviceName(char device_name[IOTX_DEVICE_NAME_LEN + 1]);
|
||||
int HAL_GetDeviceSecret(char device_secret[IOTX_DEVICE_SECRET_LEN]);
|
||||
uint64_t HAL_UptimeMs(void);
|
||||
int HAL_Snprintf(char *str, const int len, const char *fmt, ...);
|
||||
|
||||
// 定义接受文件内容的缓冲区
|
||||
char buffer[1026] = {};
|
||||
char tmp[1026];
|
||||
extern int snake_len;
|
||||
rt_atomic_t page_chosen = 1;
|
||||
|
||||
#define PAGE_MAX 2
|
||||
|
||||
#define GPIO_LED_B GET_PIN(F, 11)
|
||||
#define GPIO_LED_R GET_PIN(F, 12)
|
||||
|
||||
// AHT挂载的总线名字
|
||||
#define AHT10_I2C_BUS "i2c3"
|
||||
|
||||
// AHT,ap3216c设备指针
|
||||
aht10_device_t Dev = RT_NULL;
|
||||
ap3216c_device_t dev;
|
||||
|
||||
// Humi:湿度值,Temp:温度值
|
||||
float Humi, Temp;
|
||||
rt_uint16_t ps_data;
|
||||
float brightness;
|
||||
int lcd_y;
|
||||
int int_tmp;
|
||||
|
||||
void ath_init(void);
|
||||
void mqt_init(void);
|
||||
int ap3_init(void);
|
||||
|
||||
#define EXAMPLE_TRACE(fmt, ...) \
|
||||
do \
|
||||
{ \
|
||||
HAL_Printf("%s|%03d :: ", __func__, __LINE__); \
|
||||
HAL_Printf(fmt, ##__VA_ARGS__); \
|
||||
HAL_Printf("%s", "\r\n"); \
|
||||
} while (0)
|
||||
|
||||
static void example_message_arrive(void *pcontext, void *pclient, iotx_mqtt_event_msg_pt msg)
|
||||
{
|
||||
iotx_mqtt_topic_info_t *topic_info = (iotx_mqtt_topic_info_pt)msg->msg;
|
||||
|
||||
switch (msg->event_type)
|
||||
{
|
||||
case IOTX_MQTT_EVENT_PUBLISH_RECEIVED:
|
||||
/* print topic name and topic message */
|
||||
EXAMPLE_TRACE("Message Arrived:");
|
||||
rt_pin_mode(GPIO_LED_R, PIN_MODE_OUTPUT);
|
||||
// topic_info->payload 为发送的内容,可以据此设置命令
|
||||
if (rt_pin_read(GPIO_LED_R) == PIN_HIGH)
|
||||
{
|
||||
// rt_kprintf("LED_R should be ON\n");
|
||||
rt_pin_write(GPIO_LED_R, PIN_LOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
// rt_kprintf("LED_R should be OFF\n");
|
||||
rt_pin_write(GPIO_LED_R, PIN_HIGH);
|
||||
}
|
||||
EXAMPLE_TRACE("Topic : %.*s", topic_info->topic_len, topic_info->ptopic);
|
||||
EXAMPLE_TRACE("Payload: %.*s", topic_info->payload_len, topic_info->payload);
|
||||
EXAMPLE_TRACE("\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static int example_subscribe(void *handle)
|
||||
{
|
||||
int res = 0;
|
||||
const char *fmt = "/%s/%s/user/get";
|
||||
char *topic = NULL;
|
||||
int topic_len = 0;
|
||||
|
||||
topic_len = strlen(fmt) + strlen(DEMO_PRODUCT_KEY) + strlen(DEMO_DEVICE_NAME) + 1;
|
||||
topic = HAL_Malloc(topic_len);
|
||||
if (topic == NULL)
|
||||
{
|
||||
EXAMPLE_TRACE("memory not enough");
|
||||
return -1;
|
||||
}
|
||||
memset(topic, 0, topic_len);
|
||||
HAL_Snprintf(topic, topic_len, fmt, DEMO_PRODUCT_KEY, DEMO_DEVICE_NAME);
|
||||
|
||||
res = IOT_MQTT_Subscribe(handle, topic, IOTX_MQTT_QOS0, example_message_arrive, NULL);
|
||||
if (res < 0)
|
||||
{
|
||||
EXAMPLE_TRACE("subscribe failed");
|
||||
HAL_Free(topic);
|
||||
return -1;
|
||||
}
|
||||
|
||||
HAL_Free(topic);
|
||||
return 0;
|
||||
}
|
||||
int plus_lcd_y(int pls)
|
||||
{
|
||||
int_tmp = lcd_y;
|
||||
lcd_y += pls;
|
||||
return int_tmp;
|
||||
}
|
||||
void easy_show_lcd(char *title, float Temp)
|
||||
{
|
||||
lcd_show_string(10, plus_lcd_y(24), 24, title);
|
||||
sprintf(tmp, "%f", Temp);
|
||||
lcd_show_string(10, plus_lcd_y(32), 32, tmp);
|
||||
}
|
||||
void show_lcd()
|
||||
{
|
||||
lcd_y = 10;
|
||||
easy_show_lcd("Temperature:", Temp);
|
||||
easy_show_lcd("Humidity:", Humi);
|
||||
easy_show_lcd("Brightness:(lux)", brightness);
|
||||
easy_show_lcd("Ps data:", (float)ps_data);
|
||||
// lcd_show_string(10, plus_lcd_y(10), 24, "Temperature:");
|
||||
// sprintf(tmp, "%f", Temp);
|
||||
// lcd_show_string(10, plus_lcd_y(24), 32, tmp);
|
||||
|
||||
// lcd_show_string(10, plus_lcd_y(32), 24, "Humidity:");
|
||||
// sprintf(tmp, "%f", Humi);
|
||||
// lcd_show_string(10, plus_lcd_y(24), 32, tmp);
|
||||
|
||||
// lcd_show_string(10, plus_lcd_y(32), 24, "Brightness:");
|
||||
// sprintf(tmp, "%f(lux)", brightness);
|
||||
// lcd_show_string(10, plus_lcd_y(24), 32, tmp);
|
||||
}
|
||||
|
||||
void make_file()
|
||||
{
|
||||
// 文件描述符
|
||||
int fd;
|
||||
// 用只写方式打开文件,如果没有该文件,则创建一个文件
|
||||
fd = open("/fal/test/Data.txt", O_WRONLY | O_CREAT | O_APPEND); // 和原来相比,只是把O_TRUNC参数更改为O_APPEND,即更改为打开后,如果再进行写入,将从文件的末尾位置开始写。
|
||||
// rt_kprintf("\n%f %f tmp:%s\n",Humi,Temp,String);
|
||||
// 如果打开成功
|
||||
if (fd >= 0)
|
||||
{
|
||||
// 写入文件
|
||||
write(fd, tmp, sizeof(tmp));
|
||||
// rt_kprintf("Write done.\n");
|
||||
// 关闭文件
|
||||
close(fd);
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("File Open Fail.\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
int cnt = 0;
|
||||
void tmp_payload(void)
|
||||
{
|
||||
// 读取温湿度值
|
||||
Humi = aht10_read_humidity(Dev);
|
||||
Temp = aht10_read_temperature(Dev);
|
||||
brightness = ap3216c_read_ambient_light(dev);
|
||||
ps_data = ap3216c_read_ps_data(dev);
|
||||
if (ps_data > 14)
|
||||
{
|
||||
page_chosen = (page_chosen % PAGE_MAX) + 1;
|
||||
}
|
||||
// icm20608_get_accel(icm20608_device_t dev, rt_int16_t *accel_x, rt_int16_t *accel_y, rt_int16_t *accel_z)
|
||||
// memset(tmp, 0, sizeof(tmp));
|
||||
// sprintf(tmp, "Temp: %.1f;Humi: %.1f;Count: %d\n", Temp, Humi,++cnt);
|
||||
// rt_kprintf("\n%f %f tmp:%s\n",Humi,Temp,tmp);
|
||||
// make_file();
|
||||
if (page_chosen == 2)
|
||||
{
|
||||
show_lcd();
|
||||
}
|
||||
sprintf(tmp, "{\"params\":{\"temperature\":%.2f,\"humidity\":%.2f,\"LightLux\":%.2f,\"Psdata\":%d,\"Snakelen\":%d}}", Temp, Humi, brightness, ps_data, snake_len);
|
||||
return;
|
||||
}
|
||||
void test_lcd()
|
||||
{
|
||||
// show_str(10, 10+24+32+24+32, 100, 32, "你好", 32);
|
||||
ath_init();
|
||||
ap3_init();
|
||||
while (1)
|
||||
{
|
||||
tmp_payload();
|
||||
rt_thread_mdelay(100);
|
||||
}
|
||||
}
|
||||
MSH_CMD_EXPORT(test_lcd, run my project);
|
||||
static int example_publish(void *handle)
|
||||
{
|
||||
|
||||
tmp_payload();
|
||||
int res = 0;
|
||||
const char *fmt = "/sys/%s/%s/thing/event/property/post";
|
||||
// /k1lyriw1yGj/${deviceName}/user/get
|
||||
char *topic = NULL;
|
||||
int topic_len = 0;
|
||||
char *payload = tmp;
|
||||
// strcpy(payload,tmp_payload());
|
||||
// rt_kprintf("payload:%s\n",payload);
|
||||
topic_len = strlen(fmt) + strlen(DEMO_PRODUCT_KEY) + strlen(DEMO_DEVICE_NAME) + 1;
|
||||
topic = HAL_Malloc(topic_len);
|
||||
if (topic == NULL)
|
||||
{
|
||||
EXAMPLE_TRACE("memory not enough");
|
||||
return -1;
|
||||
}
|
||||
memset(topic, 0, topic_len);
|
||||
HAL_Snprintf(topic, topic_len, fmt, DEMO_PRODUCT_KEY, DEMO_DEVICE_NAME);
|
||||
|
||||
res = IOT_MQTT_Publish_Simple(0, topic, IOTX_MQTT_QOS0, payload, strlen(payload));
|
||||
if (res < 0)
|
||||
{
|
||||
EXAMPLE_TRACE("publish failed, res = %d", res);
|
||||
HAL_Free(topic);
|
||||
return -1;
|
||||
}
|
||||
|
||||
HAL_Free(topic);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void example_event_handle(void *pcontext, void *pclient, iotx_mqtt_event_msg_pt msg)
|
||||
{
|
||||
EXAMPLE_TRACE("msg->event_type : %d", msg->event_type);
|
||||
}
|
||||
|
||||
static void mqtt_example_main(void *parameter)
|
||||
{
|
||||
void *pclient = NULL;
|
||||
int res = 0;
|
||||
int loop_cnt = 0;
|
||||
iotx_mqtt_param_t mqtt_params;
|
||||
|
||||
HAL_GetProductKey(DEMO_PRODUCT_KEY);
|
||||
HAL_GetDeviceName(DEMO_DEVICE_NAME);
|
||||
HAL_GetDeviceSecret(DEMO_DEVICE_SECRET);
|
||||
|
||||
EXAMPLE_TRACE("mqtt example");
|
||||
|
||||
memset(&mqtt_params, 0x0, sizeof(mqtt_params));
|
||||
|
||||
mqtt_params.handle_event.h_fp = example_event_handle;
|
||||
|
||||
pclient = IOT_MQTT_Construct(&mqtt_params);
|
||||
if (NULL == pclient)
|
||||
{
|
||||
EXAMPLE_TRACE("MQTT construct failed");
|
||||
return;
|
||||
}
|
||||
|
||||
res = example_subscribe(pclient);
|
||||
if (res < 0)
|
||||
{
|
||||
IOT_MQTT_Destroy(&pclient);
|
||||
return;
|
||||
}
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (0 == loop_cnt % 20)
|
||||
{
|
||||
example_publish(pclient);
|
||||
}
|
||||
|
||||
IOT_MQTT_Yield(pclient, 200);
|
||||
|
||||
loop_cnt += 1;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#define THREAD_PRIORITY 25
|
||||
#define THREAD_STACK_SIZE 4096
|
||||
#define THREAD_TIMESLICE 5
|
||||
|
||||
rt_thread_t MQTT_Thread = RT_NULL;
|
||||
rt_thread_t Snake_Thread = RT_NULL;
|
||||
|
||||
void ath_init(void)
|
||||
{
|
||||
// 初始化设备
|
||||
Dev = aht10_init(AHT10_I2C_BUS);
|
||||
if (Dev == RT_NULL)
|
||||
{
|
||||
rt_kprintf("AHT10_init Fail");
|
||||
return;
|
||||
}
|
||||
}
|
||||
void mqt_init(void)
|
||||
{
|
||||
MQTT_Thread = rt_thread_create("MTQQ_Thread", mqtt_example_main, RT_NULL, THREAD_STACK_SIZE, THREAD_PRIORITY, THREAD_TIMESLICE);
|
||||
|
||||
if (MQTT_Thread != RT_NULL)
|
||||
{
|
||||
rt_thread_startup(MQTT_Thread);
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("MQTT Thread Create Failed!\n");
|
||||
}
|
||||
}
|
||||
int ap3_init(void)
|
||||
{
|
||||
const char *i2c_bus_name = "i2c2";
|
||||
|
||||
dev = ap3216c_init(i2c_bus_name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
void snk_init(void)
|
||||
{
|
||||
Snake_Thread = rt_thread_create("Snake_Thread", snake_entry, RT_NULL, THREAD_STACK_SIZE, THREAD_PRIORITY, THREAD_TIMESLICE);
|
||||
|
||||
if (Snake_Thread != RT_NULL)
|
||||
{
|
||||
rt_thread_startup(Snake_Thread);
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("Snake Thread Create Failed!\n");
|
||||
}
|
||||
}
|
||||
MSH_CMD_EXPORT_ALIAS(snk_init, snake, "snake game");
|
||||
// void i20_init(void)
|
||||
// {
|
||||
// const char* i2c_bus_name = "i2c2";
|
||||
|
||||
// icm20608_init(i2c_bus_name)
|
||||
|
||||
// return 0;
|
||||
|
||||
// }
|
||||
void my_project(void)
|
||||
{
|
||||
ath_init();
|
||||
|
||||
mqt_init();
|
||||
|
||||
ap3_init();
|
||||
}
|
||||
MSH_CMD_EXPORT_ALIAS(my_project, myproject, run my project);
|
|
@ -1,116 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <rtthread.h>
|
||||
#include <stdbool.h>
|
||||
#include "my_func.h"
|
||||
#include "mysnake.h"
|
||||
#include <time.h>
|
||||
#include <rtatomic.h>
|
||||
|
||||
#define LCD_MAX 240
|
||||
#define SNAKE_SIZE 20
|
||||
#define SNAKE_MAX LCD_MAX / SNAKE_SIZE
|
||||
rt_atomic_t now_direction = 3;
|
||||
rt_atomic_t snake_pressed = 0;
|
||||
extern rt_atomic_t page_chosen;
|
||||
int snake_max = SNAKE_MAX * 3;
|
||||
int snake_len = 3;
|
||||
|
||||
// bool snake_table[SNAKE_MAX][SNAKE_MAX] = {0};
|
||||
// struct My_snake
|
||||
// {
|
||||
// int x;
|
||||
// int y;
|
||||
// }snake_list[SNAKE_MAX*SNAKE_MAX] = {0};
|
||||
// /* rt_event_t 是指向事件结构体的指针类型 */
|
||||
// typedef struct My_snake* my_snake_t;
|
||||
|
||||
void snake_entry(void *parameter)
|
||||
{
|
||||
system("irq");
|
||||
time_t t;
|
||||
/* 初始化随机数发生器 */
|
||||
srand((unsigned)time(&t));
|
||||
int snake_list[SNAKE_MAX + 1][2] = {0};
|
||||
int snake_direction[4][2] = {{0, -1}, {-1, 0}, {0, 1}, {1, 0}}; // 上,左,下,右
|
||||
int snake_food[2];
|
||||
bool food_flag = false;
|
||||
char snake_dirshow[4][7] = {"upup", "left", "down", "rigt"};
|
||||
char tmp[10];
|
||||
int snake_head = 2, snake_tail = 0; // 蛇头,蛇尾
|
||||
snake_list[1][0] = SNAKE_MAX / 2;
|
||||
snake_list[1][1] = SNAKE_MAX / 2;
|
||||
snake_list[0][0] = snake_list[1][0] - 1;
|
||||
snake_list[0][1] = snake_list[1][1];
|
||||
snake_list[2][0] = snake_list[1][0] + 1;
|
||||
snake_list[2][1] = snake_list[1][1];
|
||||
// snake_table[snake_list[0][0]][snake_list[0][1]] = 1;
|
||||
// snake_table[snake_list[1][0]][snake_list[1][1]] = 1;
|
||||
// snake_table[snake_list[2][0]][snake_list[2][1]] = 1;
|
||||
snake_address(snake_list[0][0], snake_list[0][1], SNAKE_SIZE, BLACK);
|
||||
snake_address(snake_list[1][0], snake_list[1][1], SNAKE_SIZE, BLACK);
|
||||
snake_address(snake_list[2][0], snake_list[2][1], SNAKE_SIZE, BLACK);
|
||||
snake_food[0] = rand() % SNAKE_MAX;
|
||||
snake_food[1] = rand() % SNAKE_MAX;
|
||||
snake_address(snake_food[0], snake_food[1], SNAKE_SIZE, GREEN);
|
||||
int new_head_x = 0, new_head_y = 0;
|
||||
int new_direction = 0;
|
||||
while (1)
|
||||
{
|
||||
if (page_chosen == 1)
|
||||
{
|
||||
if (!snake_pressed)
|
||||
{
|
||||
// 50%的概率保持当前方向,20%的概率随机改变方向
|
||||
if (rand() % 100 < 50)
|
||||
{
|
||||
new_direction = rand() % 3;
|
||||
now_direction = (now_direction + 3 + new_direction) % 4; // 防止反向,走回头路
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_atomic_add(&snake_pressed, -1);
|
||||
}
|
||||
|
||||
new_head_x = (snake_list[snake_head][0] + snake_direction[now_direction][0] + SNAKE_MAX) % (SNAKE_MAX);
|
||||
new_head_y = (snake_list[snake_head][1] + snake_direction[now_direction][1] + SNAKE_MAX) % (SNAKE_MAX);
|
||||
|
||||
sprintf(tmp, "(%d,%d)", new_head_x, new_head_y);
|
||||
// rt_kprintf("head:%d,%d\n", snake_list[snake_head][0], snake_list[snake_head][1]);
|
||||
lcd_show_string(20, 20, 16, snake_dirshow[now_direction]);
|
||||
lcd_show_string(20 + 16 * 4, 20, 16, tmp);
|
||||
|
||||
snake_address(new_head_x, new_head_y, SNAKE_SIZE, BLACK);
|
||||
if (new_head_x == snake_food[0] && new_head_y == snake_food[1])
|
||||
{
|
||||
snake_food[0] = rand() % SNAKE_MAX;
|
||||
snake_food[1] = rand() % SNAKE_MAX;
|
||||
snake_address(snake_food[0], snake_food[1], SNAKE_SIZE, GREEN);
|
||||
snake_len++;
|
||||
sprintf(tmp, "%d", snake_len);
|
||||
lcd_show_string(100, 105, 32, tmp);
|
||||
// 防止蛇咬尾出现bug
|
||||
if (snake_len >= SNAKE_MAX)
|
||||
{
|
||||
snake_address(snake_list[snake_tail][0], snake_list[snake_tail][1], SNAKE_SIZE, WHITE);
|
||||
snake_tail = (snake_tail + 1) % (SNAKE_MAX);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (snake_list[snake_tail][0] == snake_food[0] && snake_list[snake_tail][1] == snake_food[1])
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
snake_address(snake_list[snake_tail][0], snake_list[snake_tail][1], SNAKE_SIZE, WHITE);
|
||||
}
|
||||
snake_tail = (snake_tail + 1) % (SNAKE_MAX);
|
||||
}
|
||||
snake_head = (snake_head + 1) % (SNAKE_MAX);
|
||||
snake_list[snake_head][0] = new_head_x;
|
||||
snake_list[snake_head][1] = new_head_y;
|
||||
rt_thread_mdelay(900);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <rtthread.h>
|
||||
#include <stdbool.h>
|
||||
#include "my_func.h"
|
||||
|
||||
void snake_entry(void *parameter);
|
|
@ -1,8 +0,0 @@
|
|||
### 使能了sd card
|
||||
![alt text](image-2.png)
|
||||
结果
|
||||
![alt text](image.png)
|
||||
关了就好了
|
||||
![alt text](image-1.png)
|
||||
### 开了soft rtc
|
||||
![alt text](image-3.png)
|
32
rtconfig.h
32
rtconfig.h
|
@ -131,8 +131,6 @@
|
|||
#define RT_USING_I2C
|
||||
#define RT_USING_I2C_BITOPS
|
||||
#define RT_USING_PWM
|
||||
#define RT_USING_RTC
|
||||
#define RT_USING_SOFT_RTC
|
||||
#define RT_USING_SDIO
|
||||
#define RT_SDIO_STACK_SIZE 512
|
||||
#define RT_SDIO_THREAD_PRIORITY 15
|
||||
|
@ -276,7 +274,6 @@
|
|||
#define RT_USING_ULOG
|
||||
#define ULOG_OUTPUT_LVL_D
|
||||
#define ULOG_OUTPUT_LVL 7
|
||||
#define ULOG_USING_ISR_LOG
|
||||
#define ULOG_ASSERT_ENABLE
|
||||
#define ULOG_LINE_BUF_SIZE 128
|
||||
|
||||
|
@ -332,16 +329,6 @@
|
|||
|
||||
/* end of CYW43439 WiFi */
|
||||
/* end of Wi-Fi */
|
||||
#define PKG_USING_NETUTILS
|
||||
#define PKG_NETUTILS_NTP
|
||||
#define NTP_USING_AUTO_SYNC
|
||||
#define NTP_AUTO_SYNC_FIRST_DELAY 30
|
||||
#define NTP_AUTO_SYNC_PERIOD 3600
|
||||
#define NETUTILS_NTP_HOSTNAME "cn.ntp.org.cn"
|
||||
#define NETUTILS_NTP_HOSTNAME2 "ntp.rt-thread.org"
|
||||
#define NETUTILS_NTP_HOSTNAME3 "edu.ntp.org.cn"
|
||||
#define PKG_USING_NETUTILS_LATEST_VERSION
|
||||
#define PKG_NETUTILS_VER_NUM 0x99999
|
||||
|
||||
/* IoT Cloud */
|
||||
|
||||
|
@ -417,13 +404,6 @@
|
|||
|
||||
/* LVGL: powerful and easy-to-use embedded GUI library */
|
||||
|
||||
#define PKG_USING_LVGL
|
||||
#define PKG_LVGL_THREAD_PRIO 20
|
||||
#define PKG_LVGL_THREAD_STACK_SIZE 4096
|
||||
#define PKG_LVGL_DISP_REFR_PERIOD 5
|
||||
#define PKG_LVGL_USING_DEMOS
|
||||
#define PKG_LVGL_USING_V080311
|
||||
#define PKG_LVGL_VER_NUM 0x080311
|
||||
/* end of LVGL: powerful and easy-to-use embedded GUI library */
|
||||
|
||||
/* u8g2: a monochrome graphic library */
|
||||
|
@ -488,8 +468,6 @@
|
|||
|
||||
#define PKG_USING_AHT10
|
||||
#define PKG_USING_AHT10_LATEST_VERSION
|
||||
#define PKG_USING_AP3216C
|
||||
#define PKG_USING_AP3216C_LATEST_VERSION
|
||||
#define PKG_USING_ICM20608
|
||||
#define PKG_USING_ICM20608_LATEST_VERSION
|
||||
/* end of sensors drivers */
|
||||
|
@ -586,12 +564,6 @@
|
|||
/* Onboard Peripheral Drivers */
|
||||
|
||||
#define BSP_USING_USB_TO_USART
|
||||
#define BSP_USING_RS485
|
||||
|
||||
/* set rts pin number */
|
||||
|
||||
#define BSP_RS485_RTS_PIN 104
|
||||
#define RS485_UART_DEVICE_NAME "uart6"
|
||||
#define BSP_USING_SRAM
|
||||
#define BSP_USING_ONBOARD_LCD
|
||||
#define BSP_USING_ONBOARD_LCD_PWM_BL
|
||||
|
@ -602,7 +574,6 @@
|
|||
#define BSP_USING_FAL
|
||||
#define BSP_USING_RW007_WLAN
|
||||
#define BSP_USING_AHT21
|
||||
#define BSP_USING_AP3216C
|
||||
#define BSP_USING_ICM20608
|
||||
/* end of Onboard Peripheral Drivers */
|
||||
|
||||
|
@ -611,10 +582,7 @@
|
|||
#define BSP_USING_GPIO
|
||||
#define BSP_USING_UART
|
||||
#define BSP_USING_UART1
|
||||
#define BSP_USING_UART6
|
||||
#define BSP_USING_PWM
|
||||
#define BSP_USING_PWM3
|
||||
#define BSP_USING_PWM3_CH2
|
||||
#define BSP_USING_PWM14
|
||||
#define BSP_USING_PWM14_CH1
|
||||
#define BSP_USING_ON_CHIP_FLASH
|
||||
|
|
Loading…
Reference in New Issue