SRA Board Components
ESP-IDF component for SRA Board
Classes | Functions
servo.h File Reference
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "driver/mcpwm.h"
#include "soc/mcpwm_periph.h"
#include "esp_attr.h"
#include "sdkconfig.h"
#include "esp_log.h"
#include "esp_err.h"
#include "pin_defs.h"
Include dependency graph for servo.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  servo_config
 This structure contains the configuration of servos. More...
 

Functions

esp_err_t enable_servo ()
 Enables Servo port on the sra board, sets up PWM for the three pins in servo port. More...
 
esp_err_t set_angle_servo (servo_config *config, unsigned int degree_of_rotation)
 Set the angle of the servos attached to the servo port of SRA Board. More...
 
int read_servo (servo_config *config)
 Get the angle of the servos. More...
 

Function Documentation

◆ enable_servo()

esp_err_t enable_servo ( )

Enables Servo port on the sra board, sets up PWM for the three pins in servo port.

Returns
esp_err_t - returns ESP_OK if servo pins initialised, else it returns ESP_ERR_INVALID_ARG

◆ read_servo()

int read_servo ( servo_config config)

Get the angle of the servos.

Returns
esp_err_t

◆ set_angle_servo()

esp_err_t set_angle_servo ( servo_config config,
unsigned int  degree_of_rotation 
)

Set the angle of the servos attached to the servo port of SRA Board.

Parameters
configpointer to the servo_config struct
degree_of_rotationangle to which the servo must be set, depends on value of MAX_DEGREE macro
Returns
esp_err_t