设备驱动程序模块
设备驱动程序模块是一种特殊形式的 MATLAB System 模块,当部署到 Arduino® 硬件板时,它会生成自定义 C/C++ 设备驱动程序代码。设备驱动程序模块使用户可以轻松访问硬件板功能,例如访问 Simulink® Support Package for Arduino Hardware 中不提供的通信协议或硬件库。
您可以从 System object™ 模板开发设备驱动程序模块,然后与其他用户共享完成的模块。
函数
arduino.supportpkg.getAVRLibraryRoot | Get Arduino AVR library root directory path (自 R2020b 起) |
arduino.supportpkg.getAVRRoot | Get Arduino AVR file root path (自 R2020b 起) |
arduino.supportpkg.getBoardInfo | Get properties of Arduino board in active Simulink model (自 R2020b 起) |
arduino.supportpkg.getIDERoot | Get Arduino IDE file root path (自 R2020b 起) |
arduino.supportpkg.getLibraryRoot | Get Arduino library root directory path (自 R2020b 起) |
arduino.supportpkg.getSAMDLibraryRoot | Get Arduino SAMD library root directory path (自 R2020b 起) |
arduino.supportpkg.getSAMDRoot | Get Arduino SAMD file root path (自 R2020b 起) |
arduino.supportpkg.getSAMLibraryRoot | Get Arduino SAM library root directory path (自 R2020b 起) |
arduino.supportpkg.getSAMRoot | Get Arduino SAM file root path (自 R2020b 起) |
主题
- Prerequisites for Developing Device Driver Blocks
Learn the system requirements and recommended skills to develop device driver blocks for Arduino hardware boards.
- Structure of Device Driver System Object
Understand the concepts and operation of device driver blocks implemented using a System object.
- Create a Digital Write Block
Create a Digital Write block using a System object.
- 步骤 1: Create a Project Folder
- 步骤 2: Write the Hardware-Specific C/C++ Code
- 步骤 3: Select a System Object Template
- 步骤 4: Specify the Initialization, Output, and Termination Behavior
- 步骤 5: Test System Object on MATLAB Command Line
- 步骤 6: Create the MATLAB System Block
- 步骤 7: Generate Code and Deploy the Model to the Hardware
- Create a Digital Read Block
Create a Digital Read block using a System object.
- Block Mask
Create block masks for your device driver blocks.
- 步骤 1: Add Description for Users
- 步骤 2: Add Pin Number Property
- 步骤 3: Add Push Button to View Pin Map
- Create Custom Device Driver Block for Arduino Library
Create a custom device driver block for Arduino hardware.
- 步骤 1: Create Project and Libraries Folder
- 步骤 2: Write Hardware Specific C/C++ Code
- 步骤 3: Select System Object Template
- 步骤 4: Specify Initialization, Output, and Termination Behavior
- 步骤 5: Update Paths for Source and Header Files
- 步骤 6: Set Output Port Properties
- 步骤 7: Create MATLAB System Block
- 步骤 8: Generate Code and Deploy Model to Hardware
- Simulation with Device Driver Blocks
Choose and implement a data simulation mode for device driver blocks.
- Sharing Device Driver Blocks with Other Users
Package and distribute your device driver blocks.
- Measure Servo Motor Shaft Angle Using a Device Driver Block in Connected I/O
A guide to enable Connected I/O on a Simulink System object block that contains hardware specific code allowing access to hardware specific features.