mmap-gpio: remove deprecated mmapped gpio function calls

The memory mapped GPIO function calls have been deprecated and in turn removed from the UPM libraries. MRAA now provides the best/fastest GPIO access possible based on the selected platform/pin automatically.

Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
Mihai Tudor Panu
2018-09-04 07:53:16 -07:00
parent 6ae7e9125b
commit 62f84dcc47
9 changed files with 2 additions and 45 deletions

View File

@ -40,7 +40,7 @@ const uint8_t m_char[26] = {0x77, 0x7c, 0x39, 0x5e, 0x79,
using namespace std;
using namespace upm;
upm::TM1637::TM1637(int clk_pin, int dio_pin, int bright, M_FAST_GPIO mmio) {
upm::TM1637::TM1637(int clk_pin, int dio_pin, int bright) {
if((m_clk = mraa_gpio_init(clk_pin)) == NULL){
throw std::invalid_argument(std::string(__FUNCTION__) +
@ -61,15 +61,6 @@ upm::TM1637::TM1637(int clk_pin, int dio_pin, int bright, M_FAST_GPIO mmio) {
mraa_gpio_mode(m_clk, MRAA_GPIO_PULLUP);
mraa_gpio_mode(m_dio, MRAA_GPIO_PULLUP);
if(mmio){
if(mraa_gpio_use_mmaped(m_clk, 1) != MRAA_SUCCESS ||
mraa_gpio_use_mmaped(m_dio, 1) != MRAA_SUCCESS){
throw std::runtime_error(std::string(__FUNCTION__) +
": mraa_gpio_use_mmaped() failed");
return;
}
}
mraa_gpio_write(m_clk, 0);
mraa_gpio_write(m_dio, 0);

View File

@ -74,22 +74,14 @@ namespace upm
class TM1637
{
public:
/**
* Enum for the memory-mapped GPIO
*/
typedef enum {
NO = 0,
YES = 1
} M_FAST_GPIO;
/**
* TM1637 constructor
*
* @param clk_pin Clock pin the sensor is connected to
* @param dio_pin Data pin the sensor is connected to
* @param bright Initial brightness, from 0 (dark) to 7 (bright) (default is 3)
* @param mmio Fast memory-mapped GPIO writes; default is yes
*/
TM1637(int clk_pin, int dio_pin, int bright = 3, M_FAST_GPIO mmio = YES);
TM1637(int clk_pin, int dio_pin, int bright = 3);
/**
* TM1637 destructor
*/