Arcadie Cracan
/
solder_oven
Reflow solder oven control loop.
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "ili9328.h" 00003 00004 SPI device(NC, PC_11, PC_10); 00005 DigitalOut cs(PC_12); 00006 Serial pc(USBTX, USBRX); 00007 00008 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 00009 ILI9328_LCD lcd(PB_10, PB_12, PB_13, PB_14, &dataBus); 00010 00011 float readTempSensor(); 00012 00013 int main() { 00014 cs = 1; 00015 pc.printf("Hello...\n"); 00016 00017 // initialize display - place it in standard portrait mode and set background to black and 00018 // foreground to white color. 00019 lcd.Initialize(); 00020 // set current font to the smallest 8x12 pixels font. 00021 lcd.SetFont( &TerminusFont ); 00022 // print something on the screen 00023 00024 while(1) { 00025 //wait(1.0f); 00026 //pc.printf("Temperature: %f\n", readTempSensor()); 00027 lcd.Print( "Hello, World!", CENTER, 25 ); // align text to center horizontally and use starndard colors 00028 } 00029 } 00030 00031 float readTempSensor() 00032 { 00033 cs = 0; 00034 uint8_t byte; 00035 int result = 0; 00036 wait_us(1); 00037 for (int i = 0; i < 4; i++) { 00038 byte = device.write(0); 00039 result = (result << 8) | byte; 00040 } 00041 cs = 1; 00042 return (result >> 18) / 4.0f; 00043 }
Generated on Thu Jul 14 2022 22:44:45 by 1.7.2