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:
Tue Oct 03 01:27:24 2017 +0000
Revision:
6:3fb450ba1e95
Parent:
0:32fded6e1775
timer driver added

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rmaalmeida 0:32fded6e1775 1 //#include "io.h"
rmaalmeida 0:32fded6e1775 2 #include "ad.h"
rmaalmeida 0:32fded6e1775 3 //#include "derivative.h"
rmaalmeida 0:32fded6e1775 4 #include "mbed.h"
rmaalmeida 0:32fded6e1775 5
rmaalmeida 0:32fded6e1775 6 AnalogIn POT(A2);
rmaalmeida 0:32fded6e1775 7 AnalogIn LDR(A1);
rmaalmeida 0:32fded6e1775 8 AnalogIn TEMP(A0);
rmaalmeida 0:32fded6e1775 9
rmaalmeida 0:32fded6e1775 10 void adInit(void) {
rmaalmeida 0:32fded6e1775 11 /* // Habilita o clock para o conversor
rmaalmeida 0:32fded6e1775 12 SIM_SCGC6 |= SIM_SCGC6_ADC0_MASK;
rmaalmeida 0:32fded6e1775 13 //configura o sistema de convers�o: velocidade e modo de disparo
rmaalmeida 0:32fded6e1775 14 ADC0_CFG1 = ADC_CFG1_ADIV(2) | ADC_CFG1_MODE(1) | ADC_CFG1_ADLSMP_MASK | ADC_CFG1_ADICLK(1);
rmaalmeida 0:32fded6e1775 15 //Configura terminal 8 da porta B como entrada anal�gica canal 11
rmaalmeida 0:32fded6e1775 16 PORTB_BASE_PTR ->PCR[8] = (PORT_PCR_MUX(0) | PORT_PCR_DSE_MASK);
rmaalmeida 0:32fded6e1775 17 bitSet(PTB_BASE_PTR ->PDDR, 8);
rmaalmeida 0:32fded6e1775 18 //Configura terminal 9 da porta B como entrada anal�gica canal 10
rmaalmeida 0:32fded6e1775 19 PORTB_BASE_PTR ->PCR[9] = (PORT_PCR_MUX(0) | PORT_PCR_DSE_MASK);
rmaalmeida 0:32fded6e1775 20 bitSet(PTB_BASE_PTR ->PDDR, 9);
rmaalmeida 0:32fded6e1775 21 //Configura terminal 8 da porta A como entrada anal�gica canal 3
rmaalmeida 0:32fded6e1775 22 PORTA_BASE_PTR ->PCR[8] = (PORT_PCR_MUX(0) | PORT_PCR_DSE_MASK);
rmaalmeida 0:32fded6e1775 23 bitSet(PTA_BASE_PTR ->PDDR, 8);
rmaalmeida 0:32fded6e1775 24 */
rmaalmeida 0:32fded6e1775 25 }
rmaalmeida 0:32fded6e1775 26 int adRead(int channel) {
rmaalmeida 0:32fded6e1775 27 //Primeiro configura o canal correto
rmaalmeida 0:32fded6e1775 28 //isso j� inicializa a convers�o.
rmaalmeida 0:32fded6e1775 29
rmaalmeida 0:32fded6e1775 30 if (channel == 2) {
rmaalmeida 0:32fded6e1775 31 return POT.read_u16();
rmaalmeida 0:32fded6e1775 32 //ADC0_SC1A = 11;
rmaalmeida 0:32fded6e1775 33 }
rmaalmeida 0:32fded6e1775 34 if (channel == 1) {
rmaalmeida 0:32fded6e1775 35 //ADC0_SC1A = 10;
rmaalmeida 0:32fded6e1775 36 return LDR.read_u16();
rmaalmeida 0:32fded6e1775 37 }
rmaalmeida 0:32fded6e1775 38 if (channel == 0) {
rmaalmeida 0:32fded6e1775 39 //ADC0_SC1A = 3;
rmaalmeida 0:32fded6e1775 40 return TEMP.read_u16();
rmaalmeida 0:32fded6e1775 41 }
rmaalmeida 0:32fded6e1775 42 //aguarda a convers�o
rmaalmeida 0:32fded6e1775 43 //while ((ADC0_SC1A & ADC_SC1_COCO_MASK) == 0);
rmaalmeida 0:32fded6e1775 44 //retorna o valor convertido
rmaalmeida 0:32fded6e1775 45 // return ADC0_RA;
rmaalmeida 0:32fded6e1775 46 return -1;
rmaalmeida 0:32fded6e1775 47
rmaalmeida 0:32fded6e1775 48 }