Browse Source

Merge branch 'wang_weigen_master' of https://git.trustie.net/xuos/xiuos into xiuos_connection

pull/3/head
Liu_Weichao 1 year ago
parent
commit
903fca4991
  1. 3
      .gitignore
  2. 83
      APP_Framework/Applications/Kconfig
  3. 40
      APP_Framework/Applications/Makefile
  4. 30
      APP_Framework/Applications/app_test/Kconfig
  5. 0
      APP_Framework/Applications/app_test/sd_card_mount.c
  6. 0
      APP_Framework/Applications/app_test/spi_sd_card_mount.c
  7. 14
      APP_Framework/Applications/connection_app/Kconfig
  8. 0
      APP_Framework/Applications/connection_app/Makefile
  9. 0
      APP_Framework/Applications/connection_app/adhoc_lora_demo/Makefile
  10. 0
      APP_Framework/Applications/connection_app/adhoc_lora_demo/client.c
  11. 0
      APP_Framework/Applications/connection_app/adhoc_lora_demo/gateway.c
  12. 0
      APP_Framework/Applications/connection_app/bluetooth_demo/Makefile
  13. 0
      APP_Framework/Applications/connection_app/bluetooth_demo/bluetooth_receive_demo.c
  14. 0
      APP_Framework/Applications/connection_app/bluetooth_demo/bluetooth_send_demo.c
  15. 0
      APP_Framework/Applications/connection_app/ethernet_demo/Makefile
  16. 0
      APP_Framework/Applications/connection_app/ethernet_demo/ethernet_demo.c
  17. 0
      APP_Framework/Applications/connection_app/nbiot_demo/Makefile
  18. 0
      APP_Framework/Applications/connection_app/nbiot_demo/nbiot_demo.c
  19. 0
      APP_Framework/Applications/connection_app/wifi_demo/Makefile
  20. 0
      APP_Framework/Applications/connection_app/wifi_demo/wifi_demo.c
  21. 0
      APP_Framework/Applications/connection_app/zigbee_demo/Makefile
  22. 0
      APP_Framework/Applications/connection_app/zigbee_demo/zigbee_receive_demo.c
  23. 0
      APP_Framework/Applications/connection_app/zigbee_demo/zigbee_send_demo.c
  24. 8
      APP_Framework/Applications/control_app/Kconfig
  25. 0
      APP_Framework/Applications/control_app/Makefile
  26. 7
      APP_Framework/Applications/knowing_app/Kconfig
  27. 0
      APP_Framework/Applications/knowing_app/Makefile
  28. 70
      APP_Framework/Applications/sensor_app/Kconfig
  29. 41
      APP_Framework/Framework/Kconfig
  30. 9
      APP_Framework/Framework/Makefile
  31. 3
      APP_Framework/Framework/control/Kconfig
  32. 3
      APP_Framework/Framework/control/Makefile
  33. 8
      APP_Framework/Framework/know/Kconfig
  34. 13
      APP_Framework/Framework/know/Makefile
  35. 2
      APP_Framework/Framework/know/tflite_mnist/Kconfig
  36. 2
      APP_Framework/Framework/know/tflite_sin/Kconfig
  37. 2
      APP_Framework/Kconfig
  38. 14
      APP_Framework/lib/Kconfig
  39. 7
      APP_Framework/lib/Makefile
  40. 38
      Ubiquitous/RT_Thread/bsp/k210/.config
  41. 106
      Ubiquitous/RT_Thread/bsp/k210/applications/ov2640_test.c
  42. 105
      Ubiquitous/RT_Thread/bsp/k210/applications/rw007_test.c
  43. 5
      Ubiquitous/RT_Thread/bsp/k210/base-drivers/drv_io_config.c
  44. 25
      Ubiquitous/RT_Thread/bsp/k210/base-drivers/drv_lcd.c
  45. 5
      Ubiquitous/RT_Thread/bsp/k210/base-drivers/drv_lcd.h
  46. 26
      Ubiquitous/RT_Thread/bsp/k210/rtconfig.h
  47. 47
      Ubiquitous/RT_Thread/bsp/stm32f407-atk-coreboard/.config
  48. 97
      Ubiquitous/RT_Thread/bsp/stm32f407-atk-coreboard/applications/ov2640_test.c
  49. 106
      Ubiquitous/RT_Thread/bsp/stm32f407-atk-coreboard/applications/rw007_test.c
  50. 25
      Ubiquitous/RT_Thread/bsp/stm32f407-atk-coreboard/rtconfig.h
  51. 4
      Ubiquitous/RT_Thread/drivers/Kconfig
  52. 14
      Ubiquitous/RT_Thread/drivers/ov2640/Kconfig
  53. 7
      Ubiquitous/RT_Thread/drivers/ov2640/SConscript
  54. 14
      Ubiquitous/RT_Thread/drivers/ov2640/ov2640_source/SConscript
  55. 1736
      Ubiquitous/RT_Thread/drivers/ov2640/ov2640_source/drv_ov2640.c
  56. 168
      Ubiquitous/RT_Thread/drivers/ov2640/ov2640_source/drv_ov2640.h
  57. 59
      Ubiquitous/RT_Thread/drivers/rw007/Kconfig
  58. 7
      Ubiquitous/RT_Thread/drivers/rw007/SConscript
  59. 52
      Ubiquitous/RT_Thread/drivers/rw007/rw007-source/.gitignore
  60. 201
      Ubiquitous/RT_Thread/drivers/rw007/rw007-source/LICENSE
  61. 59
      Ubiquitous/RT_Thread/drivers/rw007/rw007-source/README.md
  62. 59
      Ubiquitous/RT_Thread/drivers/rw007/rw007-source/README_ZH.md
  63. 87
      Ubiquitous/RT_Thread/drivers/rw007/rw007-source/SConscript
  64. 70
      Ubiquitous/RT_Thread/drivers/rw007/rw007-source/example/rw007_stm32_port.c
  65. 221
      Ubiquitous/RT_Thread/drivers/rw007/rw007-source/inc/spi_wifi_rw007.h
  66. 873
      Ubiquitous/RT_Thread/drivers/rw007/rw007-source/src/spi_wifi_rw007.c

3
.gitignore

@ -1 +1,2 @@
.vscode
*.vscode
*.o

83
APP_Framework/Applications/Kconfig

