format codes
This commit is contained in:
parent
f21af8362b
commit
b2b3fa6e27
|
@ -1,22 +1,22 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "app_phy.h"
|
#include "app_phy.h"
|
||||||
|
|
||||||
#define PHY_BASE_ADDR 0x7
|
#define PHY_BASE_ADDR 0x7
|
||||||
|
|
||||||
#define PHY_REG_CONTROL 0x0
|
#define PHY_REG_CONTROL 0x0
|
||||||
#define PHY_REG_STATUS 0x1
|
#define PHY_REG_STATUS 0x1
|
||||||
#define PHY_REG_ANE 0x6
|
#define PHY_REG_ANE 0x6
|
||||||
#define PHY_REG_SPEC_STATUS 0x11
|
#define PHY_REG_SPEC_STATUS 0x11
|
||||||
#define PHY_REG_EXTEND_STATUS 0x1B
|
#define PHY_REG_EXTEND_STATUS 0x1B
|
||||||
|
|
||||||
#define PHY_BIT_CONTROL_RESET 0x8000 /*!< Control reg : reset */
|
#define PHY_BIT_CONTROL_RESET 0x8000 /*!< Control reg : reset */
|
||||||
#define PHY_BIT_CONTROL_ANEN 0x1000 /*!< Control reg : auto-negotiation enable */
|
#define PHY_BIT_CONTROL_ANEN 0x1000 /*!< Control reg : auto-negotiation enable */
|
||||||
#define PHY_BIT_CONTROL_RSAN 0x0200 /*!< Control reg : auto-negotiation restart */
|
#define PHY_BIT_CONTROL_RSAN 0x0200 /*!< Control reg : auto-negotiation restart */
|
||||||
|
|
||||||
#define PHY_BIT_STATUS_ANC 0x0020 /*!< Status reg : auto-negotiation complete */
|
#define PHY_BIT_STATUS_ANC 0x0020 /*!< Status reg : auto-negotiation complete */
|
||||||
#define PHY_BIT_STATUS_LINK 0x0004 /*!< Status reg : link is up */
|
#define PHY_BIT_STATUS_LINK 0x0004 /*!< Status reg : link is up */
|
||||||
|
|
||||||
#define PHY_BIT_ANE_LPAN 0x0001 /*!< ANE reg : link partner can auto-neg */
|
#define PHY_BIT_ANE_LPAN 0x0001 /*!< ANE reg : link partner can auto-neg */
|
||||||
|
|
||||||
#define PHY_BIT_SPEED 0xC000 /*!< specific status reg : speed */
|
#define PHY_BIT_SPEED 0xC000 /*!< specific status reg : speed */
|
||||||
#define PHY_BIT_DUPLEX 0x2000 /*!< specific status reg : duplex */
|
#define PHY_BIT_DUPLEX 0x2000 /*!< specific status reg : duplex */
|
||||||
|
@ -25,24 +25,24 @@
|
||||||
#define PHY_BIT_AUTO_MEDIA_REG_DISABLE 0x0200 /*!< extended status reg : auto media register select disable */
|
#define PHY_BIT_AUTO_MEDIA_REG_DISABLE 0x0200 /*!< extended status reg : auto media register select disable */
|
||||||
|
|
||||||
void phy_Reset() {
|
void phy_Reset() {
|
||||||
ETH_PhyWrite(PHY_BASE_ADDR, PHY_REG_CONTROL, PHY_BIT_CONTROL_RESET);
|
ETH_PhyWrite(PHY_BASE_ADDR, PHY_REG_CONTROL, PHY_BIT_CONTROL_RESET);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
uint32_t ret = ETH_PhyRead(PHY_BASE_ADDR, PHY_REG_CONTROL);
|
uint32_t ret = ETH_PhyRead(PHY_BASE_ADDR, PHY_REG_CONTROL);
|
||||||
if ((ret & PHY_BIT_CONTROL_RESET) == 0) {
|
if ((ret & PHY_BIT_CONTROL_RESET) == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void phy_AutoMediaSelect() {
|
void phy_AutoMediaSelect() {
|
||||||
uint32_t data;
|
uint32_t data;
|
||||||
|
|
||||||
// auto media and auto media register selection
|
// auto media and auto media register selection
|
||||||
data = ETH_PhyRead(PHY_BASE_ADDR, PHY_REG_EXTEND_STATUS);
|
data = ETH_PhyRead(PHY_BASE_ADDR, PHY_REG_EXTEND_STATUS);
|
||||||
data &= ~PHY_BIT_AUTO_MEDIA_DISABLE;
|
data &= ~PHY_BIT_AUTO_MEDIA_DISABLE;
|
||||||
data &= ~PHY_BIT_AUTO_MEDIA_REG_DISABLE;
|
data &= ~PHY_BIT_AUTO_MEDIA_REG_DISABLE;
|
||||||
ETH_PhyWrite(PHY_BASE_ADDR, PHY_REG_EXTEND_STATUS, data);
|
ETH_PhyWrite(PHY_BASE_ADDR, PHY_REG_EXTEND_STATUS, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void phy_AutoNeg()
|
void phy_AutoNeg()
|
||||||
|
@ -65,61 +65,61 @@ void phy_AutoNeg()
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL phy_IsLink() {
|
BOOL phy_IsLink() {
|
||||||
uint32_t ret = ETH_PhyRead(PHY_BASE_ADDR, PHY_REG_STATUS);
|
uint32_t ret = ETH_PhyRead(PHY_BASE_ADDR, PHY_REG_STATUS);
|
||||||
return (ret & PHY_BIT_STATUS_LINK) ? TRUE : FALSE;
|
return (ret & PHY_BIT_STATUS_LINK) ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL phy_PartnerCanAutoNeg() {
|
BOOL phy_PartnerCanAutoNeg() {
|
||||||
uint32_t ret = ETH_PhyRead(PHY_BASE_ADDR, PHY_REG_ANE);
|
uint32_t ret = ETH_PhyRead(PHY_BASE_ADDR, PHY_REG_ANE);
|
||||||
return (ret & PHY_BIT_ANE_LPAN) ? TRUE : FALSE;
|
return (ret & PHY_BIT_ANE_LPAN) ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t phy_GetSpeed() {
|
uint32_t phy_GetSpeed() {
|
||||||
uint32_t ret = ETH_PhyRead(PHY_BASE_ADDR, PHY_REG_SPEC_STATUS);
|
uint32_t ret = ETH_PhyRead(PHY_BASE_ADDR, PHY_REG_SPEC_STATUS);
|
||||||
return ((ret & PHY_BIT_SPEED) >> 14);
|
return ((ret & PHY_BIT_SPEED) >> 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t phy_GetDuplex() {
|
uint32_t phy_GetDuplex() {
|
||||||
uint32_t ret = ETH_PhyRead(PHY_BASE_ADDR, PHY_REG_SPEC_STATUS);
|
uint32_t ret = ETH_PhyRead(PHY_BASE_ADDR, PHY_REG_SPEC_STATUS);
|
||||||
return ((ret & PHY_BIT_DUPLEX) >> 13);
|
return ((ret & PHY_BIT_DUPLEX) >> 13);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL phy_Init() {
|
BOOL phy_Init() {
|
||||||
phy_AutoMediaSelect();
|
phy_AutoMediaSelect();
|
||||||
phy_AutoNeg();
|
phy_AutoNeg();
|
||||||
|
|
||||||
if (!phy_PartnerCanAutoNeg()) {
|
if (!phy_PartnerCanAutoNeg()) {
|
||||||
printf("Warning:: PHY's partner can't do auto-negotiation\n");
|
printf("Warning:: PHY's partner can't do auto-negotiation\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!phy_IsLink()) {
|
if (!phy_IsLink()) {
|
||||||
printf("link is down\n");
|
printf("link is down\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
uint32_t speed = phy_GetSpeed();
|
uint32_t speed = phy_GetSpeed();
|
||||||
if (speed == PHY_SPEED_10) {
|
if (speed == PHY_SPEED_10) {
|
||||||
speed = 10;
|
speed = 10;
|
||||||
} else if (speed == PHY_SPEED_100) {
|
} else if (speed == PHY_SPEED_100) {
|
||||||
speed = 100;
|
speed = 100;
|
||||||
} else if (speed == PHY_SPEED_1000) {
|
} else if (speed == PHY_SPEED_1000) {
|
||||||
speed = 1000;
|
speed = 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("PHY runs in %dM speed %s duplex\n",
|
printf("PHY runs in %dM speed %s duplex\n",
|
||||||
speed, (phy_GetDuplex() == PHY_DUPLEX_HALF) ? "half" : "full");
|
speed, (phy_GetDuplex() == PHY_DUPLEX_HALF) ? "half" : "full");
|
||||||
}
|
}
|
||||||
|
|
||||||
// After auto-negcioation, Mawell PHY need some
|
// After auto-negcioation, Mawell PHY need some
|
||||||
// time to initial itself.
|
// time to initial itself.
|
||||||
// So we have to delay some time since different
|
// So we have to delay some time since different
|
||||||
// connection way, such as direct wire, hub, switch.
|
// connection way, such as direct wire, hub, switch.
|
||||||
// If not to delay, the first several sent frame
|
// If not to delay, the first several sent frame
|
||||||
// may be lost.
|
// may be lost.
|
||||||
// Please according to actual environment to tune
|
// Please according to actual environment to tune
|
||||||
// this delay.
|
// this delay.
|
||||||
udelay(200000);
|
udelay(200000);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,12 +7,12 @@
|
||||||
|
|
||||||
#include "cmem7_includes.h"
|
#include "cmem7_includes.h"
|
||||||
|
|
||||||
#define PHY_SPEED_10 0x0 /*!< SPEED : 10M */
|
#define PHY_SPEED_10 0x0 /*!< SPEED : 10M */
|
||||||
#define PHY_SPEED_100 0x1 /*!< SPEED : 100M */
|
#define PHY_SPEED_100 0x1 /*!< SPEED : 100M */
|
||||||
#define PHY_SPEED_1000 0x2 /*!< SPEED : 1000M */
|
#define PHY_SPEED_1000 0x2 /*!< SPEED : 1000M */
|
||||||
|
|
||||||
#define PHY_DUPLEX_HALF 0x0 /*!< DUPLEX : half */
|
#define PHY_DUPLEX_HALF 0x0 /*!< DUPLEX : half */
|
||||||
#define PHY_DUPLEX_FULL 0x1 /*!< DUPLEX : full */
|
#define PHY_DUPLEX_FULL 0x1 /*!< DUPLEX : full */
|
||||||
|
|
||||||
void phy_Reset(void);
|
void phy_Reset(void);
|
||||||
void phy_AutoNeg(void);
|
void phy_AutoNeg(void);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : emac.c
|
* File : emac.c
|
||||||
* This file is part of RT-Thread RTOS
|
* This file is part of RT-Thread RTOS
|
||||||
* COPYRIGHT (C) 2006-2014, RT-Thread Develop Team
|
* COPYRIGHT (C) 2006-2021, RT-Thread Develop Team
|
||||||
*
|
*
|
||||||
* The license and distribution terms for this file may be
|
* The license and distribution terms for this file may be
|
||||||
* found in the file LICENSE in this distribution or at
|
* found in the file LICENSE in this distribution or at
|
||||||
|
@ -38,7 +38,7 @@ struct rt_cme_eth
|
||||||
struct eth_device parent;
|
struct eth_device parent;
|
||||||
|
|
||||||
/* interface address info. */
|
/* interface address info. */
|
||||||
rt_uint8_t dev_addr[MAX_ADDR_LEN]; /* hw address */
|
rt_uint8_t dev_addr[MAX_ADDR_LEN]; /* hw address */
|
||||||
|
|
||||||
uint32_t ETH_Speed;
|
uint32_t ETH_Speed;
|
||||||
uint32_t ETH_Mode;
|
uint32_t ETH_Mode;
|
||||||
|
@ -95,8 +95,8 @@ uint32_t txTotalMemory = 0x2000;
|
||||||
BOOL isRxNoBuf = FALSE;
|
BOOL isRxNoBuf = FALSE;
|
||||||
|
|
||||||
#define ETH_MAX_PACKET_SIZE 1520 /* ETH_HEADER + ETH_EXTRA + MAX_ETH_PAYLOAD + ETH_CRC */
|
#define ETH_MAX_PACKET_SIZE 1520 /* ETH_HEADER + ETH_EXTRA + MAX_ETH_PAYLOAD + ETH_CRC */
|
||||||
#define ETH_RXBUFNB 4
|
#define ETH_RXBUFNB 4
|
||||||
#define ETH_TXBUFNB 2
|
#define ETH_TXBUFNB 2
|
||||||
|
|
||||||
struct eth_rx_buffer
|
struct eth_rx_buffer
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,23 +32,23 @@ static struct rt_serial_device serial2;
|
||||||
static rt_err_t CME_M7_configure(struct rt_serial_device *serial, struct serial_configure *cfg)
|
static rt_err_t CME_M7_configure(struct rt_serial_device *serial, struct serial_configure *cfg)
|
||||||
{
|
{
|
||||||
struct CME_M7_uart* uart;
|
struct CME_M7_uart* uart;
|
||||||
UART_InitTypeDef init;
|
UART_InitTypeDef init;
|
||||||
|
|
||||||
RT_ASSERT(serial != RT_NULL);
|
RT_ASSERT(serial != RT_NULL);
|
||||||
RT_ASSERT(cfg != RT_NULL);
|
RT_ASSERT(cfg != RT_NULL);
|
||||||
|
|
||||||
uart = (struct CME_M7_uart *)serial->parent.user_data;
|
uart = (struct CME_M7_uart *)serial->parent.user_data;
|
||||||
|
|
||||||
init.UART_BaudRate = cfg->baud_rate;
|
init.UART_BaudRate = cfg->baud_rate;
|
||||||
init.UART_StopBits = UART_StopBits_1;
|
init.UART_StopBits = UART_StopBits_1;
|
||||||
init.UART_Parity = UART_Parity_None;
|
init.UART_Parity = UART_Parity_None;
|
||||||
init.UART_LoopBack = FALSE;
|
init.UART_LoopBack = FALSE;
|
||||||
init.UART_RxEn = TRUE;
|
init.UART_RxEn = TRUE;
|
||||||
init.UART_CtsEn = FALSE;
|
init.UART_CtsEn = FALSE;
|
||||||
|
|
||||||
UART_Init(uart->uart_device, &init);
|
UART_Init(uart->uart_device, &init);
|
||||||
uart->uart_device->RX_RESET = 1;
|
uart->uart_device->RX_RESET = 1;
|
||||||
UART_Enable(uart->uart_device, TRUE);
|
UART_Enable(uart->uart_device, TRUE);
|
||||||
uart->uart_device->RX_RESET = 0;
|
uart->uart_device->RX_RESET = 0;
|
||||||
|
|
||||||
return RT_EOK;
|
return RT_EOK;
|
||||||
|
@ -67,24 +67,24 @@ static rt_err_t CME_M7_control(struct rt_serial_device *serial, int cmd, void *a
|
||||||
case RT_DEVICE_CTRL_CLR_INT:
|
case RT_DEVICE_CTRL_CLR_INT:
|
||||||
/* disable rx irq */
|
/* disable rx irq */
|
||||||
NVIC_InitStructure.NVIC_IRQChannel = uart->irq;
|
NVIC_InitStructure.NVIC_IRQChannel = uart->irq;
|
||||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
|
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
|
||||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
|
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
|
||||||
NVIC_InitStructure.NVIC_IRQChannelCmd = FALSE;
|
NVIC_InitStructure.NVIC_IRQChannelCmd = FALSE;
|
||||||
NVIC_Init(&NVIC_InitStructure);
|
NVIC_Init(&NVIC_InitStructure);
|
||||||
|
|
||||||
UART_EnableInt(uart->uart_device, UART_Int_RxNotEmpty, FALSE);
|
UART_EnableInt(uart->uart_device, UART_Int_RxNotEmpty, FALSE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RT_DEVICE_CTRL_SET_INT:
|
case RT_DEVICE_CTRL_SET_INT:
|
||||||
/* enable rx irq */
|
/* enable rx irq */
|
||||||
NVIC_InitStructure.NVIC_IRQChannel = uart->irq;
|
NVIC_InitStructure.NVIC_IRQChannel = uart->irq;
|
||||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
|
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
|
||||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
|
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
|
||||||
NVIC_InitStructure.NVIC_IRQChannelCmd = TRUE;
|
NVIC_InitStructure.NVIC_IRQChannelCmd = TRUE;
|
||||||
NVIC_Init(&NVIC_InitStructure);
|
NVIC_Init(&NVIC_InitStructure);
|
||||||
|
|
||||||
UART_ClearInt(uart->uart_device, UART_Int_RxNotEmpty);
|
UART_ClearInt(uart->uart_device, UART_Int_RxNotEmpty);
|
||||||
UART_EnableInt(uart->uart_device, UART_Int_RxNotEmpty, TRUE);
|
UART_EnableInt(uart->uart_device, UART_Int_RxNotEmpty, TRUE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,8 +132,8 @@ static const struct rt_uart_ops CME_M7_uart_ops =
|
||||||
|
|
||||||
int rt_hw_uart_init(void)
|
int rt_hw_uart_init(void)
|
||||||
{
|
{
|
||||||
struct CME_M7_uart* uart;
|
struct CME_M7_uart* uart;
|
||||||
struct rt_serial_device *serial;
|
struct rt_serial_device *serial;
|
||||||
struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
|
struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
|
||||||
|
|
||||||
#ifdef RT_USING_UART0
|
#ifdef RT_USING_UART0
|
||||||
|
@ -143,7 +143,7 @@ int rt_hw_uart_init(void)
|
||||||
serial->ops = &CME_M7_uart_ops;
|
serial->ops = &CME_M7_uart_ops;
|
||||||
serial->config = config;
|
serial->config = config;
|
||||||
|
|
||||||
/* register UART device */
|
/* register UART device */
|
||||||
rt_hw_serial_register(serial,
|
rt_hw_serial_register(serial,
|
||||||
"uart0",
|
"uart0",
|
||||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
|
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
|
||||||
|
@ -157,14 +157,14 @@ int rt_hw_uart_init(void)
|
||||||
serial->ops = &CME_M7_uart_ops;
|
serial->ops = &CME_M7_uart_ops;
|
||||||
serial->config = config;
|
serial->config = config;
|
||||||
|
|
||||||
/* register UART device */
|
/* register UART device */
|
||||||
rt_hw_serial_register(serial,
|
rt_hw_serial_register(serial,
|
||||||
"uart2",
|
"uart2",
|
||||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
|
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
|
||||||
uart);
|
uart);
|
||||||
#endif /* RT_USING_UART2 */
|
#endif /* RT_USING_UART2 */
|
||||||
|
|
||||||
return RT_EOK;
|
return RT_EOK;
|
||||||
}
|
}
|
||||||
INIT_BOARD_EXPORT(rt_hw_uart_init);
|
INIT_BOARD_EXPORT(rt_hw_uart_init);
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
#include <rtgui/widgets/box.h>
|
#include <rtgui/widgets/box.h>
|
||||||
#include <rtgui/image.h>
|
#include <rtgui/image.h>
|
||||||
|
|
||||||
#if defined(RTGUI_USING_DFS_FILERW)
|
#if defined(RTGUI_USING_DFS_FILERW)
|
||||||
#include <dfs_posix.h>
|
#include <dfs_posix.h>
|
||||||
#define PATH_SEPARATOR '/'
|
#define PATH_SEPARATOR '/'
|
||||||
#endif
|
#endif
|
||||||
|
@ -77,8 +77,8 @@ struct photo_event
|
||||||
{
|
{
|
||||||
struct rtgui_event_win win;
|
struct rtgui_event_win win;
|
||||||
rt_uint32_t cmd;
|
rt_uint32_t cmd;
|
||||||
rt_uint8_t* path;
|
rt_uint8_t* path;
|
||||||
rt_uint8_t* format;
|
rt_uint8_t* format;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Private defines -----------------------------------------------------------*/
|
/* Private defines -----------------------------------------------------------*/
|
||||||
|
@ -95,10 +95,10 @@ volatile rt_uint32_t rt_system_status = 0;
|
||||||
#if defined(RT_USING_RTGUI)
|
#if defined(RT_USING_RTGUI)
|
||||||
static rt_bool_t pic_view_event_handler(rtgui_object_t *object, rtgui_event_t *event)
|
static rt_bool_t pic_view_event_handler(rtgui_object_t *object, rtgui_event_t *event)
|
||||||
{
|
{
|
||||||
rt_bool_t result;
|
rt_bool_t result;
|
||||||
rt_bool_t load = RT_FALSE;
|
rt_bool_t load = RT_FALSE;
|
||||||
|
|
||||||
result = rtgui_container_event_handler(object, event);
|
result = rtgui_container_event_handler(object, event);
|
||||||
|
|
||||||
switch(event->type)
|
switch(event->type)
|
||||||
{
|
{
|
||||||
|
@ -108,27 +108,27 @@ static rt_bool_t pic_view_event_handler(rtgui_object_t *object, rtgui_event_t *e
|
||||||
|
|
||||||
case RTGUI_EVENT_MOUSE_BUTTON:
|
case RTGUI_EVENT_MOUSE_BUTTON:
|
||||||
{
|
{
|
||||||
struct rtgui_event_mouse *mouse = (struct rtgui_event_mouse *)event;
|
struct rtgui_event_mouse *mouse = (struct rtgui_event_mouse *)event;
|
||||||
|
|
||||||
if (mouse->button == RTGUI_MOUSE_BUTTON_LEFT | RTGUI_MOUSE_BUTTON_UP)
|
if (mouse->button == RTGUI_MOUSE_BUTTON_LEFT | RTGUI_MOUSE_BUTTON_UP)
|
||||||
{
|
{
|
||||||
rt_kprintf("APP: left click (%x)\n", mouse->button);
|
rt_kprintf("APP: left click (%x)\n", mouse->button);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (load)
|
if (load)
|
||||||
{
|
{
|
||||||
struct rtgui_dc* dc;
|
struct rtgui_dc* dc;
|
||||||
rtgui_rect_t rect;
|
rtgui_rect_t rect;
|
||||||
rtgui_image_t* image;
|
rtgui_image_t* image;
|
||||||
|
|
||||||
image = rtgui_image_create_from_file("jpg", "/test9.jpg", RT_FALSE);
|
image = rtgui_image_create_from_file("jpg", "/test9.jpg", RT_FALSE);
|
||||||
// image = rtgui_image_create_from_file("bmp", "/test_565.bmp", RT_FALSE);
|
// image = rtgui_image_create_from_file("bmp", "/test_565.bmp", RT_FALSE);
|
||||||
|
|
||||||
dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(object));
|
dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(object));
|
||||||
if (dc == RT_NULL)
|
if (dc == RT_NULL)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -138,9 +138,9 @@ static rt_bool_t pic_view_event_handler(rtgui_object_t *object, rtgui_event_t *e
|
||||||
rect.x1 +=10;
|
rect.x1 +=10;
|
||||||
rect.y1 +=10;
|
rect.y1 +=10;
|
||||||
|
|
||||||
if (image != RT_NULL)
|
if (image != RT_NULL)
|
||||||
{
|
{
|
||||||
rtgui_image_blit(image, dc, &rect);
|
rtgui_image_blit(image, dc, &rect);
|
||||||
rtgui_image_destroy(image);
|
rtgui_image_destroy(image);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -148,10 +148,10 @@ static rt_bool_t pic_view_event_handler(rtgui_object_t *object, rtgui_event_t *e
|
||||||
rt_kprintf("APP err: no image found!\n");
|
rt_kprintf("APP err: no image found!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
rtgui_dc_end_drawing(dc, RT_TRUE);
|
rtgui_dc_end_drawing(dc, RT_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void app_main(void *parameter)
|
static void app_main(void *parameter)
|
||||||
|
@ -169,21 +169,21 @@ static void app_main(void *parameter)
|
||||||
lcd->control(lcd, RTGRAPHIC_CTRL_GET_INFO, (void *)&lcd_info);
|
lcd->control(lcd, RTGRAPHIC_CTRL_GET_INFO, (void *)&lcd_info);
|
||||||
rt_kprintf("LCD size: %dX%d\n", lcd_info.width, lcd_info.height);
|
rt_kprintf("LCD size: %dX%d\n", lcd_info.width, lcd_info.height);
|
||||||
|
|
||||||
/* create application */
|
/* create application */
|
||||||
struct rtgui_app *app;
|
struct rtgui_app *app;
|
||||||
app = rtgui_app_create("gui_app");
|
app = rtgui_app_create("gui_app");
|
||||||
if (app == RT_NULL)
|
if (app == RT_NULL)
|
||||||
{
|
{
|
||||||
rt_kprintf("Create application \"gui_app\" failed!\n");
|
rt_kprintf("Create application \"gui_app\" failed!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct rtgui_rect rect1, rect2, rect3;
|
struct rtgui_rect rect1, rect2, rect3;
|
||||||
struct rtgui_win *win_info, *win_main, *win_hello;
|
struct rtgui_win *win_info, *win_main, *win_hello;
|
||||||
struct rtgui_container *container;
|
struct rtgui_container *container;
|
||||||
struct rtgui_label* label;
|
struct rtgui_label* label;
|
||||||
|
|
||||||
rtgui_graphic_driver_get_rect(rtgui_graphic_driver_get_default(), &rect1);
|
rtgui_graphic_driver_get_rect(rtgui_graphic_driver_get_default(), &rect1);
|
||||||
rect2.x1 = rect1.x1;
|
rect2.x1 = rect1.x1;
|
||||||
rect2.y1 = 25;
|
rect2.y1 = 25;
|
||||||
rect2.x2 = rect1.x2;
|
rect2.x2 = rect1.x2;
|
||||||
|
@ -191,119 +191,119 @@ static void app_main(void *parameter)
|
||||||
rect1.y2 = 25;
|
rect1.y2 = 25;
|
||||||
|
|
||||||
/* create info window */
|
/* create info window */
|
||||||
win_info = rtgui_win_create(RT_NULL, "info",
|
win_info = rtgui_win_create(RT_NULL, "info",
|
||||||
&rect1,
|
&rect1,
|
||||||
RTGUI_WIN_STYLE_NO_BORDER | RTGUI_WIN_STYLE_NO_TITLE);
|
RTGUI_WIN_STYLE_NO_BORDER | RTGUI_WIN_STYLE_NO_TITLE);
|
||||||
if (win_info == RT_NULL)
|
if (win_info == RT_NULL)
|
||||||
{
|
{
|
||||||
rt_kprintf("Create window \"info\" failed!\n");
|
rt_kprintf("Create window \"info\" failed!\n");
|
||||||
rtgui_app_destroy(app);
|
rtgui_app_destroy(app);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create container in info window */
|
/* create container in info window */
|
||||||
container = rtgui_container_create();
|
container = rtgui_container_create();
|
||||||
if (container == RT_NULL)
|
if (container == RT_NULL)
|
||||||
{
|
{
|
||||||
rt_kprintf("Create container failed!\n");
|
rt_kprintf("Create container failed!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rtgui_widget_set_rect(RTGUI_WIDGET(container), &rect1);
|
rtgui_widget_set_rect(RTGUI_WIDGET(container), &rect1);
|
||||||
rtgui_container_add_child(RTGUI_CONTAINER(win_info), RTGUI_WIDGET(container));
|
rtgui_container_add_child(RTGUI_CONTAINER(win_info), RTGUI_WIDGET(container));
|
||||||
|
|
||||||
/* create lable in info window */
|
/* create lable in info window */
|
||||||
label = rtgui_label_create("RT-Thread & RTGUI");
|
label = rtgui_label_create("RT-Thread & RTGUI");
|
||||||
if (label == RT_NULL)
|
if (label == RT_NULL)
|
||||||
{
|
{
|
||||||
rt_kprintf("Create lable failed!\n");
|
rt_kprintf("Create lable failed!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(label)) = RTGUI_ALIGN_LEFT;
|
RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(label)) = RTGUI_ALIGN_LEFT;
|
||||||
RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(label)) = red;
|
RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(label)) = red;
|
||||||
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(label)) = white;
|
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(label)) = white;
|
||||||
|
|
||||||
rect3.x1 = rect1.x1 + 5;
|
rect3.x1 = rect1.x1 + 5;
|
||||||
rect3.y1 = rect1.y1 + 5;
|
rect3.y1 = rect1.y1 + 5;
|
||||||
rect3.x2 = rect1.x2 - 5;
|
rect3.x2 = rect1.x2 - 5;
|
||||||
rect3.y2 = rect1.y2 - 5;
|
rect3.y2 = rect1.y2 - 5;
|
||||||
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect3);
|
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect3);
|
||||||
rtgui_container_add_child(container, RTGUI_WIDGET(label));
|
rtgui_container_add_child(container, RTGUI_WIDGET(label));
|
||||||
|
|
||||||
|
|
||||||
/* create main window */
|
/* create main window */
|
||||||
win_main = rtgui_win_create(RT_NULL, "main",
|
win_main = rtgui_win_create(RT_NULL, "main",
|
||||||
&rect2,
|
&rect2,
|
||||||
RTGUI_WIN_STYLE_NO_BORDER | RTGUI_WIN_STYLE_NO_TITLE);
|
RTGUI_WIN_STYLE_NO_BORDER | RTGUI_WIN_STYLE_NO_TITLE);
|
||||||
if (win_main == RT_NULL)
|
if (win_main == RT_NULL)
|
||||||
{
|
{
|
||||||
rt_kprintf("Create window \"main\" failed!\n");
|
rt_kprintf("Create window \"main\" failed!\n");
|
||||||
rtgui_app_destroy(app);
|
rtgui_app_destroy(app);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create container in main window */
|
/* create container in main window */
|
||||||
container = rtgui_container_create();
|
container = rtgui_container_create();
|
||||||
if (container == RT_NULL)
|
if (container == RT_NULL)
|
||||||
{
|
{
|
||||||
rt_kprintf("Create container failed!\n");
|
rt_kprintf("Create container failed!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rtgui_widget_set_rect(RTGUI_WIDGET(container), &rect2);
|
rtgui_widget_set_rect(RTGUI_WIDGET(container), &rect2);
|
||||||
rtgui_object_set_event_handler(RTGUI_OBJECT(container), pic_view_event_handler);
|
rtgui_object_set_event_handler(RTGUI_OBJECT(container), pic_view_event_handler);
|
||||||
rtgui_container_add_child(RTGUI_CONTAINER(win_main), RTGUI_WIDGET(container));
|
rtgui_container_add_child(RTGUI_CONTAINER(win_main), RTGUI_WIDGET(container));
|
||||||
|
|
||||||
/* create lable in main window */
|
/* create lable in main window */
|
||||||
label = rtgui_label_create("EFM32GG_DK3750 Kit");
|
label = rtgui_label_create("EFM32GG_DK3750 Kit");
|
||||||
if (label == RT_NULL)
|
if (label == RT_NULL)
|
||||||
{
|
{
|
||||||
rt_kprintf("Create lable failed!\n");
|
rt_kprintf("Create lable failed!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(label)) = RTGUI_ALIGN_LEFT;
|
RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(label)) = RTGUI_ALIGN_LEFT;
|
||||||
RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(label)) = white;
|
RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(label)) = white;
|
||||||
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(label)) = blue;
|
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(label)) = blue;
|
||||||
|
|
||||||
rect3.x1 = rect2.x1 + 5;
|
rect3.x1 = rect2.x1 + 5;
|
||||||
rect3.y1 = rect2.y1 + 5;
|
rect3.y1 = rect2.y1 + 5;
|
||||||
rect3.x2 = rect2.x2 - 5;
|
rect3.x2 = rect2.x2 - 5;
|
||||||
rect3.y2 = rect2.y1 + 20;
|
rect3.y2 = rect2.y1 + 20;
|
||||||
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect3);
|
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect3);
|
||||||
rtgui_container_add_child(container, RTGUI_WIDGET(label));
|
rtgui_container_add_child(container, RTGUI_WIDGET(label));
|
||||||
|
|
||||||
|
|
||||||
/* create hello window */
|
/* create hello window */
|
||||||
rect3.x1 = 80;
|
rect3.x1 = 80;
|
||||||
rect3.y1 = 50;
|
rect3.y1 = 50;
|
||||||
rect3.x2 = 320 - 80;
|
rect3.x2 = 320 - 80;
|
||||||
rect3.y2 = 240 - 50;
|
rect3.y2 = 240 - 50;
|
||||||
win_hello = rtgui_win_create(RT_NULL, "hello",
|
win_hello = rtgui_win_create(RT_NULL, "hello",
|
||||||
&rect3,
|
&rect3,
|
||||||
RTGUI_WIN_STYLE_DEFAULT);
|
RTGUI_WIN_STYLE_DEFAULT);
|
||||||
if (win_hello == RT_NULL)
|
if (win_hello == RT_NULL)
|
||||||
{
|
{
|
||||||
rt_kprintf("Create window \"hello\" failed!\n");
|
rt_kprintf("Create window \"hello\" failed!\n");
|
||||||
rtgui_app_destroy(app);
|
rtgui_app_destroy(app);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create a box */
|
/* create a box */
|
||||||
rtgui_box_t *box = rtgui_box_create(RTGUI_VERTICAL, RT_NULL);
|
rtgui_box_t *box = rtgui_box_create(RTGUI_VERTICAL, RT_NULL);
|
||||||
if(box == RT_NULL)
|
if(box == RT_NULL)
|
||||||
{
|
{
|
||||||
rt_kprintf("Create box failed!\n");
|
rt_kprintf("Create box failed!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// rtgui_win_set_box(win_hello, box);
|
// rtgui_win_set_box(win_hello, box);
|
||||||
|
|
||||||
label = rtgui_label_create("šţÂŢ,íďĹÖ!");
|
label = rtgui_label_create("哈罗,盹胖!");
|
||||||
if(label == RT_NULL)
|
if(label == RT_NULL)
|
||||||
{
|
{
|
||||||
rt_kprintf("Create lable failed!\n");
|
rt_kprintf("Create lable failed!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(label)) = white;
|
RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(label)) = white;
|
||||||
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(label)) = black;
|
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(label)) = black;
|
||||||
RTGUI_WIDGET(label)->align = RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL;
|
RTGUI_WIDGET(label)->align = RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL;
|
||||||
rtgui_widget_set_miniwidth(RTGUI_WIDGET(label),130);
|
rtgui_widget_set_miniwidth(RTGUI_WIDGET(label),130);
|
||||||
|
@ -322,18 +322,18 @@ static void app_main(void *parameter)
|
||||||
|
|
||||||
static rt_bool_t photo_view_event_handler(rtgui_object_t *object, rtgui_event_t *event)
|
static rt_bool_t photo_view_event_handler(rtgui_object_t *object, rtgui_event_t *event)
|
||||||
{
|
{
|
||||||
rt_bool_t result = RT_FALSE;
|
rt_bool_t result = RT_FALSE;
|
||||||
struct photo_event *photo_event = (struct photo_event *)event;
|
struct photo_event *photo_event = (struct photo_event *)event;
|
||||||
|
|
||||||
result = rtgui_container_event_handler(object, event);
|
result = rtgui_container_event_handler(object, event);
|
||||||
rt_kprintf("container event %x\n", event->type);
|
rt_kprintf("container event %x\n", event->type);
|
||||||
|
|
||||||
struct rtgui_event_win* wevent = (struct rtgui_event_win*)event;
|
struct rtgui_event_win* wevent = (struct rtgui_event_win*)event;
|
||||||
rt_kprintf("wevent->wid %x\n", wevent->wid);
|
rt_kprintf("wevent->wid %x\n", wevent->wid);
|
||||||
|
|
||||||
if ((event->type == RTGUI_EVENT_COMMAND) && \
|
if ((event->type == RTGUI_EVENT_COMMAND) && \
|
||||||
(photo_event->cmd == APP_CMD_PHOTO_FRAME))
|
(photo_event->cmd == APP_CMD_PHOTO_FRAME))
|
||||||
{
|
{
|
||||||
rtgui_rect_t rect;
|
rtgui_rect_t rect;
|
||||||
rtgui_image_t* image;
|
rtgui_image_t* image;
|
||||||
struct rtgui_dc* dc;
|
struct rtgui_dc* dc;
|
||||||
|
@ -361,25 +361,25 @@ static rt_bool_t photo_view_event_handler(rtgui_object_t *object, rtgui_event_t
|
||||||
return RT_TRUE;
|
return RT_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static rt_bool_t photo_lable_event_handler(rtgui_object_t *object, rtgui_event_t *event)
|
static rt_bool_t photo_lable_event_handler(rtgui_object_t *object, rtgui_event_t *event)
|
||||||
{
|
{
|
||||||
rt_bool_t result = RT_FALSE;
|
rt_bool_t result = RT_FALSE;
|
||||||
|
|
||||||
result = rtgui_label_event_handler(object, event);
|
result = rtgui_label_event_handler(object, event);
|
||||||
rt_kprintf("lable event %x\n", event->type);
|
rt_kprintf("lable event %x\n", event->type);
|
||||||
|
|
||||||
if (event->type == RTGUI_EVENT_COMMAND)
|
if (event->type == RTGUI_EVENT_COMMAND)
|
||||||
{
|
{
|
||||||
struct photo_event *photo = (struct photo_event *)event;
|
struct photo_event *photo = (struct photo_event *)event;
|
||||||
|
|
||||||
rtgui_label_set_text((rtgui_label_t *)object, photo->path);
|
rtgui_label_set_text((rtgui_label_t *)object, photo->path);
|
||||||
rt_kprintf("path %s\n", photo->path);
|
rt_kprintf("path %s\n", photo->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void app_photo(void *parameter)
|
static void app_photo(void *parameter)
|
||||||
|
@ -399,64 +399,64 @@ static void app_photo(void *parameter)
|
||||||
lcd->control(lcd, RTGRAPHIC_CTRL_GET_INFO, (void *)&lcd_info);
|
lcd->control(lcd, RTGRAPHIC_CTRL_GET_INFO, (void *)&lcd_info);
|
||||||
rt_kprintf("LCD size: %dX%d\n", lcd_info.width, lcd_info.height);
|
rt_kprintf("LCD size: %dX%d\n", lcd_info.width, lcd_info.height);
|
||||||
|
|
||||||
/* create application */
|
/* create application */
|
||||||
struct rtgui_app *app;
|
struct rtgui_app *app;
|
||||||
app = rtgui_app_create("pho_app");
|
app = rtgui_app_create("pho_app");
|
||||||
if (app == RT_NULL)
|
if (app == RT_NULL)
|
||||||
{
|
{
|
||||||
rt_kprintf("Create application \"pho_app\" failed!\n");
|
rt_kprintf("Create application \"pho_app\" failed!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct rtgui_rect rect1, rect2;
|
struct rtgui_rect rect1, rect2;
|
||||||
struct rtgui_win *window;
|
struct rtgui_win *window;
|
||||||
struct rtgui_container *container;
|
struct rtgui_container *container;
|
||||||
struct rtgui_label* label;
|
struct rtgui_label* label;
|
||||||
|
|
||||||
rtgui_graphic_driver_get_rect(rtgui_graphic_driver_get_default(), &rect1);
|
rtgui_graphic_driver_get_rect(rtgui_graphic_driver_get_default(), &rect1);
|
||||||
|
|
||||||
/* create window */
|
/* create window */
|
||||||
window = rtgui_win_create(RT_NULL, "photo",
|
window = rtgui_win_create(RT_NULL, "photo",
|
||||||
&rect1,
|
&rect1,
|
||||||
RTGUI_WIN_STYLE_NO_BORDER | RTGUI_WIN_STYLE_NO_TITLE);
|
RTGUI_WIN_STYLE_NO_BORDER | RTGUI_WIN_STYLE_NO_TITLE);
|
||||||
if (window == RT_NULL)
|
if (window == RT_NULL)
|
||||||
{
|
{
|
||||||
rt_kprintf("Create window \"photo\" failed!\n");
|
rt_kprintf("Create window \"photo\" failed!\n");
|
||||||
rtgui_app_destroy(app);
|
rtgui_app_destroy(app);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event->win.wid = window;
|
event->win.wid = window;
|
||||||
|
|
||||||
/* create container */
|
/* create container */
|
||||||
container = rtgui_container_create();
|
container = rtgui_container_create();
|
||||||
if (container == RT_NULL)
|
if (container == RT_NULL)
|
||||||
{
|
{
|
||||||
rt_kprintf("Create container failed!\n");
|
rt_kprintf("Create container failed!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rtgui_widget_set_rect(RTGUI_WIDGET(container), &rect1);
|
rtgui_widget_set_rect(RTGUI_WIDGET(container), &rect1);
|
||||||
rtgui_object_set_event_handler(RTGUI_OBJECT(container), photo_view_event_handler);
|
rtgui_object_set_event_handler(RTGUI_OBJECT(container), photo_view_event_handler);
|
||||||
rtgui_container_add_child(RTGUI_CONTAINER(window), RTGUI_WIDGET(container));
|
rtgui_container_add_child(RTGUI_CONTAINER(window), RTGUI_WIDGET(container));
|
||||||
|
|
||||||
/* create lable in info window */
|
/* create lable in info window */
|
||||||
label = rtgui_label_create("Photo Frame Demo");
|
label = rtgui_label_create("Photo Frame Demo");
|
||||||
if (label == RT_NULL)
|
if (label == RT_NULL)
|
||||||
{
|
{
|
||||||
rt_kprintf("Create lable failed!\n");
|
rt_kprintf("Create lable failed!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(label)) = RTGUI_ALIGN_LEFT;
|
RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(label)) = RTGUI_ALIGN_LEFT;
|
||||||
RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(label)) = white;
|
RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(label)) = white;
|
||||||
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(label)) = blue;
|
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(label)) = blue;
|
||||||
|
|
||||||
rect2.x1 = rect1.x1;
|
rect2.x1 = rect1.x1;
|
||||||
rect2.y1 = rect1.y1;
|
rect2.y1 = rect1.y1;
|
||||||
rect2.x2 = rect1.x2;
|
rect2.x2 = rect1.x2;
|
||||||
rect2.y2 = 15;
|
rect2.y2 = 15;
|
||||||
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect2);
|
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect2);
|
||||||
rtgui_object_set_event_handler(RTGUI_OBJECT(label), photo_lable_event_handler);
|
rtgui_object_set_event_handler(RTGUI_OBJECT(label), photo_lable_event_handler);
|
||||||
rtgui_container_add_child(container, RTGUI_WIDGET(label));
|
rtgui_container_add_child(container, RTGUI_WIDGET(label));
|
||||||
|
|
||||||
rtgui_win_show(window, RT_FALSE);
|
rtgui_win_show(window, RT_FALSE);
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include <rtdevice.h>
|
#include <rtdevice.h>
|
||||||
|
|
||||||
#define LED3_PIN BSP_IO_PORT_01_PIN_06
|
#define LED3_PIN BSP_IO_PORT_01_PIN_06
|
||||||
#define USER_INPUT "P105"
|
#define USER_INPUT "P105"
|
||||||
|
|
||||||
void hal_entry(void)
|
void hal_entry(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2020, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2020, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue