MakeBlock Drive Updated Updated library for MakeBlock Ranger

Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
MePort Class Reference

Port Mapping for RJ25. More...

`#include <src/MePort.h>`

Inheritance diagram for MePort:
[legend]

## Public Member Functions
| MePort (void)
| MePort (uint8_t port)
| MePort (uint8_t port, uint8_t slot)
uint8_t | getPort (void)
uint8_t | getSlot (void)
bool | dRead1 (uint8_t mode=INPUT)
bool | dRead2 (uint8_t mode=INPUT)
bool | dpRead1 (void)
bool | dpRead2 (void)
void | dWrite1 (bool value)
void | dWrite2 (bool value)
int16_t | aRead1 (void)
int16_t | aRead2 (void)
void | aWrite1 (int16_t value)
void | aWrite2 (int16_t value)
void | reset (uint8_t port)
void | reset (uint8_t port, uint8_t slot)
uint8_t | pin1 (void)
uint8_t | pin2 (void)
uint8_t | pin (void)
uint8_t | pin (uint8_t port, uint8_t slot)

## Protected Attributes
uint8_t | s1
uint8_t | s2
uint8_t | _port
uint8_t | _slot

## Detailed Description

Port Mapping for RJ25.

Class: MePort

Description
  Declaration of Class MePort

Copyright (C), 2012-2016, MakeBlock

## Constructor & Destructor Documentation

## ◆ MePort() [1/3]

MePort::MePort | ( | void |  | ) |

Alternate Constructor which can call your own function to map the MePort to arduino port, no pins are used or initialized here

## ◆ MePort() [2/3]

MePort::MePort | ( | uint8_t | port | ) |

Alternate Constructor which can call your own function to map the MePort to arduino port, no pins are used or initialized here, but PWM frequency set to 976 Hz

Parameters

  [in] | port | - RJ25 port from PORT_1 to M2

## ◆ MePort() [3/3]

MePort::MePort | ( | uint8_t | port,
|  | uint8_t | slot
| ) |  |

Alternate Constructor which can call your own function to map the MePort to arduino port, no pins are used or initialized here, but PWM frequency set to 976 Hz

Parameters

  [in] | port | - RJ25 port from PORT_1 to M2
  [in] | slot | - SLOT1 or SLOT2

## Member Function Documentation

## ◆ aRead1()

int16_t MePort::aRead1 | ( | void |  | ) |

Function
  aRead1

Description
  Read the analog value on slot1 of current RJ25 object's port

Output
  None

Returns
  Analog value from 0-1023

Others
  None

## ◆ aRead2()

int16_t MePort::aRead2 | ( | void |  | ) |

Function
  aRead2

Description
  Read the analog value on slot2 of current RJ25 object's port

Output
  None

Returns
  Analog value from 0-1023

Others
  None

## ◆ aWrite1()

void MePort::aWrite1 | ( | int16_t | value | ) |

Function
  aWrite1

Description
  Set the PWM output value on slot1 of current RJ25 object's port

Parameters

  [in] | value | - Analog value between 0 to 255

Output
  None

Returns
  None

Others
  None

## ◆ aWrite2()

void MePort::aWrite2 | ( | int16_t | value | ) |

Function
  aWrite2

Description
  Set the PWM output value on slot2 of current RJ25 object's port

Parameters

  [in] | value | - Analog value between 0 to 255

Output
  None

Returns
  None

Others
  None

## ◆ dpRead1()

bool MePort::dpRead1 | ( | void |  | ) |

Function
  dpRead1

Description
  Read the digital input value on slot1 of current RJ25 object's port, the input mode set as INPUT_PULLUP.

Output
  None

Returns
  Digital input value

Others
  None

## ◆ dpRead2()

bool MePort::dpRead2 | ( | void |  | ) |

Function
  dpRead2

Description
  Read the digital input value on slot2 of current RJ25 object's port, the input mode set as INPUT_PULLUP.

Output
  None

Returns
  Digital input value

Others
  None

## ◆ dRead1()

bool MePort::dRead1 | ( | uint8_t | mode = `INPUT` | ) |