@ -11,83 +11,10 @@ menu "Applications"
default 85 if KTASK_PRIORITY_256
endmenu
menuconfig APPLICATION_SENSOR
bool "Using sensor apps"
default n
select PERCEPTION_SENSORDEVICE
if APPLICATION_SENSOR
menuconfig APPLICATION_SENSOR_CO2
bool "Using sensor CO2 apps"
default n
select PERCEPTION_CO2
if APPLICATION_SENSOR_CO2
config APPLICATION_SENSOR_CO2_ZG09
bool "Using sensor ZG09 apps"
default n
select PERCEPTION_ZG09
endif
menuconfig APPLICATION_SENSOR_PM1_0
bool "Using sensor PM1.0 apps"
default n
select PERCEPTION_PM
if APPLICATION_SENSOR_PM1_0
config APPLICATION_SENSOR_PM1_0_PS5308
bool "Using sensor PS5308 apps"
default n
select PERCEPTION_PS5308
endif
menuconfig APPLICATION_SENSOR_VOICE
bool "Using sensor voice apps"
default n
select PERCEPTION_VOICE
if APPLICATION_SENSOR_VOICE
config APPLICATION_SENSOR_VOICE_D124
bool "Using sensor D124 apps"
default n
select PERCEPTION_D124
endif
menuconfig APPLICATION_SENSOR_HUMIDITY
bool "Using sensor humidity apps"
default n
select PERCEPTION_HUMIDITY
if APPLICATION_SENSOR_HUMIDITY
config APPLICATION_SENSOR_HUMIDITY_HS300X
bool "Using sensor HS300x apps"
default n
select PERCEPTION_HS300X
endif
menuconfig APPLICATION_SENSOR_TEMPERATURE
bool "Using sensor temperature apps"
default n
select PERCEPTION_TEMPERATURE
if APPLICATION_SENSOR_TEMPERATURE
config APPLICATION_SENSOR_TEMPERATURE_HS300X
bool "Using sensor HS300x apps"
default n
select PERCEPTION_HS300X
endif
endif
menuconfig CONNECTION_COMMUNICATION_ZIGBEE
bool "enable zigbee demo"
default n
select CONFIG_CONNECTION_COMMUNICATION_ZIGBEE
if CONNECTION_COMMUNICATION_ZIGBEE
source "$KERNEL_DIR/framework/connection/Adapter/zigbee/Kconfig"
endif
source "$APP_DIR/Applications/app_test/Kconfig"
source "$APP_DIR/Applications/app_test/Kconfig"
source "$APP_DIR/Applications/connection_app/Kconfig"
source "$APP_DIR/Applications/control_app/Kconfig"
source "$APP_DIR/Applications/knowing_app/Kconfig"
source "$APP_DIR/Applications/sensor_app/Kconfig"
endmenu

40
APP_Framework/Applications/Makefile

@ -2,44 +2,20 @@ SRC_DIR := general_functions
SRC_FILES := main.c framework_init.c
ifeq ($(CONFIG_RESOURCES_SDIO), y)
SRC_FILES += sd_card_mount.c
endif
ifeq ($(CONFIG_RESOURCES_SPI_SD), y)
SRC_FILES += spi_sd_card_mount.c
endif
ifeq ($(CONFIG_CONNECTION_COMMUNICATION_BOOTSTART_LORA_NET_SAMPLE), y)
SRC_DIR += connection_demo/adhoc_lora_demo
endif
ifeq ($(CONFIG_CONNECTION_COMMUNICATION_ZIGBEE), y)
SRC_DIR += connection_demo/zigbee_demo
endif
ifeq ($(CONFIG_CONNECTION_COMMUNICATION_ETHERNET), y)
SRC_DIR += connection_demo/ethernet_demo
ifeq ($(CONFIG_APPLICATION_SENSOR),y)
SRC_DIR += sensor_app
endif
ifeq ($(CONFIG_CONNECTION_COMMUNICATION_WIFI), y)
SRC_DIR += connection_demo/wifi_demo
ifeq ($(CONFIG_APPLICATION_CONNECTION),y)
SRC_DIR += connection_app
endif
ifeq ($(CONFIG_CONNECTION_COMMUNICATION_NB_IOT), y)
SRC_DIR += connection_demo/nbiot_demo
ifeq ($(CONFIG_APPLICATION_KNOWING),y)
SRC_DIR += knowing_app
endif
# ifeq ($(CONFIG_CONNECTION_COMMUNICATION_4G), y)
# SRC_DIR += connection_demo/4G_demo
# endif
ifeq ($(CONFIG_CONNECTION_COMMUNICATION_BLUETOOTH), y)
SRC_DIR += connection_demo/bluetooth_demo
endif
ifeq ($(CONFIG_APPLICATION_SENSOR),y)
SRC_DIR += sensor_app
ifeq ($(CONFIG_APPLICATION_CONTROL),y)
SRC_DIR += control_app
endif
include $(KERNEL_ROOT)/compiler.mk

30
APP_Framework/Applications/app_test/Kconfig

@ -1,18 +1,20 @@
menuconfig USER_TEST
bool "Enable application test function "
default n
menu "test app"
menuconfig USER_TEST
bool "Enable application test function "
default n
if USER_TEST
config USER_TEST_LORA_ADHOC
bool "Config test lora adhoc"
default n
if USER_TEST
config USER_TEST_LORA_ADHOC
bool "Config test lora adhoc"
default n
config USER_TEST_SPI_LORA
bool "Config test spi lora"
default n
config USER_TEST_SPI_LORA
bool "Config test spi lora"
default n
config USER_TEST_SPI_FLASH
bool "Config test spi flash"
default n
config USER_TEST_SPI_FLASH
bool "Config test spi flash"
default n
endif
endif
endmenu

0
APP_Framework/Applications/sd_card_mount.c → APP_Framework/Applications/app_test/sd_card_mount.c

0
APP_Framework/Applications/spi_sd_card_mount.c → APP_Framework/Applications/app_test/spi_sd_card_mount.c

14
APP_Framework/Applications/connection_app/Kconfig

@ -0,0 +1,14 @@
menu "connection app"
menuconfig APPLICATION_CONNECTION
bool "Using connection apps"
default n
menuconfig CONNECTION_COMMUNICATION_ZIGBEE
bool "enable zigbee demo"
default n
select CONFIG_CONNECTION_COMMUNICATION_ZIGBEE
if CONNECTION_COMMUNICATION_ZIGBEE
source "$KERNEL_DIR/framework/connection/Adapter/zigbee/Kconfig"
endif
endmenu

0
APP_Framework/Applications/connection_app/Makefile

0
APP_Framework/Applications/connection_demo/adhoc_lora_demo/Makefile → APP_Framework/Applications/connection_app/adhoc_lora_demo/Makefile

0
APP_Framework/Applications/connection_demo/adhoc_lora_demo/client.c → APP_Framework/Applications/connection_app/adhoc_lora_demo/client.c

0
APP_Framework/Applications/connection_demo/adhoc_lora_demo/gateway.c → APP_Framework/Applications/connection_app/adhoc_lora_demo/gateway.c

0
APP_Framework/Applications/connection_demo/bluetooth_demo/Makefile → APP_Framework/Applications/connection_app/bluetooth_demo/Makefile

0
APP_Framework/Applications/connection_demo/bluetooth_demo/bluetooth_receive_demo.c → APP_Framework/Applications/connection_app/bluetooth_demo/bluetooth_receive_demo.c

0
APP_Framework/Applications/connection_demo/bluetooth_demo/bluetooth_send_demo.c → APP_Framework/Applications/connection_app/bluetooth_demo/bluetooth_send_demo.c

0
APP_Framework/Applications/connection_demo/ethernet_demo/Makefile → APP_Framework/Applications/connection_app/ethernet_demo/Makefile

0
APP_Framework/Applications/connection_demo/ethernet_demo/ethernet_demo.c → APP_Framework/Applications/connection_app/ethernet_demo/ethernet_demo.c

0
APP_Framework/Applications/connection_demo/nbiot_demo/Makefile → APP_Framework/Applications/connection_app/nbiot_demo/Makefile

0
APP_Framework/Applications/connection_demo/nbiot_demo/nbiot_demo.c → APP_Framework/Applications/connection_app/nbiot_demo/nbiot_demo.c

0
APP_Framework/Applications/connection_demo/wifi_demo/Makefile → APP_Framework/Applications/connection_app/wifi_demo/Makefile

0
APP_Framework/Applications/connection_demo/wifi_demo/wifi_demo.c → APP_Framework/Applications/connection_app/wifi_demo/wifi_demo.c

0
APP_Framework/Applications/connection_demo/zigbee_demo/Makefile → APP_Framework/Applications/connection_app/zigbee_demo/Makefile

