Giter VIP home page Giter VIP logo

segnix's Introduction

@mainpage

Segnix


What Is It?

Segnix is an open-source interface library for hardware manipulation based on Linux platform and compatible with Arduino API. You can develop with it by using C/C++ and Python. Segnix is dedicated to provide a fast, efficient and unified software development environment for the person like you with a strong electronic design idea.

CAUTION!

Before November 22, 2014, Segnix was named ITEAD-OS-SDK

What Can It Do?

Through Segnix, users can directly access to the Linux platform hardware resources such as GPIO, UART, SPI, I2C etc. Segnix supports various hardware platforms, such as Iteaduino Plus A10/A20, IBOX, ITEAD Core EVB, Raspberry Pi and Raspberry Pi Model B+ and so on. Meanwhile, It also provides a great amount of libraries for all kinds of child board like NFC(PN532) module, GPS shield, GSM(SIM900/SIM908) shield, nRF24L01 module, OLED and LCD module etc.

Simplifying the hardware operation makes it possible for software engineers who are not familiar with the underlying hardware and junior developers to understand more about "Code World" and "Physical World". It can also work as a rapid prototyping development tool.

Features

At present, Segnix has a set of core features as below:

  • Support for upper-layer time functions
  • Support for PWM output with any GPIO
  • Support for GPIO operations
  • Support for GPIO 8bit/16bit bus operations
  • Support for UART bus operations
  • Support for I2C bus operations
  • Support for SPI bus operations
  • Support for external interrupts operations(Only for ITEAD CORE EVB)
  • Support for ADC (Only for BeagleBone Black)

Based on core features, plenty of functional features can be reached:

  • Support for SSD1306-based I2C OLED screen operations
  • Support for 1602 LiquidCrystal module
  • Support for GPS module
  • Support for GSM(SIM900/SIM908) module including GPRS/GPS operations
  • Support for NFC(PN532) module
  • Support for nRF24L01 module
  • Support for Temperature and Humidity module
  • Support for IoTgo platform
  • Support for Nextion

Where Can It Run?

At present, platforms supported by Segnix are following:

  • Iteaduino Plus A10/A20
  • ITEAD CORE EVB(IBOX)
  • Raspberry Pi Rv2
  • Raspberry Pi Model B+
  • BeagleBone Black

Which Language for Developing?

You can implement your design based on Segnix in C or C++. Segnix API, which is compatible with Arduino API, makes it easier for those who have some understanding of Arduino to get started. Without any codes modified, the libraries and user's codes for Arduino can be run on Segnix prefectly.

Segnix Python API, especially and amazingly, is provided for Python users. A few beautiful lines of code will achieve your goals!

Documentation

Online Segnix API can be reached at Segnix API. You can also find some important and helpful documents in directory Segnix/doc.

Installation and Uninstallation

Before all, we assume that you have installed the required packages: build-essential git-core in your Debian system. If not, you can install them by command:

$ sudo apt-get update
$ sudo apt-get install build-essential git-core

If you are a Python user, the following packages should be installed:

$ sudo apt-get install python2.7 python2.7-dev

Note

Segnix Python API depends python2.7 not python3.x.

Download and Install Segnix in Debian

Only a few steps, DO IT !

Step 1: Getting the Source Code

You can download Segnix by command:

$ git clone https://github.com/itead/Segnix.git
$ cd Segnix

or you can get Segnix via other ways you prefer at https://github.com/itead/Segnix

NOTE

All the commands of the following steps should be run under Segnix's source code directory.

Step 2: Configure Your Board

For now, platforms supported by Segnix and the configuration commands are below. You MUST choose the one fitting your board.

  • Iteaduino Plus A10/A20

    $ make Iteaduino_Plus
    
  • ITEAD CORE EVB

    $ make ITEAD_CORE_EVB
    
  • Raspberry Pi Rv2

    $ make Raspberry_Pi_Rv2
    
  • Raspberry Pi Model B+

    $ make Raspberry_Pi_Model_BPlus
    
  • Beagle bone black

    $ make BeagleBone_Black
    

Step 3: Select Functional Libraries to Install (Optional)

If you DO NOT want to customize the libraries to be installed, just skip this step. nine of ten skip to next step directly!

It's allowed for user to select functional libraries to install. Open file config.mk and edit it by adding or removing letter "#" at the head of each line for deselecting or selecting the corresponding library. More description for selecting libraries can be found in config.mk. For example:

