Treehopper C# API
NesController Class Reference

Nintendo Entertainment System (NES) Controller More...

Inheritance diagram for NesController:
IPollable IPolledEvents IPollable SuperNesController

Public Member Functions

 NesController (Spi spi, SpiChipSelectPin ps)
 
virtual async Task UpdateAsync ()
 Requests a reading from the controller and updates its data properties with the gathered values. More...
 

Protected Member Functions

void RaiseDPadChanged ()
 

Protected Attributes

SpiDevice dev
 
DPadState dpad
 

Properties

Button A [get]
 
Button B [get]
 
Button Start [get]
 
Button Select [get]
 
DPadState DPad [get]
 
bool AutoUpdateWhenPropertyRead = true [get, set]
 
int AwaitPollingInterval = 25 [get, set]
 

Events

DPadStateEventHandler DPadStateChanged
 
PropertyChangedEventHandler PropertyChanged
 

Detailed Description

Nintendo Entertainment System (NES) Controller

Constructor & Destructor Documentation

◆ NesController()

NesController ( Spi  spi,
SpiChipSelectPin  ps 
)

Member Function Documentation

◆ UpdateAsync()

virtual async Task UpdateAsync ( )
virtual

Requests a reading from the controller and updates its data properties with the gathered values.

Returns
An awaitable Task

Note that when AutoUpdateWhenPropertyRead is true (which it is, by default), this method is implicitly called when any sensor data property is read from — there's no need to call this method unless you set AutoUpdateWhenPropertyRead to false.

Unless otherwise noted, this method updates all sensor data simultaneously, which can often lead to more efficient bus usage (as well as reducing USB chattiness).

Implements IPollable.

Reimplemented in SuperNesController.

◆ RaiseDPadChanged()

void RaiseDPadChanged ( )
protected

Member Data Documentation

◆ dev

SpiDevice dev
protected

◆ dpad

DPadState dpad
protected

Property Documentation

◆ A

Button A
get

◆ B

Button B
get

◆ Start

Button Start
get

◆ Select

Button Select
get

◆ DPad

DPadState DPad
get

◆ AutoUpdateWhenPropertyRead

bool AutoUpdateWhenPropertyRead = true
getset

◆ AwaitPollingInterval

int AwaitPollingInterval = 25
getset

Event Documentation

◆ DPadStateChanged

DPadStateEventHandler DPadStateChanged

◆ PropertyChanged

PropertyChangedEventHandler PropertyChanged

The documentation for this class was generated from the following file: