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:
Mon Oct 02 23:39:33 2017 +0000
Revision:
3:6ca4d7dd8bea
Parent:
2:4b7f5a060c22
mcp7940 (i2c rtc) bugs fixed; pwm added

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rmaalmeida 2:4b7f5a060c22 1 #include "i2c.h"
rmaalmeida 2:4b7f5a060c22 2 #include "mcp7940n.h"
rmaalmeida 2:4b7f5a060c22 3
rmaalmeida 2:4b7f5a060c22 4 //endere�o do dispositivo, deslocado por causa do bit de RW
rmaalmeida 3:6ca4d7dd8bea 5 //1101000 (0x6f<<1)
rmaalmeida 3:6ca4d7dd8bea 6 #define MCP7940N_CTRL_ID (0xde)
rmaalmeida 2:4b7f5a060c22 7 #define I2C_WRITE 0
rmaalmeida 2:4b7f5a060c22 8 #define I2C_READ 1
rmaalmeida 2:4b7f5a060c22 9
rmaalmeida 2:4b7f5a060c22 10 int dec2bcd(int value) {
rmaalmeida 2:4b7f5a060c22 11 return ((value / 10 * 16) + (value % 10));
rmaalmeida 2:4b7f5a060c22 12 }
rmaalmeida 2:4b7f5a060c22 13 int bcd2dec(int value) {
rmaalmeida 2:4b7f5a060c22 14 return ((value / 16 * 10) + (value % 16));
rmaalmeida 2:4b7f5a060c22 15 }
rmaalmeida 2:4b7f5a060c22 16 void mcpInit(void) {
rmaalmeida 2:4b7f5a060c22 17 i2cInit();
rmaalmeida 2:4b7f5a060c22 18 }
rmaalmeida 2:4b7f5a060c22 19 void mcpStartClock(void) {
rmaalmeida 2:4b7f5a060c22 20 int seconds;
rmaalmeida 2:4b7f5a060c22 21 seconds = mcpReadData(SEC);
rmaalmeida 3:6ca4d7dd8bea 22 mcpWriteData(0x80 | seconds,SEC);
rmaalmeida 2:4b7f5a060c22 23 return;
rmaalmeida 2:4b7f5a060c22 24 }
rmaalmeida 2:4b7f5a060c22 25 void mcpWriteData(unsigned char value, int address) {
rmaalmeida 2:4b7f5a060c22 26 i2cWriteByte(1,0, MCP7940N_CTRL_ID |I2C_WRITE);
rmaalmeida 2:4b7f5a060c22 27 i2cWriteByte(0,0,address);
rmaalmeida 2:4b7f5a060c22 28 i2cWriteByte(0,1,value);
rmaalmeida 2:4b7f5a060c22 29 }
rmaalmeida 2:4b7f5a060c22 30 int mcpReadData(int address) {
rmaalmeida 2:4b7f5a060c22 31 int result;
rmaalmeida 2:4b7f5a060c22 32 i2cWriteByte(1,0,MCP7940N_CTRL_ID | I2C_WRITE);
rmaalmeida 2:4b7f5a060c22 33 i2cWriteByte(0,0,address);
rmaalmeida 2:4b7f5a060c22 34 i2cWriteByte(1,0, MCP7940N_CTRL_ID | I2C_READ);
rmaalmeida 2:4b7f5a060c22 35 result = i2cReadByte(1,1 );
rmaalmeida 2:4b7f5a060c22 36 return result;
rmaalmeida 2:4b7f5a060c22 37 }