From 89d5a55071ed5888e8bd54d504f35b9de9f378e9 Mon Sep 17 00:00:00 2001 From: kyz Date: Thu, 23 May 2024 11:32:06 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E6=94=B9=E4=BB=A5=E5=A4=AA=E7=BD=91RMI?= =?utf8?q?I=E6=8E=A5=E5=8F=A3GPIO=E5=BC=95=E8=84=9A=E9=85=8D=E7=BD=AE?= =?utf8?q?=E5=88=B0=E9=AB=98=E9=80=9F=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- LWIP/Target/ethernetif.c | 6 +++--- user/ht1622.c | 15 +++++++++++++++ user/user_eth.c | 17 +++++++++++++++++ 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/LWIP/Target/ethernetif.c b/LWIP/Target/ethernetif.c index 3afdc95..dbb4d99 100644 --- a/LWIP/Target/ethernetif.c +++ b/LWIP/Target/ethernetif.c @@ -625,21 +625,21 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* ethHandle) GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF11_ETH; HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_7; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF11_ETH; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF11_ETH; HAL_GPIO_Init(GPIOG, &GPIO_InitStruct); diff --git a/user/ht1622.c b/user/ht1622.c index 81c73cb..a085efa 100644 --- a/user/ht1622.c +++ b/user/ht1622.c @@ -273,6 +273,21 @@ void lcd_init( void ) //LCD Power ON lcd_power_on(); +#if 1 + //Test LCD, for debug + volatile uint32_t test_ram_wr = 0x12345678; + volatile uint32_t test_ram_rd = 0; + + ht1622_ram_write( 0, &test_ram_wr, sizeof( test_ram_wr) ); + ht1622_ram_read( 0, &test_ram_rd, sizeof( test_ram_rd ) ); + + if( test_ram_wr == test_ram_rd ){ + printf( "ht122 lcd test ok, %02X\n", test_ram_wr); + }else{ + printf( "ht122 lcd test fail, %02X -- %02X\n", test_ram_wr, test_ram_rd ); + } +#endif + ht1622_command( CMD_SYS_EN ); memset( &g_disp_ram, 0xFF, sizeof( g_disp_ram ) ); //ALL ON ht1622_ram_write( 0, (uint8_t*)&g_disp_ram, 32 ); diff --git a/user/user_eth.c b/user/user_eth.c index c0edecd..6bdd880 100644 --- a/user/user_eth.c +++ b/user/user_eth.c @@ -269,6 +269,23 @@ void user_eth_task( void* unused ) uint32_t tcp_err_cnt = 0; + #if 0 + //test eth output + while(1){ + if( netif_is_link_up(g_iot_client.p_netif) ){ + struct pbuf *p; + /* Allocate a new pbuf */ + p = pbuf_alloc(PBUF_LINK, 64, PBUF_RAM); + if( p ){ + for( int i=0; i<64; i++ ) + ((uint8_t*)p->payload)[i] = i; + g_iot_client.p_netif->linkoutput( g_iot_client.p_netif, p ); + } + } + osDelay( 5000 ); + } + #endif + while(1){ //1. wait linkup -- 2.34.1