In my previous blog post I published a TSL2561 light sensor driver in C for Raspberry PI. In this article I will publish a user space C driver for Adafruit 4-digit 7-segment display.
This is based on a HT16K33 led driver IC, that it’s a I2C driven RAM mapping 16*8 LED controller driver.
The driver I’m posting it’s valid for the adafruit circuit only, since it’s completely based on the electronic schematic they realized.
Don’t use the driver with other circuits, since the display could not function properly.
Basically the adafruit 7-segment backpack (http://www.adafruit.com/products/879) uses 8 (rows) * 5 (columns) HT16K33 lines to drive its leds. The column number 1 is dedicated to the first digit, the second column is dedicated to the second digit, the third column is attached to the colon sign in the middle of the 4 digits, the fourth column is attached to the third digit, and the fifth colum to the fourth display digit.
While each row drives a single led of the given column.
The display columns 0, 1, 3, 4 can show numbers and some letters (A-F, n, o, i, l, L, etc…) plus a decimal point, while the column 2 can only show a colon sign (:).
A number or a letter for each digit is composed by 7 led segments, so the possibilities are few… but not so few after all (check 7seg.txt file attachment for more details on letter composition).
So, now comes the fun. How can I access the led driver memory to light display digits in C? Adafruit releases proof of concept libraries in C and python, but they don’t seem to run on my raspberry pi.
Since I am too lazy to port their code with external dependencies, I decided to write my own library in C.
#include "7seg_bp_ada.h" /* prepare the backpack driver (the first parameter is the raspberry pi i2c master controller attached to the HT16K33, the second is the i2c selection jumper) The i2c selection address can be one of HT16K33_ADDR_01 to HT16K33_ADDR_08 */ HT16K33 led_backpack1 = HT16K33_INIT(1, HT16K33_ADDR_01); /* initialize the backpack */ rc = HT16K33_OPEN(&led_backpack1); /* power on the ht16k33 */ HT16K33_ON(&led_backpack1); /* make it shining bright */ HT16K33_BRIGHTNESS(&led_backpack1, 0x0F); /* make it not blinking */ HT16K33_BLINK(&led_backpack1, HT16K33_BLINK_OFF); /* power on the display */ HT16K33_DISPLAY(&led_backpack1, HT16K33_DISPLAY_ON); /* Say hello */ HT16K33_UPDATE_DIGIT(&led_backpack1, 0, 'H', 0); // first digit HT16K33_UPDATE_DIGIT(&led_backpack1, 1, 'E', 0); // second digit // turn off the colon sign in the middle of the 4 digits HT16K33_UPDATE_DIGIT(&led_backpack1, 2, HT16K33_COLON_OFF, 0); HT16K33_UPDATE_DIGIT(&led_backpack1, 3, '#', 0); // third digit HT16K33_UPDATE_DIGIT(&led_backpack1, 4, 'o', 0); // fourth digit HT16K33_COMMIT(&led_backpack1); // commit to the display memory // call this if you want to shut down the device (power saving mode) // HT16K33_OFF(&led_backpack1); /* close things (the display remains in the conditions left) */ HT16K33_CLOSE(&led_backpack1);
I decided to release the software with the liberal apache 2 license, so feel free to use this software inside your commercial, non free software / firmware.
Below you will find the files .c and .h that you can embed into your project.
It’s helpful for me, and I hope it will be helpful for you.
Ciao, Dino.
Note: on Raspberry PI OS (and debian) you need libi2c-dev (apt install libi2c-dev) before compiling.
gcc -Wall -O2 -o 7seg_bp_ada.o -c 7seg_bp_ada.c
gcc -Wall -O2 -o 7seg_bp_ada_test.o -c 7seg_bp_ada_test.c
gcc -Wall -O2 -o 7seg_bp_ada_test 7seg_bp_ada.o -li2c 7seg_bp_ada_test.o
Tonight at 03.00 GTM the NuvolaBase team publicly released the new NuvolaBase Dashboard.
As you may know, with NuvolaBase you can handle your private database on the cloud.
The new dashboard aims to be simple, stable and powerful. You can login using your google, twitter, facebook, linkedin account.
In the next days the NuvolaBase guys will release many new cool features like a powerful REST API to handle your databases in the cloud from your application.
This is the official article on the NuvolaBase blog: http://nuvolabase.blogspot.it/2012/12/nuvolabase-dashboard-upgrade.html
Congratulation to Luca Garulli and his dev team to the public release of OrientDB 1.0 Stable!
After a year of release candidates and bug fixing it’s finally time to the stable version.
Many may bugs fixed, new indexing algorithms, improved clustering with multi master replication, new Object Database interface with lazy object loading, new studio (web interface) and much more.
The community is growing fast and people get rapidly moving to new technologies.
Words like nosql, object and graph databases, cloud and mobile are big buzzwords of nowadays.
If you didn’t already, subscribe to the orientdb mailinglist to get in touch: http://groups.google.com/group/orient-database?pli=1.
Urgent Online Petitions to sign now and quicky!! Please wide spread!!
https://secure.avaaz.org/it/monti_save_our_internet/
In qualità di cittadini preoccupati, le chiediamo di fermare immediatamente tutte le iniziative del governo volte a dare all’Autorità per le Garanzie nelle Comunicazioni (AGCOM) il potere di censurare siti internet senza mandato del giudice. Le chiediamo inoltre di riaffermare pubblicamente che solo il Parlamento può approvare leggi che incidono sui nostri diritti fondamentali, inclusa la libertà di espressione, come affermato dalla Costituzione. Ci affidiamo a lei per proteggere la libertà di Internet in quanto pilastro fondamentale della nostra democrazia.
https://secure.avaaz.org/en/stop_cispa/
As concerned global citizens, we urge you to immediately drop the Cyber Intelligence Sharing and Protection Act (CISPA). Our democracy and civil liberties are under threat from the excessive and unnecessary Internet surveillance powers it grants. The Internet is a crucial tool for people around the world to exchange ideas and work collectively to build the world we all want. We urge you to show true global leadership and do all you can to protect our Internet freedom.
As previously said, nuvolabase.com is a great service that permits you to have a distributed nosql document database in the cloud. This is very cool: think each time you would had the need of a database always available in the cloud that you would access via simple HTTP/Rest queries. The possibilities are endless.
Here is a very simple but powerful PHP curl agent to submit commands (queries) to nuvolabase via HTTP.
<?php
/*
* Author: Dino Ciuffetti <dino@tuxweb.it>
* Object: Execute a remote query to a distributed database on nuvolabase.com (free account) using HTTP (OrientDB REST API)
*//* user configurable parameters */
$nuvolabasedb = ‘db$free$youruser$yourdb’;
$command = ‘select from yourclass’;
$user = ‘admin’;
$password = ‘qwerty’;
$useragent = “NuvolaBase PHP REST agent/v0.8 (compatible; Mozilla 4.0; MSIE 5.5; http://www.nuvolabase.com/)”;
/* END of user configurable parameters */$nuvolabasehost = ‘studio.nuvolabase.com’;
$url = ‘http://’.$user.’:’.$password.’@’.’studio.nuvolabase.com/command/’.$nuvolabasedb.’/sql/’;$ch = curl_init();
// set user agent
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);// return the result or false in case of errors
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);// set the target url
curl_setopt($ch, CURLOPT_URL, $url);// do basic login authentication
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);// howmany parameter to post
curl_setopt($ch, CURLOPT_POST, 1);// the post data to send
curl_setopt($ch, CURLOPT_POSTFIELDS, $command);// execute curl,fetch the result and close curl connection
$res = curl_exec ($ch);
curl_close ($ch);// display result
if ($res !== FALSE);
print_r (json_decode($res));?>
Please use the attached file.
London, UK – NuvolaBase Ltd is a London-based startup that is about to revolutionize the database market. Only two years ago this market was dominated by few big players such as Oracle, IBM and Microsoft. Something, in the last 24 months, has changed thanks to the “NoSQL” movement which focused on alternative solutions to the ordinary Relational DBMS’s due to the pressing and increasing demands for better performance and higher scalability.
Today the largest IT companies avail themselves of NoSQL solutions to manage Mission Critical projects. Google, Amazon, Microsoft, Facebook, Twitter, Disney, MTV, Craiglist and FourSquare are amongst the most famous ones.
After just a year of testing, NuvolaBase comes out of Alpha version, offering a NoSQL database of high performance as a cloud-based service. This way the database is no longer a software component that needs installing, configuring and maintaining, but it becomes a distributed service that is always available on the internet.
Web Site: http://www.nuvolabase.com
Follow us on Twitter: https://twitter.com/#!/nuvolabase
LinkedIn: http://www.linkedin.com/company/nuvolabase-ltd
I never said before on those pages that some months ago I migrated liborient to github: liborient project page.
For those who do not know liborient, it’s a LGPLv3 library that can be used by C programs to interact with the OrientDB DBMS Server using the orientdb binary protocol. At the time of this writing it’s in development stage, but almost all low level binary protocol methods are implemented and should be quite working.
After fixing some (well known) memory leaks on the new odocument interface, I’m now working on a high level API that can be used by C programs to manipulate objects going to and coming from OrientDB Server.
You can, for example, put or get records to/from the server containing different data type fields. Those fields are organized into an object that OrientDB calls Document. This Document can include structured types like: integers, shorts, dates, strings, binary, char, float, collections, maps, documents embedded into documents, and more.
The liborient’s new odocument higher level API should make you comfortable to access and manipulate this documents.
This can be, for example, a good starting point to create native bindings for other languages like PHP, python, perl, ruby, etc.
At the moment I am the author and the only developer on this project, but if you are brave you can join and submit patches, test the code, open bugs, put your considerations, and so on. Feel free to send me a mail, add a comment to this page, write to the orientdb mailing list, send me a tweet at @tuxweb, or anything else.
On Thu 20th, I’ll fly to London City, I have to accomplish a interesting task for the NuvolaBase project.
News will come.
Avaaz: “Vi invitiamo a votare contro l’approvazione del DDL Alfano e, quindi, salvaguardare i principi fondamentali stabiliti dalla nostra Costituzione, inclusa la libertà di informazione e il nostro diritto ad essere informati.”
Io credo che tutti debbano firmare. Se volete, potete farlo cliccando qui sotto:
http://www.avaaz.org/en/no_bavaglio_2/?wIJMBbb
28 Ott 11 Commenti moderati per default causa spammers
A causa dei soliti spammers maledetti (che Dio li fulmini quando cliccano su “invia”), ho dovuto abilitare la moderazione forzata dei commenti nel blog.
Ora siete contenti vero?
Filed in General news, Notes with 0 Comments