Treehopper C++ API
Core classes

These classes are the foundation of Treehopper. More...

Classes

class  ConnectionService
 Provides TreehopperUsb discovery and factory duties. More...
 
class  TreehopperUsb
 The core class for communicating with Treehopper USB boards. More...
 
class  Pin
 Built-in I/O pins. More...
 
class  HardwareSpi
 Built-in SPI peripheral. More...
 
class  HardwareI2c
 Built-in I2C module. More...
 
class  HardwareUart
 Built-in UART peripheral. More...
 
class  HardwarePwm
 Built-in hardware PWM channels. More...
 

Detailed Description

Many of these classes contain useful code examples and tips on usage.

Important concepts

Assemblies

Except for ConnectionService, all these classes live in the Treehopper.dll assembly (which resides in the Treehopper NuGet package).

Object Construction

In almost all cases, the entire object tree is built for you. For example, you'll never call

Pin pin = new Pin(5); // this makes no sense

Instead, you'll access these objects through the TreehopperUsb object, which you'll obtain from the ConnectionService.Instance. Like so:

TreehopperUsb board = await ConnectionService.Instance.GetFirstDeviceAsync(); // get the first device found
await board.ConnectAsync(); // connect to the board
board.I2c.Enabled = true; // enable the I2C peripheral