0
APP_Framework/Applications/connection_demo/zigbee_demo/zigbee_receive_demo.c → APP_Framework/Applications/connection_app/zigbee_demo/zigbee_receive_demo.c

0
APP_Framework/Applications/connection_demo/zigbee_demo/zigbee_send_demo.c → APP_Framework/Applications/connection_app/zigbee_demo/zigbee_send_demo.c

8
APP_Framework/Applications/control_app/Kconfig

@ -0,0 +1,8 @@
menu "control app"
menuconfig APPLICATION_CONTROL
bool "Using control apps"
default n
endmenu

0
APP_Framework/Applications/control_app/Makefile

7
APP_Framework/Applications/knowing_app/Kconfig

@ -0,0 +1,7 @@
menu "knowing app"
menuconfig APPLICATION_KNOWING
bool "Using knowing apps"
default n
endmenu

0
APP_Framework/Applications/knowing_app/Makefile

70
APP_Framework/Applications/sensor_app/Kconfig

@ -0,0 +1,70 @@
menu "sensor app"
menuconfig APPLICATION_SENSOR
bool "Using sensor apps"
default n
select PERCEPTION_SENSORDEVICE
if APPLICATION_SENSOR
menuconfig APPLICATION_SENSOR_CO2
bool "Using sensor CO2 apps"
default n
select PERCEPTION_CO2
if APPLICATION_SENSOR_CO2
config APPLICATION_SENSOR_CO2_ZG09
bool "Using sensor ZG09 apps"
default n
select PERCEPTION_ZG09
endif
menuconfig APPLICATION_SENSOR_PM1_0
bool "Using sensor PM1.0 apps"
default n
select PERCEPTION_PM
if APPLICATION_SENSOR_PM1_0
config APPLICATION_SENSOR_PM1_0_PS5308
bool "Using sensor PS5308 apps"
default n
select PERCEPTION_PS5308
endif
menuconfig APPLICATION_SENSOR_VOICE
bool "Using sensor voice apps"
default n
select PERCEPTION_VOICE
if APPLICATION_SENSOR_VOICE
config APPLICATION_SENSOR_VOICE_D124
bool "Using sensor D124 apps"
default n
select PERCEPTION_D124
endif
menuconfig APPLICATION_SENSOR_HUMIDITY
bool "Using sensor humidity apps"
default n
select PERCEPTION_HUMIDITY
if APPLICATION_SENSOR_HUMIDITY
config APPLICATION_SENSOR_HUMIDITY_HS300X
bool "Using sensor HS300x apps"
default n
select PERCEPTION_HS300X
endif
menuconfig APPLICATION_SENSOR_TEMPERATURE
bool "Using sensor temperature apps"
default n
select PERCEPTION_TEMPERATURE
if APPLICATION_SENSOR_TEMPERATURE
config APPLICATION_SENSOR_TEMPERATURE_HS300X
bool "Using sensor HS300x apps"
default n
select PERCEPTION_HS300X
endif
endif
endmenu

41
APP_Framework/Framework/Kconfig

@ -1,22 +1,27 @@
config TRANSFORM_LAYER_ATTRIUBUTE
bool "support transform layer"
default y
choice
prompt "select os features"
default ADD_XIUOS_FETURES
menu "Framework"
config ADD_XIUOS_FETURES
bool "add xiuos fetures"
config ADD_NUTTX_FETURES
bool "add nuttx fetures"
config TRANSFORM_LAYER_ATTRIUBUTE
bool "support transform layer"
default y
choice
prompt "select os features"
default ADD_XIUOS_FETURES
config ADD_RTTHREAD_FETURES
bool "add rt_thread fetures"
endchoice
config ADD_XIUOS_FETURES
bool "add xiuos fetures"
config ADD_NUTTX_FETURES
bool "add nuttx fetures"
config ADD_RTTHREAD_FETURES
bool "add rt_thread fetures"
endchoice
source "$APP_DIR/Framework/sensor/Kconfig"
source "$APP_DIR/Framework/connection/Kconfig"
source "$APP_DIR/Framework/know/tflite_sin/Kconfig"
source "$APP_DIR/Framework/know/tflite_mnist/Kconfig"
source "$APP_DIR/Framework/sensor/Kconfig"
source "$APP_DIR/Framework/connection/Kconfig"
source "$APP_DIR/Framework/know/Kconfig"
source "$APP_DIR/Framework/control/Kconfig"
endmenu

9
APP_Framework/Framework/Makefile

@ -8,5 +8,14 @@ ifeq ($(CONFIG_SUPPORT_CONNECTION_FRAMEWORK),y)
SRC_DIR += connection
endif
ifeq ($(CONFIG_SUPPORT_KNOWING_FRAMEWORK),y)
SRC_DIR += know
endif
ifeq ($(CONFIG_SUPPORT_CONTROL_FRAMEWORK),y)
SRC_DIR += control
endif
include $(KERNEL_ROOT)/compiler.mk

3
APP_Framework/Framework/control/Kconfig

@ -0,0 +1,3 @@
menuconfig SUPPORT_CONTROL_FRAMEWORK
bool "support control framework"
default n

3
APP_Framework/Framework/control/Makefile

@ -0,0 +1,3 @@
SRC_DIR :=
include $(KERNEL_ROOT)/compiler.mk

8
APP_Framework/Framework/know/Kconfig

@ -0,0 +1,8 @@
menuconfig SUPPORT_KNOWING_FRAMEWORK
bool "support knowing framework"
default y
if SUPPORT_KNOWING_FRAMEWORK
source "$APP_DIR/Framework/know/tflite_sin/Kconfig"
source "$APP_DIR/Framework/know/tflite_mnist/Kconfig"
endif

13
APP_Framework/Framework/know/Makefile

@ -0,0 +1,13 @@
SRC_DIR :=
ifeq ($(CONFIG_SUPPORT_KNOW_FRAMEWORK),y)
ifeq ($(CONFIG_USING_TFLITE_MNIST),y)
SRC_DIR += tflite_mnist
endif
ifeq ($(CONFIG_USING_TFLITE_SIN),y)
SRC_DIR += tflite_sin
endif
endif
include $(KERNEL_ROOT)/compiler.mk

2
APP_Framework/Framework/know/tflite_mnist/Kconfig

@ -1,4 +1,4 @@
config USING_TFLITE_MNIST
menuconfig USING_TFLITE_MNIST
bool "mnist demo app for tflite micro"
depends on INTELLIGENT_TFLITE
default n

2
APP_Framework/Framework/know/tflite_sin/Kconfig

@ -1,4 +1,4 @@
config USING_TFLITE_SIN
menuconfig USING_TFLITE_SIN
bool "sin(x) demo app for tflite micro"
depends on INTELLIGENT_TFLITE
default n

2
APP_Framework/Kconfig

@ -7,5 +7,7 @@ menu "APP_Framework"
source "$APP_DIR/Applications/Kconfig"
source "$APP_DIR/Framework/Kconfig"
source "$APP_DIR/lib/Kconfig"
endmenu

14
APP_Framework/lib/Kconfig

@ -0,0 +1,14 @@
menu "app lib"
choice
prompt "chose a kind of lib for app"
default APP_SELECT_NEWLIB
config APP_SELECT_NEWLIB
bool "app select newlib"
config APP_SELECT_OTHER_LIB
bool "app select other lib"
endchoice
endmenu

7
APP_Framework/lib/Makefile

