Start implementation of onewire temperature sensor interface

This commit is contained in:
2020-02-24 20:02:37 +01:00
parent 26b8ad852e
commit 1ef7713351
6 changed files with 84 additions and 2 deletions

View File

@@ -23,7 +23,9 @@
#include <stm-periph/uart.h>
int onewire_if_init_uart(struct stm_uart *uart);
int onewire_if_init_uart(struct stm_uart *uart, uint32_t brr_val, USART_TypeDef *onewire_uart, volatile uint32_t *rcc_reg, uint8_t rcc_bit_num);
void onewire_if_disable(struct stm_uart *uart);
int onewire_if_send_byte(struct stm_uart *uart);

View File

@@ -18,8 +18,30 @@
* 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
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(uint32_t *id_list, size_t list_len);
float onewire_temp_sensor_read_temp(uint32_t id);
#endif /* __ONEWIRE_TEMP_SENSORS_H__ */