GithubHelp home page GithubHelp logo

databit / pine64-cpp Goto Github PK

View Code? Open in Web Editor NEW
15.0 3.0 7.0 11 KB

C++ library for Pine64. Based on the work of Eric Ptak (@thortex) , Stefan Mavrodiev (@StefanMavrodiev), Kamil Trzcinski (@ayufan-pine64)

Makefile 0.15% C++ 99.85%

pine64-cpp's Introduction

Pine64-CPP

C++ library for Pine64. Based on the work of Eric Ptak <[email protected]>, Stefan Mavrodiev <[email protected]>, Kamil Trzcinski <[email protected]>

Pine64-CPP is object oriented library for access to GPIO, I2C and SPI. Moreover all GPIO pin is mapped.

Example

#include "pinout.h"
#include "gpio.h"

using namespace std;
using namespace Pine64;

int main (void) {
  GPIO* man = new GPIO();

  if (man->setup()) {
    cout << "Failed to configure GPIO\n" << endl;
    return 1;
  }

  cout << " Set GPIO pin directions" << endl;
  man->pinMode(PI_GPIO_18, OUTPUT);

  for(int i = 0; i < 20; i++) {
    cout << " Turn Led ON" << endl;
    man->digitalWrite(PI_GPIO_18, HIGH);
    man->delay(1000);
    cout << " Turn Led OFF" << endl;
    man->digitalWrite(PI_GPIO_18, LOW);
    man->delay(1000);
  }

  cout << "Exiting....." << endl;
  return 0;
}

pine64-cpp's People

Contributors

databit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pine64-cpp's Issues

not working on pin 7 (GPIO_362, PI_GPIO_4)

I tried to use the pin GPIO 362, it's not working on my pine64+ 2Go. (not LTS)
what I'vs done :

  • clone the repo
  • going into the folder
  • executing make
    -> The led on GPIO 72 lit up as expected

then I did a test with pin 362

  • editing example.cpp
  • replacing PI_GPIO_18 (GPIO 72) by PI_GPIO_4
  • repositioning the LED on the correct pin
  • executing make
    -> nothing happens.

PS : I've seen this bug first on my code, which is a java port of your mmap code, I've then tested in your code directly.

Thank you

SPI examples

Hello, I was wondering if you have an example as to how to use the SPI header. This library is great and would love to use it for a SPI connection as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.