reflow-oven-control-sw/stm-firmware/include/reflow-controller/onewire-temp-sensors.h

52 lines
1.6 KiB
C
Raw Normal View History

/* Reflow Oven Controller
*
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
*
* This file is part of the Reflow Oven Controller Project.
*
* The reflow oven controller is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the reflow oven controller project.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stddef.h>
#include <stdint.h>
#ifndef __ONEWIRE_TEMP_SENSORS_H__
#define __ONEWIRE_TEMP_SENSORS_H__
#define ONEWIRE_TEMP_PORT GPIOB
#define ONEWIRE_TEMP_RCC_MASK RCC_AHB1ENR_GPIOBEN
#define ONEWIRE_TEMP_TX_PIN 10U
#define ONEWIRE_TEMP_RX_PIN 11U
#define ONEWIRE_TEMP_AF_NUM 7U
#define ONEWIRE_UART_DEV USART3
enum onewire_temp_resolution {RES_8BIT, RES_12BIT};
void onewire_temp_sensors_setup_hw();
/**
* @brief onewire_temp_sensors_discover
* @param id_list
* @param list_len
* @return Negative: error, >= 0: amount of discovered sensors
*/
int onewire_temp_sensors_discover(uint64_t *id_list, size_t list_len);
int onewire_temp_sensor_config(uint64_t id, enum onewire_temp_resolution resolution);
float onewire_temp_sensor_read_temp(uint64_t id);
#endif /* __ONEWIRE_TEMP_SENSORS_H__ */