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

Revision:
2:4b7f5a060c22
Child:
3:6ca4d7dd8bea
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mcp7940n.cpp	Sun Oct 01 19:30:04 2017 +0000
@@ -0,0 +1,37 @@
+#include "i2c.h"
+#include "mcp7940n.h"
+
+//endere�o do dispositivo, deslocado por causa do bit de RW
+//1101000
+#define MCP7940N_CTRL_ID (0x6e<<1)
+#define I2C_WRITE 0
+#define I2C_READ  1
+
+int dec2bcd(int value) {
+    return ((value / 10 * 16) + (value % 10));
+}
+int bcd2dec(int value) {
+    return ((value / 16 * 10) + (value % 16));
+}
+void mcpInit(void) {
+    i2cInit();
+}
+void mcpStartClock(void) {
+    int seconds;
+    seconds = mcpReadData(SEC);
+    mcpWriteData(0x7f & seconds,SEC);
+    return;
+}
+void mcpWriteData(unsigned char value, int address) {
+    i2cWriteByte(1,0, MCP7940N_CTRL_ID |I2C_WRITE);
+    i2cWriteByte(0,0,address);
+    i2cWriteByte(0,1,value);
+}
+int mcpReadData(int address) {
+    int result;
+    i2cWriteByte(1,0,MCP7940N_CTRL_ID  | I2C_WRITE);
+    i2cWriteByte(0,0,address);
+    i2cWriteByte(1,0, MCP7940N_CTRL_ID  | I2C_READ);
+    result = i2cReadByte(1,1 );
+    return result;
+}