@ -1,7 +1,10 @@
SRC_DIR :=
ifeq ($(CONFIG_SEPARATE_COMPILE),y)
SRC_DIR += app_newlib
ifeq ($(CONFIG_APP_SELECT_NEWLIB),y)
ifeq ($(CONFIG_SEPARATE_COMPILE),y)
SRC_DIR += app_newlib
endif
endif
include $(KERNEL_ROOT)/compiler.mk

38
Ubiquitous/RT_Thread/bsp/k210/.config

@ -368,22 +368,20 @@ CONFIG_BSP_UART1_RXD_PIN=21
# CONFIG_BSP_USING_UART2 is not set
# CONFIG_BSP_USING_UART3 is not set
# CONFIG_BSP_USING_I2C1 is not set
# CONFIG_BSP_USING_SPI1 is not set
CONFIG_BSP_USING_SPI1=y
# CONFIG_BSP_USING_SPI1_AS_QSPI is not set
CONFIG_BSP_SPI1_CLK_PIN=27
CONFIG_BSP_SPI1_D0_PIN=28
CONFIG_BSP_SPI1_D1_PIN=26
CONFIG_BSP_SPI1_USING_SS0=y
CONFIG_BSP_SPI1_SS0_PIN=29
CONFIG_BSP_SPI1_USING_SS1=y
CONFIG_BSP_SPI1_SS1_PIN=8
# CONFIG_BSP_SPI1_USING_SS2 is not set
# CONFIG_BSP_SPI1_USING_SS3 is not set
# CONFIG_BSP_USING_LCD is not set
# CONFIG_BSP_USING_SDCARD is not set
CONFIG_BSP_USING_DVP=y
#
# The default pin assignment is based on the Maix Duino K210 development board
#
CONFIG_BSP_DVP_SCCB_SDA_PIN=40
CONFIG_BSP_DVP_SCCB_SCLK_PIN=41
CONFIG_BSP_DVP_CMOS_RST_PIN=42
CONFIG_BSP_DVP_CMOS_VSYNC_PIN=43
CONFIG_BSP_DVP_CMOS_PWDN_PIN=44
CONFIG_BSP_DVP_CMOS_XCLK_PIN=46
CONFIG_BSP_DVP_CMOS_PCLK_PIN=47
CONFIG_BSP_DVP_CMOS_HREF_PIN=45
CONFIG_BSP_USING_SDCARD=y
# CONFIG_BSP_USING_DVP is not set
#
# Kendryte SDK Config
@ -393,4 +391,14 @@ CONFIG_PKG_KENDRYTE_SDK_VERNUM=0x0055
#
# More Drivers
#
# CONFIG_PKG_USING_RW007 is not set
# CONFIG_DRV_USING_OV2640 is not set
#
# Applications
#
#
# Framework
#
CONFIG___STACKSIZE__=4096

106
Ubiquitous/RT_Thread/bsp/k210/applications/ov2640_test.c

@ -0,0 +1,106 @@
#include <rtthread.h>
#include <rtdevice.h>
#include "stdio.h"
#include "string.h"
#include "dvp.h"
#include "fpioa.h"
#include "plic.h"
#include "sysctl.h"
#if(defined DRV_USING_OV2640 && defined BSP_USING_LCD)
#include<drv_ov2640.h>
#define RGB_BUF_SIZE (320*240*2)
#ifdef RT_USING_POSIX
#include <pthread.h>
#include <unistd.h>
#include <stdio.h>
#include <dfs_poll.h>
#ifdef RT_USING_POSIX_TERMIOS
#include <posix_termios.h>
#endif
#endif
static int g_fd = 0;
static _ioctl_shoot_para shoot_para_t = {0};
void ov2640_test(int argc, char **argv)
{
extern void lcd_draw_picture(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, uint32_t *ptr);
g_fd = open("/dev/ov2640",O_RDONLY);
if(g_fd < 0)
{
printf("open ov2640 fail !!");
return;
}
if (argc < 2)
{
printf("Usage:ov2640 display images in real time or take photos \n");
printf("Like: ov2640_test 1(take photos )\n");
printf("Like: ov2640_test 0(display images in real time )\n");
close(g_fd);
return ;
}
uint32_t* rgbbuffer = rt_malloc(RGB_BUF_SIZE);
rt_thread_t tid;
rt_err_t ret = 0;
int temf = 0;
if(NULL == rgbbuffer)
{
printf("malloc rgbbuffer failed ! \n");
close(g_fd);
return;
}
temf = strtoul(argv[1],0, 10);
printf("ov2640_test choose %d mode \n",temf);
shoot_para_t.pdata = (uint32_t)(rgbbuffer);
shoot_para_t.length = RGB_BUF_SIZE;
if(temf == 0)
{
void lcd_show_ov2640_thread(uint32_t* rgbbuffer);
tid = rt_thread_create("lcdshow", lcd_show_ov2640_thread, rgbbuffer,3000, 9, 20);
rt_thread_startup(tid);
}
else
{
memset(rgbbuffer,0,320*240*2);
ret = ioctl(g_fd,IOCTRL_CAMERA_START_SHOT,&shoot_para_t);
// ret = rt_ov2640_start_shoot((uint32_t)(rgbbuffer), RGB_BUF_SIZE);
if(RT_ERROR == ret)
{
printf("ov2640 can't wait event flag");
close(g_fd);
return;
}
lcd_draw_picture(0, 0, 320, 240, rgbbuffer);
rt_thread_mdelay(100);
printf("the lcd has shown the image \n");
rt_free(rgbbuffer);
close(g_fd);
}
}
MSH_CMD_EXPORT(ov2640_test,lcd show camera shot image);
void lcd_show_ov2640_thread(uint32_t* rgbbuffer)
{
extern void lcd_draw_picture(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, uint32_t *ptr);
rt_err_t ret = 0;
while(1)
{
ret = ioctl(g_fd,IOCTRL_CAMERA_START_SHOT,&shoot_para_t);
if(RT_ERROR == ret)
{
printf("ov2640 can't wait event flag");
rt_free(rgbbuffer);
return;
}
lcd_draw_picture(0, 0, 320, 240, rgbbuffer);
rt_thread_mdelay(2);
}
}
#endif

105
Ubiquitous/RT_Thread/bsp/k210/applications/rw007_test.c

