Files
templates/c/ds18b20-ds2480/ports/stm32f4/ds2480_stm32f4_hal.h

39 lines
1.3 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* UART-порт DS2480B для STM32F4. Подготовка линии и очистка ошибок USART отделены от команд
* датчика; после сбоя обмена мост должен пройти предусмотренное восстановление до продолжения
* работы с 1-Wire.
*/
#ifndef DS2480_STM32F4_HAL_H
#define DS2480_STM32F4_HAL_H
#include "ds2480.h"
#include "stm32f4xx_hal.h"
#ifdef __cplusplus
extern "C" {
#endif
/** Dedicated UART initialized by the board (clock, RX/TX AF, no IRQ/DMA).
* tx_port/pin/alternate let prepare generate a real >=2 ms BREAK, including
* recovery from a lost strong-pullup response. No reset pin is required.
* GPIO clock must stay enabled. UART must not be used by any other service.
*/
typedef struct {
UART_HandleTypeDef *uart;
GPIO_TypeDef *tx_port;
uint16_t tx_pin;
uint32_t tx_alternate;
} ds2480_stm32f4_hal;
/** Populate callbacks only; call ds2480_init afterwards to reset/calibrate.
* Thread/main-loop use only, with running HAL tick and interrupts enabled.
* UART baud rate is fixed at 9600 8N1; all transfers are single-byte.
*/
ds2480_status ds2480_stm32f4_hal_bind(ds2480_stm32f4_hal *context, ds2480_port *port);
#ifdef __cplusplus
}
#endif
#endif