Reflow solder oven control loop.

Dependencies:   TFTLCD mbed

Committer:
acracan
Date:
Sun Jun 28 11:28:04 2015 +0000
Revision:
0:43f238e2103e
First commit.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
acracan 0:43f238e2103e 1 #include "mbed.h"
acracan 0:43f238e2103e 2 #include "ili9328.h"
acracan 0:43f238e2103e 3
acracan 0:43f238e2103e 4 SPI device(NC, PC_11, PC_10);
acracan 0:43f238e2103e 5 DigitalOut cs(PC_12);
acracan 0:43f238e2103e 6 Serial pc(USBTX, USBRX);
acracan 0:43f238e2103e 7
acracan 0:43f238e2103e 8 BusOut dataBus(PA_5, PA_6, PA_7, PA_8, PA_9, PA_10, PA_11, PA_12, PB_1, PB_2, PB_3, PB_4, PB_5, PB_6, PB_8, PB_9); // 16 pins
acracan 0:43f238e2103e 9 ILI9328_LCD lcd(PB_10, PB_12, PB_13, PB_14, &dataBus);
acracan 0:43f238e2103e 10
acracan 0:43f238e2103e 11 float readTempSensor();
acracan 0:43f238e2103e 12
acracan 0:43f238e2103e 13 int main() {
acracan 0:43f238e2103e 14 cs = 1;
acracan 0:43f238e2103e 15 pc.printf("Hello...\n");
acracan 0:43f238e2103e 16
acracan 0:43f238e2103e 17 // initialize display - place it in standard portrait mode and set background to black and
acracan 0:43f238e2103e 18 // foreground to white color.
acracan 0:43f238e2103e 19 lcd.Initialize();
acracan 0:43f238e2103e 20 // set current font to the smallest 8x12 pixels font.
acracan 0:43f238e2103e 21 lcd.SetFont( &TerminusFont );
acracan 0:43f238e2103e 22 // print something on the screen
acracan 0:43f238e2103e 23
acracan 0:43f238e2103e 24 while(1) {
acracan 0:43f238e2103e 25 //wait(1.0f);
acracan 0:43f238e2103e 26 //pc.printf("Temperature: %f\n", readTempSensor());
acracan 0:43f238e2103e 27 lcd.Print( "Hello, World!", CENTER, 25 ); // align text to center horizontally and use starndard colors
acracan 0:43f238e2103e 28 }
acracan 0:43f238e2103e 29 }
acracan 0:43f238e2103e 30
acracan 0:43f238e2103e 31 float readTempSensor()
acracan 0:43f238e2103e 32 {
acracan 0:43f238e2103e 33 cs = 0;
acracan 0:43f238e2103e 34 uint8_t byte;
acracan 0:43f238e2103e 35 int result = 0;
acracan 0:43f238e2103e 36 wait_us(1);
acracan 0:43f238e2103e 37 for (int i = 0; i < 4; i++) {
acracan 0:43f238e2103e 38 byte = device.write(0);
acracan 0:43f238e2103e 39 result = (result << 8) | byte;
acracan 0:43f238e2103e 40 }
acracan 0:43f238e2103e 41 cs = 1;
acracan 0:43f238e2103e 42 return (result >> 18) / 4.0f;
acracan 0:43f238e2103e 43 }