@ -0,0 +1,105 @@
#include <rtthread.h>
#ifdef PKG_USING_RW007
#include <netdb.h>
#include <string.h>
#include <finsh.h>
#include <sys/socket.h>
static const char send_data[] = "This is TCP Client from AIIT";
void rw007_test(int argc, char **argv)
{
int ret;
char *recv_data;
struct hostent *host;
int sock, bytes_received;
struct sockaddr_in server_addr;
const char *url;
int port;
extern rt_bool_t rt_wlan_is_connected(void);
if (rt_wlan_is_connected() != 1)
{
printf("Please connect a wifi firstly\n");
return;
}
if (argc < 3)
{
printf("Usage: rw007 URL PORT\n");
printf("Like: rw007 192.168.12.44 5000\n");
return ;
}
url = argv[1];
port = strtoul(argv[2], 0, 10);
host = gethostbyname(url);
recv_data = rt_malloc(1024);
if (recv_data == RT_NULL)
{
printf("No memory\n");
return;
}
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1)
{
printf("Socket error\n");
rt_free(recv_data);
return;
}
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(port);
server_addr.sin_addr = *((struct in_addr *)host->h_addr);
rt_memset(&(server_addr.sin_zero), 0, sizeof(server_addr.sin_zero));
if (connect(sock, (struct sockaddr *)&server_addr, sizeof(struct sockaddr)) == -1)
{
printf("Connect fail!\n");
closesocket(sock);
rt_free(recv_data);
return;
}
else
{
printf("Connect successful\n");
}
while (1)
{
bytes_received = recv(sock, recv_data, 1024 - 1, 0);
if (bytes_received < 0)
{
closesocket(sock);
printf("\nreceived error,close the socket.\r\n");
rt_free(recv_data);
break;
}
else if (bytes_received == 0)
{
closesocket(sock);
printf("\nreceived error,close the socket.\r\n");
rt_free(recv_data);
break;
}
recv_data[bytes_received] = '\0';
if (strncmp(recv_data, "q", 1) == 0 || strncmp(recv_data, "Q", 1) == 0)
{
closesocket(sock);
printf("\n got a 'q' or 'Q',close the socket.\r\n");
rt_free(recv_data);
break;
}
else
{
printf("\nReceived data = %s ", recv_data);
}
ret = send(sock, send_data, strlen(send_data), 0);
if (ret < 0)
{
closesocket(sock);
printf("\nsend error,close the socket.\r\n");
rt_free(recv_data);
break;
}
else if (ret == 0)
{
printf("\n Send warning,send function return 0.\r\n");
}
}
return;
}
MSH_CMD_EXPORT(rw007_test, a tcp client sample);
#endif

5
Ubiquitous/RT_Thread/bsp/k210/base-drivers/drv_io_config.c

@ -37,7 +37,7 @@ static struct io_config
IOCONFIG(BSP_DVP_CMOS_HREF_PIN, FUNC_CMOS_HREF),
#endif
#ifdef BSP_USING_LCD
#if 0 //here is a drv lcd bug now don't know why
IOCONFIG(BSP_LCD_CS_PIN, FUNC_SPI0_SS3), /* LCD CS PIN */
IOCONFIG(BSP_LCD_WR_PIN, FUNC_SPI0_SCLK), /* LCD WR PIN */
IOCONFIG(BSP_LCD_DC_PIN, FUNC_GPIOHS2), /* LCD DC PIN */
@ -123,6 +123,9 @@ int io_config_init(void)
sysctl_set_power_mode(SYSCTL_POWER_BANK6, SYSCTL_POWER_V18);
sysctl_set_power_mode(SYSCTL_POWER_BANK7, SYSCTL_POWER_V18);
#endif
#ifdef FACE_DETECT
sysctl_clock_enable(SYSCTL_CLOCK_AI);
#endif
}
INIT_BOARD_EXPORT(io_config_init);

25
Ubiquitous/RT_Thread/bsp/k210/base-drivers/drv_lcd.c