$ vi config.mk
Editing... and Save

Step 4: Compile and Install

Installing Segnix requires root(super user)'s privilege. Run command:

$ make
$ sudo make install

If you are a lover of Python, you can install Segnix Python API by running:

$ sudo make SDK_Python_install

Version and Help

To check the version of Segnix installed, run command:

$ segnix -v

For some brief help information:

$ segnix --help

Uninstall

To uninstall the Segnix, just run command:

$ cd Segnix
$ sudo make uninstall

If you have installed Segnix Python API, you can uninstall it by running:

$ sudo make SDK_Python_uninstall

How to Start

Segnix Python API will be recommanded for Python users. Segnix works well with C(.c) and C++(.cpp) programs. Especially, it is compatiable with Arduino Sketch(.ino).

Compilation Helper: segnix

segnix is a script to compile your program conveniently. before November 22, 2014, segnix was named iteadcompile. Actually, segnix is a link to iteadcompile.

$ segnix --help

Usage:
  segnix objname source.ino [source2.ino] [...]
  segnix objname source.cpp [source2.cpp] [...]
  segnix objname source.c [source2.c] [...]
Examples for .ino
  segnix hello hello.ino
  segnix led led1.ino led2.ino
  segnix led *.ino
Examples for .cpp
  segnix hello hello.cpp
  segnix led led1.cpp led2.cpp
  segnix led *.cpp
Examples for .c
  segnix hello hello.c
  segnix led led1.c led2.c
  segnix led *.c
NOTES:
  objname cannot cantian ".ino" or ".c" or ".cpp"
Version:
  segnix [-v]
  segnix [--version]

To use Segnix in Python

Create a new file named blink.py which reads as follow:

#! /usr/bin/env python
from iteadsdk import *
LED = PG9
pinMode(LED, OUTPUT)
while True:
    digitalWrite(LED, HIGH)
    delay(1000)
    digitalWrite(LED, LOW)
    delay(1000)

Make blink.py executable:

$ chmod +x blink.py 

Then, run it:

$ sudo ./blink.py

You can get commutative HIGH and LOW from GPIO PG9, if you've run it on ITEAD CORE EVB or other platforms based on Allwinner A10/A20 SoC.

To use Segnix in C program

Create a new file named "led.c" which reads as follow:

#include <itead.h>
#include <stdio.h>

#define STATUS_LED1 PG9

void setup(void)
{
    printf("setup begin\n");
    pinMode(STATUS_LED1,OUTPUT);
}
void loop(void)
{
    digitalWrite(STATUS_LED1,HIGH);
    delay(1000);
    digitalWrite(STATUS_LED1,LOW);
    delay(1000);
}
void main(int argc, char **argv)
{
    setup();
    while(1)
    {
        loop();
    }
}

Then run segnix in the terminal

$ segnix LED led.c

You can run the LED program after compilation:

$ sudo ./LED

To use Segnix in C++ program

Create a new file named "led.cpp" which reads as follow:

#include <itead.h>
#include <stdio.h>

#define STATUS_LED1 PG9

void setup(void)
{
    printf("setup begin\n");
    pinMode(STATUS_LED1,OUTPUT);
}
void loop(void)
{
    digitalWrite(STATUS_LED1,HIGH);
    delay(1000);
    digitalWrite(STATUS_LED1,LOW);
    delay(1000);
}
int main(int argc, char **argv)
{
    setup();
    while(1)
    {
        loop();
    }
    return 0;
}

Then run segnix in the terminal

$ segnix LED led.cpp

You can run the LED program after compilation:

$ sudo ./LED

To use Segnix like an Arduino sketch(.ino)

Create a new file named "led.ino" which contains the following lines:

#include <stdio.h>

#define STATUS_LED1 PG9

void setup(void)
{
    printf("setup begin\n");
    pinMode(STATUS_LED1,OUTPUT);
}
void loop(void)
{
    digitalWrite(STATUS_LED1,HIGH);
    delay(1000);
    digitalWrite(STATUS_LED1,LOW);
    delay(1000);
}

Then run command as below to compile led.ino:

$ segnix LED led.ino

You can run the LED program after compilation:

$ sudo ./LED

Note: How to understand debug information from compiler

