34 lines
772 B
C
Executable File
34 lines
772 B
C
Executable File
#ifndef __SERIAL__H
|
|
#define __SERIAL__H
|
|
|
|
|
|
#include "stm32f10x.h"
|
|
#include <stdint.h>
|
|
|
|
// Typy
|
|
//struktura
|
|
typedef struct USART_data_s
|
|
{
|
|
uint8_t *rxbuf,*txbuf;
|
|
uint8_t *dptr;
|
|
uint8_t status;
|
|
}USART_data_t;
|
|
|
|
//Stałe
|
|
|
|
//długość buforów wejściowych
|
|
#define USART_BSIZE 256
|
|
|
|
#define USART1_DR_Address (USART1_BASE + 0x4)
|
|
#define USART2_DR_Address (USART2_BASE + 0x4)
|
|
#define USART3_DR_Address (USART3_BASE + 0x4)
|
|
|
|
//Funkcje
|
|
|
|
int8_t Serial_Initialize(USART_TypeDef *port, uint32_t mode, uint32_t baudrate, uint32_t timeguard);
|
|
int8_t Serial_Ready(USART_TypeDef *port);
|
|
int32_t Serial_Send(USART_TypeDef *port, uint8_t *data, uint16_t len);
|
|
int32_t Serial_Receive(USART_TypeDef *port, uint8_t *user_buffer, uint16_t len);
|
|
#endif
|
|
|