upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Data Structures | Functions | Typedefs
relay.h File Reference
Include dependency graph for relay.h:

API Description

Go to the source code of this file.

Data Structures

struct  _relay_context
 

Functions

relay_context relay_init (int pin)
 
void relay_close (relay_context dev)
 
upm_result_t relay_on (relay_context dev)
 
upm_result_t relay_off (relay_context dev)
 
bool relay_is_on (relay_context dev)
 
bool relay_is_off (relay_context dev)
 

Typedefs

typedef struct _relay_contextrelay_context
 

Function Documentation

relay_context relay_init ( int  pin)

relay init function

Parameters
pinPin to use
void relay_close ( relay_context  dev)

relay destructor

upm_result_t relay_on ( relay_context  dev)

Sets the relay switch to on (closed circuit). This allows current to flow and lights up the indicator LED.

Returns
result of the operation
upm_result_t relay_off ( relay_context  dev)

Sets the relay switch to off (open circuit). This stops current from flowing and the indicator LED is not lit.

Returns
result of the operation
bool relay_is_on ( relay_context  dev)

Checks whether the relay switch is closed.

Returns
True if the switch is on (closed), false otherwise
bool relay_is_off ( relay_context  dev)

Checks whether the relay switch is open.

Returns
True if the switch is off (open), false otherwise

Typedef Documentation

typedef struct _relay_context * relay_context

device context