Started on DS18B20 and PMS5003

Didn't realise DS18B20 was 1-Wire

Will probably just find a library for that one - can't be arsed
doing more bit banging
This commit is contained in:
2023-11-01 21:12:39 +00:00
parent 8aeade9922
commit 2b117b4b33
8 changed files with 132 additions and 46 deletions

View File

@@ -3,13 +3,23 @@ menu "PMS5003"
bool "PMS5003 Enabled"
default y
config PMS5003_UART
int "PMS5003 UART Port"
default 1
config PMS5003_UART_PORT
int "PMS5003 UART PORT"
default 0
depends on PMS5003_ENABLED
config PMS5003_UART_TX
int "PMS5003 UART Tx GPIO Pin"
default 4
depends on PMS5003_ENABLED
config PMS5003_UART_RX
int "PMS5003 UART Rx GPIO Pin"
default 5
depends on PMS5003_ENABLED
config PMS5003_PERIOD_POLL
int "Period to poll the PMS5003 in ms"
default 8000
int "Period to poll the PMS5003 in seconds"
default 8
depends on PMS5003_ENABLED
endmenu
endmenu

View File

@@ -1,4 +1,29 @@
int test() {
int i = 5;
return i;
#include "pms5003.h"
#include "driver/uart.h"
#include "hal/uart_types.h"
#define START_CHAR_1 0x42
#define START_CHAR_2 0x4d
#define DEFAULT_BAUD 9600
static const char* TAG = "PMS5003";
pms5003_err pms5003_init() {
const uart_port_t uart_num = CONFIG_PMS5003_UART_PORT;
uart_set_pin(uart_num, CONFIG_PMS5003_UART_TX, CONFIG_PMS5003_UART_RX, -1, -1);
uart_config_t uart_config = {
.baud_rate = DEFAULT_BAUD,
.data_bits = UART_DATA_8_BITS,
.parity = UART_PARITY_DISABLE,
.stop_bits = UART_STOP_BITS_1,
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
.rx_flow_ctrl_thresh = 122,
};
return PMS5003_OK;
}
pms5003_err pms5003_read(void) {
return PMS5003_OK;
}

View File

@@ -0,0 +1,5 @@
#pragma once
typedef enum { PMS5003_OK } pms5003_err;
pms5003_err pms5003_read(void);