/*Start of Main Functions*/ int main(void) { led_ctrl led1,led2; uint8_t SSLSockNo = 0; wiz_ssl_context sslContext; int ret; /*Usart initialization for Debug.*/ USART1Initialze(); printf("USART initialized.\n\r"); uint32_t i,j; /*LED initialization.*/ led_initialize(); led1 = led2 = ON; led2Ctrl(led2); led1Ctrl(led1); /*W5500 initialization.*/ W5500HardwareInitilize(); printf("W5500 hardware interface initialized.\n\r"); W5500Initialze(); printf("W5500 IC initialized.\n\r"); /*Set network informations*/ wizchip_setnetinfo(&gWIZNETINFO); print_network_information(); sysTickInit(); WIZnetRegFuncTicker(getSysTick); wiz_mbedtls_ssl_init(&sslContext,&SSLSockNo); wiz_mbedtls_ssl_socket(SSLSockNo,Sn_MR_TCP,3000,0x00); wiz_mbedtls_ssl_connect(SSLSockNo,testIP,443,1000); ret = wiz_mbedtls_ssl_handshake(&sslContext); if(ret == 0) { while(1) { memset(tempBuffer,0,BUFFER_SIZE); ret = wiz_mbedtls_ssl_read(sslContext.ssl,tempBuffer,BUFFER_SIZE); if(ret > 0) { printf("Received data: %s\r\n",tempBuffer); wiz_mbedtls_ssl_write(sslContext.ssl,tempBuffer,ret); } } } printf("ERROR: %d\r\n",ret); }
int main(void) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* MCU Configuration----------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* Configure the system clock */ SystemClock_Config(); /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_USART2_UART_Init(); /* USER CODE BEGIN 2 */ W5500HardwareInitilize(); /* USER CODE END 2 */ /* USER CODE BEGIN RTOS_MUTEX */ /* add mutexes, ... */ /* USER CODE END RTOS_MUTEX */ /* USER CODE BEGIN RTOS_SEMAPHORES */ /* add semaphores, ... */ /* USER CODE END RTOS_SEMAPHORES */ /* USER CODE BEGIN RTOS_TIMERS */ /* start timers, add new ones, ... */ /* USER CODE END RTOS_TIMERS */ /* Create the thread(s) */ /* definition and creation of defaultTask */ osThreadDef(defaultTask, StartDefaultTask, osPriorityNormal, 0, 2048); defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL); /* USER CODE BEGIN RTOS_THREADS */ /* add threads, ... */ /* USER CODE END RTOS_THREADS */ /* USER CODE BEGIN RTOS_QUEUES */ /* add queues, ... */ /* USER CODE END RTOS_QUEUES */ /* Start scheduler */ osKernelStart(); /* We should never get here as control is now taken by the scheduler */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ } /* USER CODE END 3 */ }