Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
Gpio Class Reference

#include <cs_Gpio.h>

Inheritance diagram for Gpio:
Collaboration diagram for Gpio:

Public Member Functions

void init (const boards_config_t &board)
 Initialize (from cs_Crownstone as driver) More...
 
void handleEvent (event_t &event)
 Handle incoming events. More...
 
void registerEvent (pin_t pin)
 Register event (from event handler) More...
 
- Public Member Functions inherited from EventListener
 EventListener ()
 
virtual ~EventListener ()
 unregisters the listener. More...
 
virtual void handleEvent (event_t &event)=0
 Handle events. More...
 
void listen ()
 Registers this with the EventDispatcher. More...
 

Static Public Member Functions

static GpiogetInstance ()
 Get singleton instance. More...
 

Private Member Functions

 Gpio ()
 Constructor. More...
 
 Gpio (Gpio const &)
 This class is a singleton, deny implementation. More...
 
void operator= (Gpio const &)
 This class is a singleton, deny implementation. More...
 
void tick ()
 Get regular ticks to send events. More...
 
bool pinExists (uint8_t pin_index)
 Return whether pin exists on board. More...
 
pin_t getPin (uint8_t pin_index)
 Return physical pin from virtual pin index. More...
 
bool isLedPin (uint8_t pin_index)
 Return whether pin is a LED. More...
 
cs_ret_code_t configure (uint8_t pin_index, GpioDirection direction, GpioPullResistor pull, GpioPolarity polarity)
 Configure pin. More...
 
cs_ret_code_t write (uint8_t pin_index, uint8_t *buf, uint8_t &length)
 Write to pin. More...
 
cs_ret_code_t read (uint8_t pin_index, uint8_t *buf, uint8_t &length)
 Read from pin. More...
 

Private Attributes

pin_info_t _pins [TOTAL_PIN_COUNT]
 Array of virtual pin info. More...
 
bool _initialized
 Initialized flag. More...
 
const boards_config_t_boardConfig
 Board configuration. More...
 

Constructor & Destructor Documentation

◆ Gpio() [1/2]

Gpio::Gpio ( )
private

Constructor.

◆ Gpio() [2/2]

Gpio::Gpio ( Gpio const &  )
private

This class is a singleton, deny implementation.

Member Function Documentation

◆ configure()

cs_ret_code_t Gpio::configure ( uint8_t  pin_index,
GpioDirection  direction,
GpioPullResistor  pull,
GpioPolarity  polarity 
)
private

Configure pin.

◆ getInstance()

static Gpio & Gpio::getInstance ( )
static

Get singleton instance.

◆ getPin()

pin_t Gpio::getPin ( uint8_t  pin_index)
private

Return physical pin from virtual pin index.

Returns PIN_NONE when it does not exist (for the configured board).

◆ handleEvent()

void Gpio::handleEvent ( event_t event)
virtual

Handle incoming events.

Implements EventListener.

◆ init()

void Gpio::init ( const boards_config_t board)

Initialize (from cs_Crownstone as driver)

◆ isLedPin()

bool Gpio::isLedPin ( uint8_t  pin_index)
private

Return whether pin is a LED.

◆ operator=()

void Gpio::operator= ( Gpio const &  )
private

This class is a singleton, deny implementation.

◆ pinExists()

bool Gpio::pinExists ( uint8_t  pin_index)
private

Return whether pin exists on board.

◆ read()

cs_ret_code_t Gpio::read ( uint8_t  pin_index,
uint8_t *  buf,
uint8_t &  length 
)
private

Read from pin.

◆ registerEvent()

void Gpio::registerEvent ( pin_t  pin)

Register event (from event handler)

◆ tick()

void Gpio::tick ( )
private

Get regular ticks to send events.

◆ write()

cs_ret_code_t Gpio::write ( uint8_t  pin_index,
uint8_t *  buf,
uint8_t &  length 
)
private

Write to pin.

Write to pin. Assumes pin has been configured as output.

Member Data Documentation

◆ _boardConfig

const boards_config_t* Gpio::_boardConfig
private

Board configuration.

◆ _initialized

bool Gpio::_initialized
private

Initialized flag.

◆ _pins

pin_info_t Gpio::_pins[TOTAL_PIN_COUNT]
private

Array of virtual pin info.


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