33 lines
903 B
C
33 lines
903 B
C
#include "pms5003.h"
|
|
#include "hardware/uart.h"
|
|
#include "pico/stdlib.h"
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
|
|
/**
|
|
Lib for Plantower PMS5003 Particulate Matter (PM) Sensor
|
|
|
|
Detects PM1, PM2.5, PM10 particulates
|
|
|
|
Sourcces:
|
|
-
|
|
https://shop.pimoroni.com/products/pms5003-particulate-matter-sensor-with-cable
|
|
- https://github.com/pimoroni/pms5003-python/blob/main/pms5003/__init__.py
|
|
- https://github.com/vogelrh/pms5003c/tree/master
|
|
*/
|
|
|
|
void pms5003_init(pms5003_config *new_config, uart_inst_t *uart, uint8_t tx_pin,
|
|
uint8_t rx_pin) {
|
|
uart_init(uart, 9600);
|
|
gpio_set_function(tx_pin, UART_FUNCSEL_NUM(uart, tx_pin));
|
|
gpio_set_function(rx_pin, UART_FUNCSEL_NUM(uart, rx_pin));
|
|
new_config->uart = uart;
|
|
}
|
|
|
|
pms5003_reading pms5003_read(pms5003_config *config) {
|
|
pms5003_reading reading;
|
|
reading.pm1 = 0;
|
|
reading.pm2_5 = 0;
|
|
reading.pm10 = 0;
|
|
return reading;
|
|
}
|