Future Technology Devices International Ltd.
Software Application Development
FT311D Android programmers guide
Document Reference No.: FT_000532
Version 1.0
Issue Date: 2012-07-24
The FT311D Android programmers guide describes User APIs for Android open accessory development. The Android application is divided into two layer, User Layer and FT311D layer. User layer is not aware of USB communication and calls the APIs exposed by the FT311D layer.
Future Technology Devices International Limited (FTDI)
Table of Contents
1    Preface (4)
1.1    Acronyms and Abbreviations (4)
1.2    References (4)
2    Introduction (5)
2.1    Android Device (5)
2.2    FT311D (6)
2.3    Accessories (6)
3    FT311D GPIO Interface (7)
3.1    FT311D GPIO-User Layer (7)
3.1.1    ConfigPort (7)
3.1.2    ReadPort (8)
3.1.3    WritePort (8)
3.1.4    ResetPort (8)
3.2    FT311D FT311-GPIO Layer (8)
3.2.1    ConfigPort (9)
3.2.2    ReadPort (9)
3.2.3    WritePort (9)
3.2.4    ResetPort (10)
4    FT311D PWM Interface (11)
4.1    FT311D PWM-User Layer (11)
4.1.1    SetPeriod (11)
4.1.2    SetDutyCycle (12)
4.1.3    Reset (12)
4.2    FT311D FT311-PWM Layer (12)
4.2.1    SetPeriod (12)
4.2.2    SetDutyCycle (13)
4.2.3    Reset (13)
5    FT311D I2C Master Interface (14)
5.1    FT311D I2C-User Layer (14)
5.1.1    SetFrequency(byte freq) (14)
5.1.2    ReadData (14)
5.1.3    WriteData (15)
5.1.4    Reset (16)
5.2    FT311D FT311-I2C Layer (16)
5.2.1    SetFrequency (17)
5.2.2    WriteData (17)
5.2.3    ReadData (19)
5.2.4    Reset (20)
6    FT311D UART interface (21)
6.1    FT311D UART-User Layer (21)
6.1.1    SetConfig (21)
6.1.2    SendData (22)
6.1.3    ReadData (22)
6.2    FT311D FT311-UART Layer (22)
6.2.1    SetConfig (22)
6.2.2    SendData (23)
6.2.3    ReadData (24)
7    FT311D SPI Slave Interface (25)
7.1    FT311D SPI Slave-User Layer (25)
7.1.1    SetConfig (25)
7.1.2    SendData (26)
7.1.3    ReadData (26)
7.1.4    Reset (26)
7.2    FT311D FT311-SPISlave Layer (26)
7.2.1    SetConfig (27)
7.2.2    SendData (27)
7.2.3    ReadData (28)
7.2.4    Reset (28)
8    FT311D SPI Master Interface (29)
8.1    FT311D SPIMaster-User layer (29)
8.1.1    SetConfig (29)
8.1.2    SendData (30)
8.1.3    ReadData (30)
8.1.4    Reset (30)
8.2    FT311D FT311-SPIMaster Layer (30)
8.2.1    SetConfig (31)document有安卓版吗
8.2.2    SendData (32)
8.2.3    ReadData (32)
8.2.4    Reset (33)
9    Annex A : GPIO (34)
10    Annex B : PWM (36)
11    Annex C : I2C (37)
12    Annex D : UART (41)
13    Annex E : SPI Slave (43)
14    Annex F : SPI Master (45)
Appendix A – List of Tables & Figures (48)
List of Tables (48)
List of Figures (49)
APPENDIX B - Contact Information (50)
Appendix C - Revision History (51)
1Preface
The FT311D interface is a proprietary interface for Android Open Accessory development. The FT311D provides UART/GPIO/PWM/I2C Master/SPI Slave/SPI Master interfaces for Android devices. Android applications can use these interfaces to communicate with their accessories.
Any software code examples given in this document are for information only. The examples are not guaranteed and are not supported by FTDI.
1.1Acronyms and Abbreviations
Terms Description
USB Universal Serial Bus
FT311D FTDIChips interface chip for Android Open Accessory development.
Table 1.1 : Acronyms and Abbreviations
1.2References
FT311D datasheet
Android Develpers, developer.android/index.html
2Introduction
FTDI provides the FT311D interface chip for USB Android Open Accessory development. The FT311D provides UART/GPIO/PWM/I2C Master/SPI slave /SPI Master interfaces for Android devices to communicate with their accessories.
Android Device
(2.3.4 or Higher)
Figure 2.1 :  Android Open Accessory  Modules
Android Open Accessory development requires an Android Device with Android 2.3.4 or higher and FTDIChip’s interface chip, FT311D. Users can choose any one of the interfaces provided by FT311D to connect their accessories.
This document will specify commands and data protocol for communication between Android Devices and the FT311D chip. The Interface between FT311D and Accessory follow the standard protocol of the selected Interface.
As the FT311D is an interface chip, most of the application control and behavior is implemented in Android device and accessory.
2.1Android Device
Android devices with Android 3.1 or higher version. This document and examples applies to Android 3.1 and above (the Android API changed from version 2.3.4 to 3.1). The android application is launched based on the parameters like manufacturer, model and version defined in l file.
For application development using FT311D, Android applications are divided into two parts:

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。