Function
  dRead1

Description
  Read the digital input value on slot1 of current RJ25 object's port

Parameters

  [in] | mode | - digital input mode INPUT or INPUT_PULLUP

Output
  None

Returns
  Digital input value

Others
  None

## ◆ dRead2()

bool MePort::dRead2 | ( | uint8_t | mode = `INPUT` | ) |

Function
  dRead2

Description
  Read the digital input value on slot2 of current RJ25 object's port

Parameters

  [in] | mode | - digital input mode INPUT or INPUT_PULLUP

Output
  None

Returns
  Digital input value

Others
  None

## ◆ dWrite1()

void MePort::dWrite1 | ( | bool | value | ) |

Function
  dWrite1

Description
  Set the digital output value on slot1 of current RJ25 object's port

Parameters

  [in] | value | - digital output value HIGH or LOW

Output
  None

Returns
  None

Others
  None

## ◆ dWrite2()

void MePort::dWrite2 | ( | bool | value | ) |

Function
  dWrite2

Description
  Set the digital output value on slot2 of current RJ25 object's port

Parameters

  [in] | value | - digital output value HIGH or LOW

Output
  None

Returns
  None

Others
  None

## ◆ getPort()

uint8_t MePort::getPort | ( | void |  | ) |

Function
  getPort

Description
  Get current valid port of current RJ25 object

Output
  None

Returns
  Port bumber from PORT_1 to M2

Others
  None

## ◆ getSlot()

uint8_t MePort::getSlot | ( | void |  | ) |

Function
  getSlot

Description
  Get current valid slot of current RJ25 object's port

Output
  None

Returns
  Slot bumber SLOT1 or SLOT2

Others
  None

## ◆ pin() [1/2]

uint8_t MePort::pin | ( | uint8_t | port,
|  | uint8_t | slot
| ) |  |

Function
  pin

Description
  Return the arduino pin number of current RJ25 object's port

Parameters

  [in] | port | - RJ25 port from PORT_1 to M2
  [in] | slot | - SLOT1 or SLOT2

Output
  None

Returns
  The PIN number of arduino

Others
  None

## ◆ pin() [2/2]

uint8_t MePort::pin | ( | void |  | ) |

Function
  pin

Description
  Return the arduino pin number of current RJ25 object's port, if the RJ25 module have one available PIN.

Output
  None

Returns
  The PIN number of arduino

Others
  None

## ◆ pin1()

uint8_t MePort::pin1 | ( | void |  | ) |

Function
  pin1

Description
  Return the arduino pin number of current RJ25 object's slot1

Output
  None

Returns
  The PIN number of arduino

Others
  None

## ◆ pin2()

uint8_t MePort::pin2 | ( | void |  | ) |

Function
  pin2

Description
  Return the arduino pin number of current RJ25 object's slot2

Output
  None

Returns
  The PIN number of arduino

Others
  None

## ◆ reset() [1/2]

void MePort::reset | ( | uint8_t | port | ) |

Function
  reset

Description
  Reset the RJ25 available PIN by its port

Parameters

  [in] | port | - RJ25 port from PORT_1 to M2

Output
  None

Returns
  None

Others
  None

## ◆ reset() [2/2]

void MePort::reset | ( | uint8_t | port,
|  | uint8_t | slot
| ) |  |

Function
  reset

Description
  Reset the RJ25 available PIN by its port and slot

Parameters

  [in] | port | - RJ25 port from PORT_1 to M2
  [in] | slot | - SLOT1 or SLOT2

Output
  None

Returns
  None

Others
  None

## Member Data Documentation

## ◆ _port

uint8_t MePort::_port
| protected

Description
  Variables used to store the port

## ◆ _slot

uint8_t MePort::_slot
| protected

Description
  Variables used to store the slot

## ◆ s1

uint8_t MePort::s1
| protected

Description
  Variables used to store the slot1 gpio number

## ◆ s2

uint8_t MePort::s2
| protected

Description
  Variables used to store the slot2 gpio number

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

- src/MePort.h
- src/MePort.cpp