You DO NOT include the itead.h explicitly in your source file with suffix .ino. segnix will take care of everything. That means you need to know the method you should use for locating your .ino sketch bugs. Actually,if you have a sketch named "Hello.ino" with a bug at level ERROR in line 25, you will get some ERROR informations telling the ERROR bug in "Hello.cpp" with line 26(25+1) when command "segnix Hello Hello.ino" is executed. Why? segnix insert one line like include "itead.h" in the head of your Hello.ino, change the suffix .ino to .cpp and compile(using g++) Hello.cpp to generate Hello which is executable binary file. When you encounter other bugs in your sketch,debug skills on C++ program will also helpful for solving your problems.

Plan for Next Stage

Segnix will support much more hardware platforms and functional modules in the future. In the Linux thriving time, Segnix will make any impossible fanatic idea possible, are you ready?

How to Contribute

If you are interested and want to contribute to this project, yet you are suffering from lack of the related hardware. It does not matter. Just write an E-mail to [email protected], attach your github username in it and say something about your experience on the related projects, ITEAD Studio will send you a hardware for free after approval.

After receiving Iteaduino Plus A10/A20, you only need to:

  1. Fork this project
  2. Coding
  3. Push

License GPL

Copyright (C) 2013 ITEAD Studio

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.


The end


segnix's People

Contributors

guluguluchui avatar huangxianming avatar iteadsw avatar mars-wu avatar

Stargazers

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

Watchers

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

segnix's Issues

SDK I2C Compilation Problem

Here is the tip to avoid the following error message (on my Pi B+) according smbus

root@pi04:~/SDK# make
make -C lib all
make[1]: Entering directory '/root/SDK/lib'
make -C c libiteadc.so
make[2]: Entering directory '/root/SDK/lib/c'
gcc -O2 -fpic -shared -o libiteadc.so *.c -I../../include
In file included from itead_wire.c:37:0:
/usr/include/linux/i2c-dev.h:38:8: error: redefinition of ‘struct i2c_msg’
/usr/include/linux/i2c.h:68:8: note: originally defined here
/usr/include/linux/i2c-dev.h:90:7: error: redefinition of ‘union i2c_smbus_data’
/usr/include/linux/i2c.h:128:7: note: originally defined here

edit the file lib/c/itead_wire.c and comment the line which include linux/i2c.h since I2C definitions are already in i2c-dev.h. It avoid duplication definition at compilation

include <linux/types.h>
//#include <linux/i2c.h>

include <linux/i2c-dev.h>

Compiler Error

The follwing code can't be compiled with Raspberry Pi (with Arduino IDE works fine).

#include <NexConfig.h>
#include <NexNumber.h>
#include <NexText.h>
#include <NexPage.h>

NexPage pgBoot = NexPage(0, 0, "boot");
NexNumber nxADay = NexNumber(0, 2, "boot.day");
NexText nxBoot = NexText(0, 4, "boot.error");

uint32_t number;

void setup() {
 nexInit();
}

void loop() {}

if I try to compile with "segnix nex nex.c" I get the following errors:

compile by .c
In file included from /usr/local/include/NexTouch.h:25:0,
                 from /usr/local/include/NexNumber.h:20,
                 from nex.c:6:
/usr/local/include/NexObject.h:34:1: error: unknown type name ‘class’
 class NexObject
 ^
/usr/local/include/NexObject.h:35:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
 {
 ^
In file included from /usr/local/include/NexNumber.h:20:0,
                 from nex.c:6:
/usr/local/include/NexTouch.h:56:1: error: unknown type name ‘class’
 class NexTouch: public NexObject
 ^
/usr/local/include/NexTouch.h:56:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
 class NexTouch: public NexObject
               ^
In file included from /usr/local/include/NexNumber.h:21:0,
                 from nex.c:6:
/usr/local/include/NexHardware.h:32:1: error: unknown type name ‘bool’
 bool nexInit(void);
 ^
/usr/local/include/NexHardware.h:45:14: error: unknown type name ‘NexTouch’
 void nexLoop(NexTouch *nex_listen_list[]);
              ^
/usr/local/include/NexHardware.h:51:1: error: unknown type name ‘bool’
 bool recvRetNumber(uint32_t *number, uint32_t timeout = 100);
 ^
/usr/local/include/NexHardware.h:51:55: error: expected ‘;’, ‘,’ or ‘)’ before ‘=’ token
 bool recvRetNumber(uint32_t *number, uint32_t timeout = 100);
                                                       ^
