-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
114 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
title: MaixPy FP5510 Instructions | ||
update: | ||
- date: 2024-12-02 | ||
author: lxowalle | ||
version: 1.0.0 | ||
content: Initial document | ||
--- | ||
|
||
## Overview | ||
|
||
The **FP5510** is a single 10-bit DAC with a 120mA output current voice coil motor, specifically designed for autofocus operations. It is commonly used in cameras, smartphones, and other electronic devices requiring focus adjustments. | ||
|
||
## Using FP5510 in MaixPy | ||
|
||
MaixPy supports the operation of the `FP5510` through the `FP5510` object. | ||
|
||
Example Code: | ||
|
||
```python | ||
from maix.ext_dev import fp5510 | ||
|
||
fp = fp5510.FP5510() | ||
|
||
fp.set_pos(value) | ||
position = fp.get_pos() | ||
print(f'set position to {position}') | ||
|
||
``` | ||
- Use the `fp5510.FP5510()` method to construct an object for controlling the `fp5510`. Typically, the FP5510 may have slave addresses of `0x0e` or `0x0c`. You can specify the slave address via the `slave_addr` parameter, e.g.: | ||
|
||
> **Note**: If the address of fp5510 is found to change between 0x0e and 0x0c, it may be because the `FP5510` shares a reset pin with the `camera`. When the reset pin is enabled, the FP5510 address is `0x0c`. When the reset pin is disabled, the FP5510 address changes to `0x0e`. | ||
```python | ||
fp = fp5510.FP5510(slave_addr = 0x0c) | ||
``` | ||
- Use the `set_pos` method of the `FP5510` class to set the position of the voice coil motor. The range is [0, 1023]. For example: | ||
|
||
```python | ||
fp.set_pos(500) | ||
``` | ||
- Use the `get_pos` method of the `FP5510` class to get the position of the voice coil motor. For example: | ||
|
||
```python | ||
position = fp.get_pos() | ||
print(f'set position to {position}') | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
title: MaixPy FP5510 使用说明 | ||
update: | ||
- date: 2024-12-02 | ||
author: lxowalle | ||
version: 1.0.0 | ||
content: 初版文档 | ||
--- | ||
|
||
## FP5510 简介 | ||
|
||
FP5510是一款单10位DAC,具有120mA输出的电流音圈电机,专为自动对焦操作设计,常用于相机,手机等需要对焦的电子设备. | ||
|
||
## MaixPy 中使用 FP5510 | ||
|
||
MaixPy支持使用`FP5510`对象来操作`fp5510` | ||
|
||
示例代码: | ||
|
||
```python | ||
from maix.ext_dev import fp5510 | ||
|
||
fp = fp5510.FP5510() | ||
|
||
fp.set_pos(value) | ||
position = fp.get_pos() | ||
print(f'set position to {position}') | ||
|
||
``` | ||
- 使用`fp5510.FP5510()`方法构造一个操作`fp5510`的对象.一般情况, fp5510可能有`0x0e`和`0x0c`两种从机地址, 通过`slave_addr`参数指定从机地址, 例如: | ||
|
||
> 注意: 如果发现fp5510的地址在`0x0e`和`0x0c`间变化,可能是因为`fp5510`与`摄像头`共用了reset引脚,当使能reset脚时fp5510地址是`0x0c`, 当失能reset脚时fp5510地址是`0x0e` | ||
```python | ||
fp = fp5510.FP5510(slave_addr = 0x0c) | ||
``` | ||
- 使用`FP5510`类的`set_pos`方法来设置音圈电机的位置,范围为[0, 1023], 例如: | ||
|
||
```python | ||
fp.set_pos(500) | ||
``` | ||
- 使用`FP5510`类的`get_pos`方法来获取音圈电机的位置, 例如: | ||
|
||
```python | ||
position = fp.get_pos() | ||
print(f'set position to {position}') | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from maix import app, time | ||
from maix.ext_dev import fp5510 | ||
|
||
fp = fp5510.FP5510() | ||
|
||
value = 0 | ||
while not app.need_exit(): | ||
fp.set_pos(value) | ||
print(f'set pos to {fp.get_pos()}') | ||
|
||
value += 100 | ||
if value > 1023: | ||
value = 0 | ||
time.sleep_ms(100) |