espressif2022/echo_base_control

0.0.1

Latest
uploaded 5 hours ago
Echo Base Control Component - UART-based communication for echo base device control

readme

# DOA Angle Control Component

ESP-IDF component for controlling DOA (Direction of Arrival) devices via UART communication.

## Features

- Configurable UART port, TX/RX pins, and baud rate
- Support for angle control, action control, and calibration
- Automatic frame parsing and command handling
- Support for magnetic slide switch events
- Optional display integration support

## Usage

### Basic Initialization

```c
#include "doa_angle_control.h"

// Configure DOA angle control
doa_angle_control_config_t config = {
    .uart_num = UART_NUM_1,
    .tx_pin = GPIO_NUM_5,
    .rx_pin = GPIO_NUM_4,
    .baud_rate = 115200,
    .rx_buffer_size = 1024,  // Optional, defaults to 1024
};

doa_angle_control_handle_t handle;
esp_err_t ret = doa_angle_control_init(&config, &handle);
if (ret != ESP_OK) {
    ESP_LOGE("APP", "Failed to initialize DOA angle control");
    return;
}
```

### Set Angle

```c
// Set angle to 180 degrees
doa_angle_control_set_angle(handle, 180);
```

### Set Action

```c
// Set action (e.g., shark head movement)
doa_angle_control_set_action(handle, ACTION_SHARK_HEAD);
```

### Calibrate

```c
// Calibrate DOA device
doa_angle_control_set_calibrate(handle);
```

### Deinitialize

```c
// Clean up resources
doa_angle_control_deinit(handle);
```

## Available Actions

- `ACTION_SHARK_HEAD` (0x00): 摇头动作
- `ACTION_SHARK_HEAD_DECAY` (0x01): 渐变递减摇头
- `ACTION_LOOK_AROUND` (0x02): 左顾右盼
- `ACTION_BEAT_SWING` (0x03): 跟随节拍摇头
- `ACTION_CAT_NUZZLE` (0x04): 猫蹭脸动作
- `ACTION_BEAT_SWING_2` (0x05): 跟随节拍摇头2

## Optional Display Integration

To enable display integration (for slide switch events), add the following to your `sdkconfig`:

```
CONFIG_DOA_ANGLE_CONTROL_ENABLE_DISPLAY=y
```

This requires the `display_init.h` header to be available in your project.

## Frame Protocol

The component uses a custom frame protocol:

- Frame Header: 0xAA 0x55
- Length: 2 bytes (big-endian)
- Command: 1 byte
- Data: Variable length
- Checksum: 1 byte (sum of command + all data bytes)

## API Reference

See `include/doa_angle_control.h` for complete API documentation.

Supports all targets

License: Apache-2.0

To add this component to your project, run:

idf.py add-dependency "espressif2022/echo_base_control^0.0.1"

download archive

Stats

  • Archive size
    Archive size ~ 7.57 KB
  • Downloaded in total
    Downloaded in total 0 times
  • Downloaded this version
    This version: 0 times

Badge

espressif2022/echo_base_control version: 0.0.1
|