39 lines
1.3 KiB
C
39 lines
1.3 KiB
C
/*
|
||
* 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
|