/usr/local/include/NexHardware.h:52:69: error: expected ‘;’, ‘,’ or ‘)’ before ‘=’ token
 uint16_t recvRetString(char *buffer, uint16_t len, uint32_t timeout = 100);
                                                                     ^
/usr/local/include/NexHardware.h:54:1: error: unknown type name ‘bool’
 bool recvRetCommandFinished(uint32_t timeout = 100);
 ^
/usr/local/include/NexHardware.h:54:46: error: expected ‘;’, ‘,’ or ‘)’ before ‘=’ token
 bool recvRetCommandFinished(uint32_t timeout = 100);
                                              ^
In file included from nex.c:6:0:
/usr/local/include/NexNumber.h:30:1: error: unknown type name ‘class’
 class NexNumber: public NexTouch
 ^
/usr/local/include/NexNumber.h:30:16: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
 class NexNumber: public NexTouch
                ^
In file included from nex.c:7:0:
/usr/local/include/NexText.h:30:1: error: unknown type name ‘class’
 class NexText: public NexTouch
 ^
/usr/local/include/NexText.h:30:14: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
 class NexText: public NexTouch
              ^
In file included from nex.c:8:0:
/usr/local/include/NexPage.h:31:1: error: unknown type name ‘class’
 class NexPage: public NexTouch
 ^
/usr/local/include/NexPage.h:31:14: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
 class NexPage: public NexTouch
              ^
nex.c:12:1: error: unknown type name ‘NexPage’
 NexPage pgBoot = NexPage(0, 0, "boot");
 ^
nex.c:12:1: error: initializer element is not constant
nex.c:13:1: error: unknown type name ‘NexNumber’
 NexNumber nxADay = NexNumber(0, 2, "boot.day");
 ^
nex.c:13:1: error: initializer element is not constant
nex.c:14:1: error: unknown type name ‘NexText’
 NexText nxBoot = NexText(0, 4, "boot.error");
 ^
nex.c:14:1: error: initializer element is not constant

include itead_LiquidCrystal.h posts an error when compiling a program with it included

Hi, I'm trying to work a Liquid Crystal display using a Raspberry Pi B+ using the itead SDK but when I build the program in C and try to compile it, it posts an error

/usr/local/includeitead_LiquidCrystal.h:50:1: error: unknown type name 'class'
/usr/local/includeitead_LiquidCrystal.h:50:21: error: expected '=', ',', ';', 'asm' or 'attribute' before ':' token.

I only downloaded the new version last night from Git hub so I should be up todate. I am knew to raspberry Pi so please bare with me if i'm doing something silly. It does look like all include files that use the defenation 'class' will have the same error.

Any help would be great.

The code i'm using is:
//***********************************************************************************************
// include the library code:
#include <time.h>
#include <stdio.h>
#include <itead_LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(16,18,11,12,13,15);

void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
}

main() {

time_t rawtime;
struct tm * timeinfo;

setup();
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):    
// lcd.setCursor(0, 0);

// print system time 
time ( &rawtime );
timeinfo = localtime ( &rawtime );
while(1)
    {  
    lcd.setCursor(0,0);
    lcd.print(asctime (timeinfo));
     delay(1000);
     }
}

//******************************************************************************************

Thanks.

Looking for SIM800 GSM GPRS ADD-ON V2.0 MODULE SHIELD FOR RPI documentation

Hi,

I'm a Raspberry PI 3 hobbyist. Recently I've bought a SIM800 GSM GPRS ADD-ON V2.0 MODULE SHIELD FOR RPI for my Raspberry PI 3 B+. I have found some documentation make by other hobbyists, but I'm afraid that documentation is too old.

I saw some documentation from your company, but it is not crystal clear for pyhton-raspberry hobbyists like me.

I will love to teach how to use the shield to a club of younger programmers, so I promise to help make a documentation child-friendly and share it with you. But Could you help me with more details to make my SIM800 GSM GPRS ADD-ON V2.0 MODULE SHIELD FOR RPI on my Raspberry PI 3 B+? works

Thank you for your support.

No ADC pin Found

Hi I am running the python example:

#! /usr/bin/env python from iteadsdk import * LED = GPIO4 pinMode(LED, OUTPUT) while True: digitalWrite(LED, HIGH) delay(1000) digitalWrite(LED, LOW) delay(1000)

The LED is connected to GPIO4, but when I run the example I only got:
No ADC pin found.

I compiled the lastest version of Segnix to my RaspberryPi 3 B+

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.