SwiftIO
所属分类:处理器开发
开发工具:Swift
文件大小:199KB
下载次数:0
上传日期:2023-05-08 17:03:39
上 传 者:
sh-1993
说明: 微控制器的Swift框架。
(A Swift framework for microcontrollers.)
文件列表:
LICENSE (1067, 2023-08-02)
Package.mmp (667, 2023-08-02)
Package.swift (1128, 2023-08-02)
Sources (0, 2023-08-02)
Sources\CNewlib (0, 2023-08-02)
Sources\CNewlib\empty.c (0, 2023-08-02)
Sources\CNewlib\include (0, 2023-08-02)
Sources\CNewlib\include\newlib.h (47, 2023-08-02)
Sources\CSwiftIO (0, 2023-08-02)
Sources\CSwiftIO\empty.c (0, 2023-08-02)
Sources\CSwiftIO\include (0, 2023-08-02)
Sources\CSwiftIO\include\swift_adc.h (1484, 2023-08-02)
Sources\CSwiftIO\include\swift_counter.h (3528, 2023-08-02)
Sources\CSwiftIO\include\swift_eth.h (529, 2023-08-02)
Sources\CSwiftIO\include\swift_fs.h (7144, 2023-08-02)
Sources\CSwiftIO\include\swift_gpio.h (4722, 2023-08-02)
Sources\CSwiftIO\include\swift_i2c.h (2803, 2023-08-02)
Sources\CSwiftIO\include\swift_i2s.h (7393, 2023-08-02)
Sources\CSwiftIO\include\swift_lcd.h (3745, 2023-08-02)
Sources\CSwiftIO\include\swift_os.h (1032, 2023-08-02)
Sources\CSwiftIO\include\swift_platform.h (1231, 2023-08-02)
Sources\CSwiftIO\include\swift_pwm.h (1821, 2023-08-02)
Sources\CSwiftIO\include\swift_spi.h (3392, 2023-08-02)
Sources\CSwiftIO\include\swift_timer.h (1865, 2023-08-02)
Sources\CSwiftIO\include\swift_uart.h (4890, 2023-08-02)
Sources\CSwiftIO\include\swift_wifi.h (3031, 2023-08-02)
Sources\SwiftIO (0, 2023-08-02)
Sources\SwiftIO\AnalogIn.swift (4019, 2023-08-02)
Sources\SwiftIO\BoardProtocol.swift (435, 2023-08-02)
Sources\SwiftIO\Counter.swift (5405, 2023-08-02)
Sources\SwiftIO\DigitalIn.swift (13424, 2023-08-02)
... ...
# SwiftIO
![build](https://github.com/madmachineio/SwiftIO/actions/workflows/build.yml/badge.svg)
[![Discord](https://img.shields.io/discord/59274335304***08899?&logo=Discord&colorB=7289da)](https://madmachine.io/discord)
[![twitter](https://img.shields.io/twitter/follow/madmachineio?label=%40madmachineio&style=social)](https://twitter.com/madmachineio)
A Swift framework for microcontrollers. You can program microcontrollers easily without worrying about complicated low-level stuff. After downloading your project to your board, you'll get the results in real time.
## Documentation
SwiftIO library provides easy access to communicate with the external circuits simply by invoking the related classes/methods. You can read or write digital and analog signals, as well as use communication protocols.
Go to [API Documentation](https://madmachineio.github.io/SwiftIO/documentation/swiftio/) for more detailed usage of all the functionalities.
## Library structure
SwiftIO contains several classes to access different functionalities of the board:
* AnalogIn - read analog input
* Counter - count the number of clock ticks
* DigitalIn - read digital input
* DigitalOut - set high/low digital output
* DigitalInOut - set a digital pin as both input and output
* FileDescriptor - perform low-level file operations
* I2C - use the I2C protocol to communicate with other devices
* I2SIn - receive audio data from external devices
* I2SOut - send audio data to external devices
* KernelTiming - global functions related to time
* PWMOut - modulate the pulse width of signal
* SPI - use the SPI protocol to communicate with other devices
* Timer - set a time interval to do a specified task
* UART - use the UART protocol to communicate with other devices
## Usage example
```swift
// Import the SwiftIO to use the related board functions.
import SwiftIO
// Import the MadBoard to decide which pin is used for the specific function.
import MadBoard
// Initialize the onboard blue LED to control it by setting output signal.
let led = DigitalOut(Id.BLUE)
while true {
// Set a high voltage to turn off the onboard LED.
// The onboard LED needs a low voltage to be turned on due to circuit connection.
led.write(true)
sleep(ms: 1000)
// Set a low voltage to turn on the onboard LED.
led.write(false)
sleep(ms: 1000)
}
```
## Examples
Before starting to create your project, let's start with these examples to get familiar with library usage.
* [GetStarted](https://docs.madmachine.io/projects/general/getting-started/overview) - get started and learn basic skills
* [SimpleIO](https://docs.madmachine.io/projects/general/simpleio/overview) - dive deeper into the microcontroller world and strengthen your programming skills
## Preparation
We created the MadMachine extension for Visual Studio Code for easier usage. Please install and configure it following [this instruction](https://docs.madmachine.io/overview/getting-started/software-prerequisite).
Besides, if you are more comfortable with the command line, welcome to try [mm sdk](https://github.com/madmachineio/mm-sdk).
近期下载者:
相关文件:
收藏者: