PID plotter component  1.0
ESP-IDF component for pid plotter
Classes | Macros | Functions | Variables
transport.h File Reference
#include <stdlib.h>
#include "udp_handler.h"
#include "json_handler.h"
#include "tcp_handler.h"
#include "logger.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "freertos/queue.h"
#include "freertos/event_groups.h"
#include "freertos/semphr.h"
#include "esp_err.h"
#include "protocol_examples_common.h"
Include dependency graph for transport.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pid_terms
 
struct  data_recv
 

Macros

#define MESSAGE_QUEUE_SIZE   CONFIG_MESSAGE_QUEUE_SIZE
 

Functions

esp_err_t init_queue (void)
 Initialises message queue. More...
 
void init_transport (void)
 Initialises transport, i.e. connect to wifi. More...
 
esp_err_t send_to_queue (struct pid_terms pid_data)
 Sends pid_data struct to message queue. More...
 
struct data_recv receive_from_queue (void)
 Receive data from queue. More...
 
void pid_transport ()
 Handles UDP client, which sends pid_terms received through message queue. More...
 
void pid_const_transport ()
 Handles TCP client, which receives pid_constants from server, and parses the data and stores it in a global struct pid_const_data. More...
 
struct pid_const pid_const_read ()
 Returns pid_const_data struct. Checks if the resource is blocked by mutex for writing or it is accessible, waits till pid_const_data is accessible and returns it. More...
 

Variables

TaskHandle_t pid_transport_handle
 
TaskHandle_t pid_const_transport_handle
 
QueueHandle_t pid_struct_queue
 
SemaphoreHandle_t pid_const_read_write_mutex
 
struct pid_const pid_const_data
 

Macro Definition Documentation

◆ MESSAGE_QUEUE_SIZE

#define MESSAGE_QUEUE_SIZE   CONFIG_MESSAGE_QUEUE_SIZE

Function Documentation

◆ init_queue()

esp_err_t init_queue ( void  )

Initialises message queue.

Returns
esp_err_t ESP_OK - if queue init sucessfully, ESP_FAIL - if queue init failed

◆ init_transport()

void init_transport ( void  )

Initialises transport, i.e. connect to wifi.

◆ pid_const_read()

struct pid_const pid_const_read ( )

Returns pid_const_data struct. Checks if the resource is blocked by mutex for writing or it is accessible, waits till pid_const_data is accessible and returns it.

Returns
struct pid_const - Returns pid_const_data, can be used to access Kp, Ki, Kd and current values

◆ pid_const_transport()

void pid_const_transport ( )

Handles TCP client, which receives pid_constants from server, and parses the data and stores it in a global struct pid_const_data.

◆ pid_transport()

void pid_transport ( )

Handles UDP client, which sends pid_terms received through message queue.

◆ receive_from_queue()

struct data_recv receive_from_queue ( void  )

Receive data from queue.

Returns
struct data_recv - struct containing pid_terms and esp_err_t as members. pid_terms contains pid terms

◆ send_to_queue()

esp_err_t send_to_queue ( struct pid_terms  pid_data)

Sends pid_data struct to message queue.

Parameters
pid_datapid_terms struct contains pid values
Returns
esp_err_t ESP_OK - if queue init sucessfully, ESP_FAIL - if queue init failed

Variable Documentation

◆ pid_const_data

struct pid_const pid_const_data

◆ pid_const_read_write_mutex

SemaphoreHandle_t pid_const_read_write_mutex

◆ pid_const_transport_handle

TaskHandle_t pid_const_transport_handle

◆ pid_struct_queue

QueueHandle_t pid_struct_queue

◆ pid_transport_handle

TaskHandle_t pid_transport_handle