Pão de Queijo Development Board. This repo has all libraries from pqdb shield.

Dependents:   pqdb_demo

Pão de Queijo development board is a shield for add-on on any arduino compatible board.

/media/uploads/rmaalmeida/compatibilidade_branco.png

This project presents the libraries to control the board peripherals using mbed framework. The libraries works as interfaces to keep the main code compatible with the examples from the book "Programação de sistemas embarcados". The peripherals on the board are presented on the folowing picture

/media/uploads/rmaalmeida/pqdb_perifericos.png

The main objective of the project is to develop a low cost, easy to assemble board with a group of peripheral that allows one to start learning embedded systems. The board was routed on one side copper PCB to make easier to buid it yourself.

/media/uploads/rmaalmeida/pqdb_fenolite_-_cortada.png

The source code for Arduino boards (wiring) can be found on: https://github.com/projetopqdb/PQDB-Arduino

The source code for freedom frdm KL05 board (using direct register access) can be found on: https://github.com/projetopqdb/PQDB-KL05Z

The source code from the board schematics and layout can be found on: https://github.com/projetopqdb/PQDB-Hardware

Committer:
rmaalmeida
Date:
Sun Oct 01 19:30:04 2017 +0000
Revision:
2:4b7f5a060c22
Added soft I2C driver and interfaces to ds1307 and mcp7940n (both I2C realtime clocks)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rmaalmeida 2:4b7f5a060c22 1 #include "i2c.h"
rmaalmeida 2:4b7f5a060c22 2 #include "ds1307.h"
rmaalmeida 2:4b7f5a060c22 3
rmaalmeida 2:4b7f5a060c22 4 //endere�o do dispositivo, deslocado por causa do bit de RW
rmaalmeida 2:4b7f5a060c22 5 #define DS1307_CTRL_ID (0x68<<1)
rmaalmeida 2:4b7f5a060c22 6 #define I2C_WRITE 0
rmaalmeida 2:4b7f5a060c22 7 #define I2C_READ 1
rmaalmeida 2:4b7f5a060c22 8
rmaalmeida 2:4b7f5a060c22 9 int dsdec2bcd(int value) {
rmaalmeida 2:4b7f5a060c22 10 return ((value / 10 * 16) + (value % 10));
rmaalmeida 2:4b7f5a060c22 11 }
rmaalmeida 2:4b7f5a060c22 12 int dsbcd2dec(int value) {
rmaalmeida 2:4b7f5a060c22 13 return ((value / 16 * 10) + (value % 16));
rmaalmeida 2:4b7f5a060c22 14 }
rmaalmeida 2:4b7f5a060c22 15 void dsInit(void) {
rmaalmeida 2:4b7f5a060c22 16 i2cInit();
rmaalmeida 2:4b7f5a060c22 17 }
rmaalmeida 2:4b7f5a060c22 18 void dsStartClock(void) {
rmaalmeida 2:4b7f5a060c22 19 int seconds;
rmaalmeida 2:4b7f5a060c22 20 seconds = dsReadData(SEC);
rmaalmeida 2:4b7f5a060c22 21 dsWriteData(0x7f & seconds,SEC);
rmaalmeida 2:4b7f5a060c22 22 return;
rmaalmeida 2:4b7f5a060c22 23 }
rmaalmeida 2:4b7f5a060c22 24 void dsWriteData(unsigned char value, int address) {
rmaalmeida 2:4b7f5a060c22 25 i2cWriteByte(1,0, DS1307_CTRL_ID|I2C_WRITE);
rmaalmeida 2:4b7f5a060c22 26 i2cWriteByte(0,0,address);
rmaalmeida 2:4b7f5a060c22 27 i2cWriteByte(0,1,value);
rmaalmeida 2:4b7f5a060c22 28 }
rmaalmeida 2:4b7f5a060c22 29 int dsReadData(int address) {
rmaalmeida 2:4b7f5a060c22 30 int result;
rmaalmeida 2:4b7f5a060c22 31 i2cWriteByte(1,0,DS1307_CTRL_ID | I2C_WRITE);
rmaalmeida 2:4b7f5a060c22 32 i2cWriteByte(0,0,address);
rmaalmeida 2:4b7f5a060c22 33 i2cWriteByte(1,0, DS1307_CTRL_ID | I2C_READ);
rmaalmeida 2:4b7f5a060c22 34 result = i2cReadByte(1,1 );
rmaalmeida 2:4b7f5a060c22 35 return result;
rmaalmeida 2:4b7f5a060c22 36 }