no-OS
Loading...
Searching...
No Matches
apard_servo_control.c File Reference

Implementation of the APARD servo control example. Drives two hobby servos via PWM (50 Hz) and exposes SERVO1_ON / SERVO1_OFF / SERVO2_ON / SERVO2_OFF / SERVO_STATUS commands over a TCP socket on the ADIN1110 link. More...

#include <stdio.h>
#include <string.h>
#include "common_data.h"
#include "lwip_socket.h"
#include "lwip_adin1110.h"
#include "tcp_socket.h"
#include "no_os_error.h"
#include "no_os_pwm.h"
#include "maxim_pwm.h"
#include "adin1110.h"
#include "network_interface.h"
Include dependency graph for apard_servo_control.c:

Macros

#define SERVER_PORT   10000
 
#define CMD_BUF_SIZE   64
 
#define RESP_BUF_SIZE   64
 
#define PWM_PERIOD_NS   20000000U /* 50 Hz */
 
#define SERVO_PULSE_OFF_NS   1500000U /* 1.5 ms — initial position */
 
#define SERVO_PULSE_ON_NS   2000000U /* 2.0 ms — ~45° from initial */
 

Functions

int example_main ()
 Configure the output port of the AD-APARDPFWD-SL, initialize the servo PWM, then open a TCP socket to accept commands.
 

Detailed Description

Implementation of the APARD servo control example. Drives two hobby servos via PWM (50 Hz) and exposes SERVO1_ON / SERVO1_OFF / SERVO2_ON / SERVO2_OFF / SERVO_STATUS commands over a TCP socket on the ADIN1110 link.

Author
Tudor Gansca (tudor.nosp@m..gan.nosp@m.sca@a.nosp@m.nalo.nosp@m.g.com)

Copyright 2026(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ CMD_BUF_SIZE

#define CMD_BUF_SIZE   64

◆ PWM_PERIOD_NS

#define PWM_PERIOD_NS   20000000U /* 50 Hz */

◆ RESP_BUF_SIZE

#define RESP_BUF_SIZE   64

◆ SERVER_PORT

#define SERVER_PORT   10000

◆ SERVO_PULSE_OFF_NS

#define SERVO_PULSE_OFF_NS   1500000U /* 1.5 ms — initial position */

◆ SERVO_PULSE_ON_NS

#define SERVO_PULSE_ON_NS   2000000U /* 2.0 ms — ~45° from initial */

Function Documentation

◆ example_main()

int example_main ( void )

Configure the output port of the AD-APARDPFWD-SL, initialize the servo PWM, then open a TCP socket to accept commands.

Basic example main execution.

Basic example main executiont.

Returns
ret - Result of the example execution.

IIO descriptor and initialization parameter.

IIO app.

Declaring iio_devices structure

Initializing IIO app init param.

Initializing IIO app.

Running the IIO app (use iio_info or osc in terminal).

Set the threshold voltage to 5V

The comparator output will be available on the GPO_A pin

Set the DAC output on channel C to 5V

Measure input current on channel D

GPIO Pin Interrupt Controller

UART init params

IIO application descriptor

IIO application initialization parameters

iio axi adc configurations.

iio axi dac configurations.

iio instance descriptor.

iio instance descriptor.

iio device instance descriptor.

UART init params

IIO application descriptor

IIO application initialization parameters

iio axi adc configurations.

iio axi dac configurations.

iio instance descriptor.

iio instance descriptor.

iio device instance descriptor.

Negative temperature

Positive temperature

Negative temperature

Positive temperature