@ -52,9 +52,9 @@ static void init_rst(void)
{
gpiohs_set_drive_mode(RST_GPIONUM, GPIO_DM_OUTPUT);
gpiohs_set_pin(RST_GPIONUM, GPIO_PV_LOW);
usleep(100000);
rt_thread_mdelay(10);
gpiohs_set_pin(RST_GPIONUM, GPIO_PV_HIGH);
usleep(100000);
rt_thread_mdelay(10);
}
@ -122,17 +122,26 @@ void lcd_interrupt_enable(void)
lcd_ctl.mode = 1;
}
void lcd_pre()
{
fpioa_set_function(37, FUNC_GPIOHS0 + RST_GPIONUM);
fpioa_set_function(38, FUNC_GPIOHS0 + DCX_GPIONUM);
fpioa_set_function(36, FUNC_SPI0_SS0 + LCD_SPI_SLAVE_SELECT);
fpioa_set_function(39, FUNC_SPI0_SCLK);
}
int lcd_init(void)
{
uint8_t data = 0;
lcd_pre();
tft_hard_init();
/*soft reset*/
tft_write_command(SOFTWARE_RESET);
usleep(100000);
rt_thread_mdelay(10);
/*exit sleep*/
tft_write_command(SLEEP_OFF);
usleep(100000);
rt_thread_mdelay(10);
/*pixel format*/
tft_write_command(PIXEL_FORMAT_SET);
data = 0x55;
@ -302,14 +311,8 @@ void lcd_draw_picture(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height,
lcd_set_area(x1, y1, x1 + width - 1, y1 + height - 1);
tft_write_word(ptr, width * height / 2, lcd_ctl.mode ? 2 : 0);
}
void lcd_pre()
{
fpioa_set_function(38, FUNC_GPIOHS0 + DCX_GPIONUM);
fpioa_set_function(36, FUNC_SPI0_SS3);
fpioa_set_function(39, FUNC_SPI0_SCLK);
fpioa_set_function(37, FUNC_GPIOHS0 + RST_GPIONUM);
}
void lcd_test0()
{
char test[]={"xuos-intelligence framwork"};

5
Ubiquitous/RT_Thread/bsp/k210/base-drivers/drv_lcd.h

@ -96,8 +96,9 @@
#define DIGITAL_GAMMA_CTL2 0xE3
#define INTERFACE_CTL 0xF6
#define DCX_GPIONUM (2)
#define RST_GPIONUM (3)
#define DCX_GPIONUM (5)
#define RST_GPIONUM (4)
#define LCD_SPI_SLAVE_SELECT 3
#define SPI_CHANNEL 0
#define SPI_SLAVE_SELECT 3

26
Ubiquitous/RT_Thread/bsp/k210/rtconfig.h

@ -246,18 +246,15 @@
#define BSP_USING_UART1
#define BSP_UART1_TXD_PIN 20
#define BSP_UART1_RXD_PIN 21
#define BSP_USING_DVP
/* The default pin assignment is based on the Maix Duino K210 development board */
#define BSP_DVP_SCCB_SDA_PIN 40
#define BSP_DVP_SCCB_SCLK_PIN 41
#define BSP_DVP_CMOS_RST_PIN 42
#define BSP_DVP_CMOS_VSYNC_PIN 43
#define BSP_DVP_CMOS_PWDN_PIN 44
#define BSP_DVP_CMOS_XCLK_PIN 46
#define BSP_DVP_CMOS_PCLK_PIN 47
#define BSP_DVP_CMOS_HREF_PIN 45
#define BSP_USING_SPI1
#define BSP_SPI1_CLK_PIN 27
#define BSP_SPI1_D0_PIN 28
#define BSP_SPI1_D1_PIN 26
#define BSP_SPI1_USING_SS0
#define BSP_SPI1_SS0_PIN 29
#define BSP_SPI1_USING_SS1
#define BSP_SPI1_SS1_PIN 8
#define BSP_USING_SDCARD
/* Kendryte SDK Config */
@ -265,6 +262,11 @@
/* More Drivers */
/* Applications */
/* Framework */
#define __STACKSIZE__ 4096
#endif

47
Ubiquitous/RT_Thread/bsp/stm32f407-atk-coreboard/.config

@ -126,7 +126,28 @@ CONFIG_DFS_FILESYSTEMS_MAX=2
CONFIG_DFS_FILESYSTEM_TYPES_MAX=2
CONFIG_DFS_FD_MAX=16
# CONFIG_RT_USING_DFS_MNTTABLE is not set
# CONFIG_RT_USING_DFS_ELMFAT is not set
CONFIG_RT_USING_DFS_ELMFAT=y
#
# elm-chan's FatFs, Generic FAT Filesystem Module
#
CONFIG_RT_DFS_ELM_CODE_PAGE=437
CONFIG_RT_DFS_ELM_WORD_ACCESS=y
# CONFIG_RT_DFS_ELM_USE_LFN_0 is not set
# CONFIG_RT_DFS_ELM_USE_LFN_1 is not set
# CONFIG_RT_DFS_ELM_USE_LFN_2 is not set
CONFIG_RT_DFS_ELM_USE_LFN_3=y
CONFIG_RT_DFS_ELM_USE_LFN=3
CONFIG_RT_DFS_ELM_LFN_UNICODE_0=y
# CONFIG_RT_DFS_ELM_LFN_UNICODE_1 is not set
# CONFIG_RT_DFS_ELM_LFN_UNICODE_2 is not set
# CONFIG_RT_DFS_ELM_LFN_UNICODE_3 is not set
CONFIG_RT_DFS_ELM_LFN_UNICODE=0
CONFIG_RT_DFS_ELM_MAX_LFN=255
CONFIG_RT_DFS_ELM_DRIVES=2
CONFIG_RT_DFS_ELM_MAX_SECTOR_SIZE=512
# CONFIG_RT_DFS_ELM_USE_ERASE is not set
CONFIG_RT_DFS_ELM_REENTRANT=y
CONFIG_RT_USING_DFS_DEVFS=y
# CONFIG_RT_USING_DFS_ROMFS is not set
# CONFIG_RT_USING_DFS_RAMFS is not set
@ -162,7 +183,7 @@ CONFIG_RT_USING_PIN=y
# CONFIG_RT_USING_SDIO is not set
CONFIG_RT_USING_SPI=y
# CONFIG_RT_USING_QSPI is not set
# CONFIG_RT_USING_SPI_MSD is not set
CONFIG_RT_USING_SPI_MSD=y
# CONFIG_RT_USING_SFUD is not set
# CONFIG_RT_USING_ENC28J60 is not set
# CONFIG_RT_USING_SPI_WIFI is not set
@ -348,10 +369,12 @@ CONFIG_BSP_USING_USB_TO_USART=y
CONFIG_BSP_USING_SRAM=y
# CONFIG_BSP_USING_SPI_FLASH is not set
# CONFIG_BSP_USING_EEPROM is not set
# CONFIG_BSP_USING_OV2640 is not set
CONFIG_BSP_USING_OV2640=y
# CONFIG_BSP_USING_ETH is not set
# CONFIG_BSP_USING_MPU6050 is not set
# CONFIG_BSP_USING_SDCARD is not set
CONFIG_BSP_USING_SDCARD=y
CONFIG_SDCARD_SPI2_CS_PIN=28
CONFIG_SDCARD_SPI_BUS_NAME="spi2"
#
# On-chip Peripheral Drivers
@ -373,7 +396,9 @@ CONFIG_BSP_USING_SPI=y
CONFIG_BSP_USING_SPI1=y
# CONFIG_BSP_SPI1_TX_USING_DMA is not set
# CONFIG_BSP_SPI1_RX_USING_DMA is not set
# CONFIG_BSP_USING_SPI2 is not set
CONFIG_BSP_USING_SPI2=y
# CONFIG_BSP_SPI2_TX_USING_DMA is not set
# CONFIG_BSP_SPI2_RX_USING_DMA is not set
# CONFIG_BSP_USING_ADC is not set
CONFIG_BSP_USING_I2C1=y
CONFIG_BSP_I2C1_SCL_PIN=54
@ -397,3 +422,15 @@ CONFIG_BSP_USING_FMC=y
#
# More Drivers
#
# CONFIG_PKG_USING_RW007 is not set
# CONFIG_RW007_NOT_USE_EXAMPLE_DRIVERS is not set
# CONFIG_RW007_USING_STM32_DRIVERS is not set
# CONFIG_DRV_USING_OV2640 is not set
#
# Applications
#
#
# Framework
#

97
Ubiquitous/RT_Thread/bsp/stm32f407-atk-coreboard/applications/ov2640_test.c

@ -0,0 +1,97 @@
#include <rtthread.h>
#include <rtdevice.h>
#include "stdio.h"
#include "string.h"
#ifdef DRV_USING_OV2640
#ifdef RT_USING_POSIX
#include <dfs_posix.h>
#include <dfs_poll.h>
#ifdef RT_USING_POSIX_TERMIOS
#include <posix_termios.h>
#endif
#endif
#include<drv_ov2640.h>
#define JPEG_BUF_SIZE (1024*200)
#define UART_NUMBER2 "uart2"
void ov2640_test(int argc, char **argv)
{
rt_err_t ret = 0;
int fd = 0;
fd = open("/dev/ov2640",O_RDONLY);
if(fd < 0)
{
printf("open ov2640 fail !!");
return;
}
rt_uint8_t* JpegBuffer = rt_malloc(JPEG_BUF_SIZE);
_ioctl_shoot_para shoot_para_t = {0};
if (RT_NULL == JpegBuffer)
{
printf("JpegBuffer senddata buf malloc error!\n");
return;
}
printf("ov2640 test by printing the image value in memory \r\n");
shoot_para_t.pdata = (uint32_t)JpegBuffer;
shoot_para_t.length = JPEG_BUF_SIZE;
ret = ioctl(fd,IOCTRL_CAMERA_START_SHOT,&shoot_para_t);
if(RT_ERROR == ret)
{
printf("ov2640 can't wait event flag");
return;
}
printf("print the vaule:\r\n\r\n");
ret = rt_ov2640_calculate_jpeg_len(JpegBuffer,JPEG_BUF_SIZE);
printf("photo leghth is %d :\r\n\r\n",ret);
#ifdef BSP_USING_UART2
void img_output_uart2(rt_uint8_t* jpegbuf,rt_uint16_t len);
img_output_uart2(JpegBuffer,ret);
#endif
for(int i =0;i<ret;i++)
{
printf("%x",*(JpegBuffer+i));
}
printf("\r\n\r\n above :\r\n\r\n");
rt_free(JpegBuffer);
close(fd);
return;
}
MSH_CMD_EXPORT(ov2640_test,printing the image value in memory);
#ifdef BSP_USING_UART2
void img_output_uart2(rt_uint8_t* jpegbuf,rt_uint16_t len)
{
static rt_uint8_t i =0;
static rt_device_t serial = NULL;
int ret = RT_EOK;
if(i == 0)
{
i = 1;
serial = rt_device_find(UART_NUMBER2);
if (!serial)
{
printf("find uart2 failed!\n");
i = 2;
return;
}
ret = rt_device_open(serial, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX);
if(ret != RT_EOK)
{
printf("open uart2 failed!\n");
i = 2;
return ;
}
}
if(i == 1)
{
rt_device_write(serial, 0, jpegbuf, len);
}
}
#endif
#endif

106
Ubiquitous/RT_Thread/bsp/stm32f407-atk-coreboard/applications/rw007_test.c

@ -0,0 +1,106 @@
#include <rtthread.h>
#ifdef PKG_USING_RW007
#include <netdb.h>
#include <string.h>
#include <finsh.h>
#include <sys/socket.h>
static const char send_data[] = "This is TCP Client from AIIT";
void rw007_test(int argc, char **argv)
{
int ret;
char *recv_data;
struct hostent *host;
int sock, bytes_received;
struct sockaddr_in server_addr;
const char *url;
int port;
extern rt_bool_t rt_wlan_is_connected(void);
if (rt_wlan_is_connected() != 1)
{
printf("Please connect a wifi firstly\n");
return;
}
if (argc < 3)
{
printf("Usage: tcpclient URL PORT\n");
printf("Like: tcpclient 192.168.12.44 5000\n");
return ;
}
url = argv[1];
port = strtoul(argv[2], 0, 10);
host = gethostbyname(url);
recv_data = rt_malloc(1024);
if (recv_data == RT_NULL)
{
printf("No memory\n");
return;
}
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1)
{
printf("Socket error\n");
rt_free(recv_data);
return;
}
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(port);
server_addr.sin_addr = *((struct in_addr *)host->h_addr);
rt_memset(&(server_addr.sin_zero), 0, sizeof(server_addr.sin_zero));
if (connect(sock, (struct sockaddr *)&server_addr, sizeof(struct sockaddr)) == -1)
{
printf("Connect fail!\n");
closesocket(sock);
rt_free(recv_data);
return;
}
else
{
printf("Connect successful\n");
}
while (1)
{
bytes_received = recv(sock, recv_data, 1024 - 1, 0);
if (bytes_received < 0)
{
closesocket(sock);
printf("\nreceived error,close the socket.\r\n");
rt_free(recv_data);
break;
}
else if (bytes_received == 0)
{
closesocket(sock);
printf("\nreceived error,close the socket.\r\n");
rt_free(recv_data);
break;
}
recv_data[bytes_received] = '\0';
if (strncmp(recv_data, "q", 1) == 0 || strncmp(recv_data, "Q", 1) == 0)
{
closesocket(sock);
printf("\n got a 'q' or 'Q',close the socket.\r\n");
rt_free(recv_data);
break;
}
else
{
printf("\nReceived data = %s ", recv_data);
}
ret = send(sock, send_data, strlen(send_data), 0);
if (ret < 0)
{
closesocket(sock);
printf("\nsend error,close the socket.\r\n");
rt_free(recv_data);
break;
}
else if (ret == 0)
{
printf("\n Send warning,send function return 0.\r\n");
}
}
return;
}
MSH_CMD_EXPORT(rw007_test, a tcp client sample);
#endif

25
Ubiquitous/RT_Thread/bsp/stm32f407-atk-coreboard/rtconfig.h

@ -91,6 +91,20 @@
#define DFS_FILESYSTEMS_MAX 2
#define DFS_FILESYSTEM_TYPES_MAX 2
#define DFS_FD_MAX 16
#define RT_USING_DFS_ELMFAT
/* elm-chan's FatFs, Generic FAT Filesystem Module */
#define RT_DFS_ELM_CODE_PAGE 437
#define RT_DFS_ELM_WORD_ACCESS
#define RT_DFS_ELM_USE_LFN_3
#define RT_DFS_ELM_USE_LFN 3
#define RT_DFS_ELM_LFN_UNICODE_0
#define RT_DFS_ELM_LFN_UNICODE 0
#define RT_DFS_ELM_MAX_LFN 255
#define RT_DFS_ELM_DRIVES 2
#define RT_DFS_ELM_MAX_SECTOR_SIZE 512
#define RT_DFS_ELM_REENTRANT
#define RT_USING_DFS_DEVFS
/* Device Drivers */
@ -107,6 +121,7 @@
#define RT_USING_I2C_BITOPS
#define RT_USING_PIN
#define RT_USING_SPI
#define RT_USING_SPI_MSD
#define RT_USING_WIFI
#define RT_WLAN_DEVICE_STA_NAME "wlan0"
#define RT_WLAN_DEVICE_AP_NAME "wlan1"
@ -230,6 +245,10 @@
#define BSP_USING_USB_TO_USART
#define BSP_USING_SRAM
#define BSP_USING_OV2640
#define BSP_USING_SDCARD
#define SDCARD_SPI2_CS_PIN 28
#define SDCARD_SPI_BUS_NAME "spi2"
/* On-chip Peripheral Drivers */
@ -238,6 +257,7 @@
#define BSP_USING_UART1
#define BSP_USING_SPI
#define BSP_USING_SPI1
#define BSP_USING_SPI2
#define BSP_USING_I2C1
#define BSP_I2C1_SCL_PIN 54
#define BSP_I2C1_SDA_PIN 55
@ -250,4 +270,9 @@
/* More Drivers */
/* Applications */
/* Framework */
#endif

4
Ubiquitous/RT_Thread/drivers/Kconfig

@ -1,5 +1,5 @@
menu "More Drivers"
#source "$RT_Thread_DIR/drivers/rw007/Kconfig"
#source "$RT_Thread_DIR/drivers/ov2640/Kconfig"
source "$RT_Thread_DIR/drivers/rw007/Kconfig"
source "$RT_Thread_DIR/drivers/ov2640/Kconfig"
endmenu

14
Ubiquitous/RT_Thread/drivers/ov2640/Kconfig

@ -0,0 +1,14 @@
menuconfig DRV_USING_OV2640
bool "ov2640 driver"
default n
if SOC_FAMILY_STM32
config DRV_USING_OV2640
select BSP_USING_DCMI
endif
if BOARD_K210_EVB
config DRV_USING_OV2640
select BSP_USING_DVP
endif

7
Ubiquitous/RT_Thread/drivers/ov2640/SConscript

@ -0,0 +1,7 @@
Import('RTT_ROOT')
from building import *
cwd = GetCurrentDir()
objs = SConscript(os.path.join(cwd, 'ov2640_source', 'SConscript'))
Return('objs')

14
Ubiquitous/RT_Thread/drivers/ov2640/ov2640_source/SConscript

@ -0,0 +1,14 @@
import os
from building import *
Import('RTT_ROOT')
Import('rtconfig')
cwd = GetCurrentDir()
DEPENDS = ["DRV_USING_OV2640"]
SOURCES = []
if GetDepend(['DRV_USING_OV2640']):
SOURCES += ['drv_ov2640.c']
path = [cwd]
objs = DefineGroup('ov2640', src = SOURCES, depend = DEPENDS,CPPPATH = path)
Return("objs")

1736
Ubiquitous/RT_Thread/drivers/ov2640/ov2640_source/drv_ov2640.c

File diff suppressed because it is too large

168
Ubiquitous/RT_Thread/drivers/ov2640/ov2640_source/drv_ov2640.h

@ -0,0 +1,168 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2020-07-27 thread-liu first version
* 2021-1-15 xiaoyu add set resolution function and the way of reset different manufactures's ov2640 egg:zhendianyuanzi and weixue
*/
#ifndef __DRV_OV2640_H__
#define __DRV_OV2640_H__
#include <rtthread.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef SOC_FAMILY_STM32
#include<drv_dcmi.h>
#elif defined BOARD_K210_EVB
#include<drv_dvp.h>
#endif
#ifdef SOC_FAMILY_STM32
#define DEV_ADDRESS 0x30 /* OV2640 address with rt-thread iic */
#elif defined BOARD_K210_EVB
#define DEV_ADDRESS 0x60 /* OV2640 address */
#endif
#define LARGE_PHOTO_MODE (8)
#define I2C_NAME "i2c1"
#define RECV_EVENT_FLAG (1 << 1) //flag about event control block
#define OV2640_MID 0X7FA2
#define OV2640_PID 0X2642
#define OV2640_ZDYZ //The macro definition of the manufacturer's product
//DSP register address map table for OV2640 when DSP address (0xFF =0X00) is selected
#define OV2640_DSP_R_BYPASS 0x05
#define OV2640_DSP_Qs 0x44
#define OV2640_DSP_CTRL 0x50
#define OV2640_DSP_HSIZE1 0x51
#define OV2640_DSP_VSIZE1 0x52
#define OV2640_DSP_XOFFL 0x53
#define OV2640_DSP_YOFFL 0x54
#define OV2640_DSP_VHYX 0x55
#define OV2640_DSP_DPRP 0x56
#define OV2640_DSP_TEST 0x57
#define OV2640_DSP_ZMOW 0x5A
#define OV2640_DSP_ZMOH 0x5B
#define OV2640_DSP_ZMHH 0x5C
#define OV2640_DSP_BPADDR 0x7C
#define OV2640_DSP_BPDATA 0x7D
#define OV2640_DSP_CTRL2 0x86
#define OV2640_DSP_CTRL3 0x87
#define OV2640_DSP_SIZEL 0x8C
#define OV2640_DSP_HSIZE2 0xC0
#define OV2640_DSP_VSIZE2 0xC1
#define OV2640_DSP_CTRL0 0xC2
#define OV2640_DSP_CTRL1 0xC3
#define OV2640_DSP_R_DVP_SP 0xD3
#define OV2640_DSP_IMAGE_MODE 0xDA
#define OV2640_DSP_RESET 0xE0
#define OV2640_DSP_MS_SP 0xF0
#define OV2640_DSP_SS_ID 0x7F
#define OV2640_DSP_SS_CTRL 0xF8
#define OV2640_DSP_MC_BIST 0xF9
#define OV2640_DSP_MC_AL 0xFA
#define OV2640_DSP_MC_AH 0xFB
#define OV2640_DSP_MC_D 0xFC
#define OV2640_DSP_P_STATUS 0xFE
#define OV2640_DSP_RA_DLMT 0xFF
//DSP register address map table for OV2640 when DSP address (0xFF =0X01) is selected
#define OV2640_SENSOR_GAIN 0x00
#define OV2640_SENSOR_COM1 0x03
#define OV2640_SENSOR_REG04 0x04
#define OV2640_SENSOR_REG08 0x08
#define OV2640_SENSOR_COM2 0x09
#define OV2640_SENSOR_PIDH 0x0A
#define OV2640_SENSOR_PIDL 0x0B
#define OV2640_SENSOR_COM3 0x0C
#define OV2640_SENSOR_COM4 0x0D
#define OV2640_SENSOR_AEC 0x10
#define OV2640_SENSOR_CLKRC 0x11
#define OV2640_SENSOR_COM7 0x12
#define OV2640_SENSOR_COM8 0x13
#define OV2640_SENSOR_COM9 0x14
#define OV2640_SENSOR_COM10 0x15
#define OV2640_SENSOR_HREFST 0x17
#define OV2640_SENSOR_HREFEND 0x18
#define OV2640_SENSOR_VSTART 0x19
#define OV2640_SENSOR_VEND 0x1A
#define OV2640_SENSOR_MIDH 0x1C
#define OV2640_SENSOR_MIDL 0x1D
#define OV2640_SENSOR_AEW 0x24
#define OV2640_SENSOR_AEB 0x25
#define OV2640_SENSOR_W 0x26
#define OV2640_SENSOR_REG2A 0x2A
#define OV2640_SENSOR_FRARL 0x2B
#define OV2640_SENSOR_ADDVSL 0x2D
#define OV2640_SENSOR_ADDVHS 0x2E
#define OV2640_SENSOR_YAVG 0x2F
#define OV2640_SENSOR_REG32 0x32
#define OV2640_SENSOR_ARCOM2 0x34
#define OV2640_SENSOR_REG45 0x45
#define OV2640_SENSOR_FLL 0x46
#define OV2640_SENSOR_FLH 0x47
#define OV2640_SENSOR_COM19 0x48
#define OV2640_SENSOR_ZOOMS 0x49
#define OV2640_SENSOR_COM22 0x4B
#define OV2640_SENSOR_COM25 0x4E
#define OV2640_SENSOR_BD50 0x4F
#define OV2640_SENSOR_BD60 0x50
#define OV2640_SENSOR_REG5D 0x5D
#define OV2640_SENSOR_REG5E 0x5E
#define OV2640_SENSOR_REG5F 0x5F
#define OV2640_SENSOR_REG60 0x60
#define OV2640_SENSOR_HISTO_LOW 0x61
#define OV2640_SENSOR_HISTO_HIGH 0x62
#define IOCTRL_CAMERA_START_SHOT (22) // start shoot
#define IOCTRL_CAMERA_SET_RESO (23) //set resolution
#define IOCTRL_CAMERA_SET_LIGHT (24) //set light mode
#define IOCTRL_CAMERA_SET_COLOR (25) //set color saturation
#define IOCTRL_CAMERA_SET_BRIGHTNESS (26) //set color brightness
#define IOCTRL_CAMERA_SET_CONTRAST (27) //set contrast
#define IOCTRL_CAMERA_SET_EFFECT (28) //set effect
#define IOCTRL_CAMERA_SET_EXPOSURE (29) //set auto exposure
struct camera_device
{
struct rt_device parent; /**< RT-Thread device struct */
};
typedef struct
{
uint32_t pdata;
uint32_t length;
}_ioctl_shoot_para;
extern rt_uint32_t rt_ov2640_calculate_jpeg_len(rt_uint8_t* pdata,rt_uint32_t maxlength);
extern rt_err_t rt_ov2640_start_shoot(uint32_t pdata, uint32_t length);
#ifdef __cplusplus
}
#endif
#endif

