Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
/******************************************************************************
* File Name: main.c
*
* Description: This is the source code for the CYW43907 TCP Client Example
* for ModusToolbox.
*
* Related Document: See README.md
*
*
*******************************************************************************
* $ Copyright 2021-2023 Cypress Semiconductor $
*******************************************************************************/
/* Header file includes */
#include "cyhal.h"
#include "cybsp.h"
#include "cy_retarget_io.h"
/* FreeRTOS header file */
#include <FreeRTOS.h>
#include <task.h>
/* TCP client task header file. */
#include "tcp_client.h"
/*******************************************************************************
* Macros
********************************************************************************/
/* RTOS related macros. */
#define TCP_CLIENT_TASK_STACK_SIZE (5 * 1024)
#define TCP_CLIENT_TASK_PRIORITY (1)
/*******************************************************************************
* Global Variables
********************************************************************************/
/* This enables RTOS aware debugging */
volatile int uxTopUsedPriority;
/*******************************************************************************
* Function Name: main
********************************************************************************
* Summary:
* This is the main function for CYW43907 CPU. It does
* 1. UART console output and input.
* 2. LED ON/OFF based on the TCP packet received.
*
* Parameters:
* void
*
* Return:
* int
*
*******************************************************************************/
int main(void)
{
/* This enables RTOS aware debugging in OpenOCD. */
uxTopUsedPriority = configMAX_PRIORITIES - 1;
/* Initialize the board support package. */
CY_ASSERT(CY_RSLT_SUCCESS == cybsp_init());
/* Enable global interrupts. */
__enable_irq();
/* Initialize retarget-io to use the debug UART port. */
cy_retarget_io_init(CYBSP_DEBUG_UART_TX, CYBSP_DEBUG_UART_RX,
CY_RETARGET_IO_BAUDRATE);
/* Initialize the User LED. */
cyhal_gpio_init(CYBSP_USER_LED2, CYHAL_GPIO_DIR_OUTPUT,
CYHAL_GPIO_DRIVE_STRONG, CYBSP_LED_STATE_OFF);
/* \x1b[2J\x1b[;H - ANSI ESC sequence to clear screen. */
printf("\x1b[2J\x1b[;H");
printf("************ "
"CYW43907 TCP Client "
"************ \r\n\n");
/* Create the task to establish a connection to a remote TCP server */
xTaskCreate(tcp_client_task, "Network task", TCP_CLIENT_TASK_STACK_SIZE, NULL,
TCP_CLIENT_TASK_PRIORITY, NULL);
/* Start the FreeRTOS scheduler. */
vTaskStartScheduler();
/* Should never get here. */
CY_ASSERT(0);
}
/* [] END OF FILE */