Mateo Jiménez Santacruz
/
Proyecto
Código sensor para material particulado con PMS 5003
Revision 1:5bc605d2b8f8, committed 2021-10-28
- Comitter:
- sebastianrestrepo
- Date:
- Thu Oct 28 21:55:43 2021 +0000
- Parent:
- 0:d5dc1e5564a5
- Child:
- 2:e80f510b3cb2
- Commit message:
- Programa Sensor Pantalla Funcional
Changed in this revision
DmTftLibrary.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DmTftLibrary.lib Thu Oct 28 21:55:43 2021 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/displaymodule/code/DmTftLibrary/#2db7065edbec
--- a/main.cpp Thu Oct 28 21:22:35 2021 +0000 +++ b/main.cpp Thu Oct 28 21:55:43 2021 +0000 @@ -1,7 +1,49 @@ #include "PMS5003.h" +//#include "DmTftHX8353C.h" +//#include "DmTftS6D0164.h" +//#include "DmTftIli9325.h" +#include "DmTftIli9341.h" +#include "DmTftSsd2119.h" +#include "DmTftRa8875.h" +#include "DmTouch.h" +#include "DmTpFt6x06.h" + +//#define log(...) printf(__VA_ARGS__) +#define log(...) + +/* Displays without adapter */ +#define DM_PIN_SPI_MOSI D11 +#define DM_PIN_SPI_MISO D12 +#define DM_PIN_SPI_SCK D13 +#define DM_PIN_CS_TOUCH D4 +#define DM_PIN_CS_TFT D10 +#define DM_PIN_CS_SDCARD D8 +#define DM_PIN_CS_FLASH D6 +/****************************************************************************** + * Local variables + *****************************************************************************/ + +/********* TFT DISPLAY INIT *********/ +DmTftIli9341 tft(D10, D9, D11, D12, D13); /* DmTftIli9341(PinName cs, PinName dc, PinName mosi, PinName miso, PinName clk) DM_TFT28_105 and DM_TFT28_116*/ +DmTouch touch(DmTouch::DM_TFT28_105, D11, D12, D13); + +DigitalInOut csTouch(DM_PIN_CS_TOUCH, PIN_OUTPUT, PullUp, 1); +DigitalInOut csDisplay(DM_PIN_CS_TFT, PIN_OUTPUT, PullUp, 1); +DigitalInOut csSDCard(DM_PIN_CS_SDCARD, PIN_OUTPUT, PullUp, 1); +#ifdef DM_PIN_CS_FLASH + DigitalInOut csFlash(DM_PIN_CS_FLASH, PIN_OUTPUT, PullUp, 1); +#endif +/********* SENSOR INIT *********/ PMS5003 pm25(D1, D0, D3); // UART TX, UART RX, POWER +/****************************************************************************** + * Global variables + *****************************************************************************/ + +/****************************************************************************** + * Local functions + *****************************************************************************/ static EventQueue queue; // The callback from the driver is triggered from IRQ, use EventQueue to debounce to normal context void pm25_data_callback(pms5003_data_t data) { @@ -25,8 +67,29 @@ printf("---------------------------------------\n"); } +/****************************************************************************** + * Main + *****************************************************************************/ + + + + int main() { //printf("Bienvenido"); + log("init tft \r\n"); + tft.init(); + +// uint16_t x = 0; +// uint16_t y = 0; + uint16_t w = tft.width(); + uint16_t h = tft.height(); + +// bool down = false; +// bool lastDown = false; + tft.setTextColor(0xFFFF,0xF81F); + tft.drawString(35, 30, "Cantidad de particulas :( "); + tft.drawString(70, 100, "Pm 2.5: "); + tft.drawString(70, 150, "Pm 1.0: "); // This callback runs in an interrupt context, thus we debounce to the event queue here pm25.enable(queue.event(&pm25_data_callback));