59
Ubiquitous/RT_Thread/drivers/rw007/Kconfig

@ -0,0 +1,59 @@
menuconfig PKG_USING_RW007
bool "rw007: SPI WIFI rw007 driver"
select RT_USING_SPI
select RT_USING_PIN
select RT_USING_LWIP
default n
help
if "PKG_USING_RW007" is opened, "RT_USING_LWIP" will be default selected.
if PKG_USING_RW007
choice
prompt "example driver port"
default RW007_USING_STM32_DRIVERS
config RW007_NOT_USE_EXAMPLE_DRIVERS
bool "not use example driver, porting by myself"
config RW007_USING_STM32_DRIVERS
bool "rw007 for stm32"
# config RW007_USING_IMXRT_DRIVERS
# bool "rw007 for imxrt"
endchoice
config RW007_SPI_MAX_HZ
int "SPI Max Hz"
default 30000000
if !RW007_NOT_USE_EXAMPLE_DRIVERS
if RW007_USING_STM32_DRIVERS || RW007_USING_IMXRT_DRIVERS
config RW007_SPI_BUS_NAME
string "RW007 BUS NAME"
default "spi1"
config RW007_CS_PIN
int "CS pin index"
default 86
endif
config RW007_BOOT0_PIN
int "BOOT0 pin index (same as spi clk pin)"
default 19
config RW007_BOOT1_PIN
int "BOOT1 pin index (same as spi cs pin)"
default 86
config RW007_INT_BUSY_PIN
int "INT/BUSY pin index"
default 87
config RW007_RST_PIN
int "RESET pin index"
default 88
endif
endif

7
Ubiquitous/RT_Thread/drivers/rw007/SConscript

@ -0,0 +1,7 @@
Import('RTT_ROOT')
from building import *
cwd = GetCurrentDir()
objs = SConscript(os.path.join(cwd, 'rw007-source', 'SConscript'))
Return('objs')

52
Ubiquitous/RT_Thread/drivers/rw007/rw007-source/.gitignore

@ -0,0 +1,52 @@
# Prerequisites
*.d
# Object files
*.o
*.ko
*.obj
*.elf
# Linker output
*.ilk
*.map
*.exp
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf

201
Ubiquitous/RT_Thread/drivers/rw007/rw007-source/LICENSE

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but