stm32f1/lib/usart_ir.h

33 lines
1.4 KiB
C

/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/* Copyright (c) 2016 King Kévin <kingkevin@cuvoodoo.info> */
/* this library handles USART communication over pulse coded InfraRed transmission */
/* peripherals used: USART, timer (check source for details) */
#pragma once
/* show the user how much data has been received and is available */
extern volatile uint8_t usart_ir_received;
/* setup USART/IR peripheral */
void usart_ir_setup(void);
/* put character on USART/IR (blocking) */
void usart_ir_putchar_blocking(char c);
/* ensure all data has been transmitted (blocking) */
void usart_ir_flush(void);
/* get character from USART/IR (blocking) */
char usart_ir_getchar(void);
/* put character on USART/IR (non-blocking until buffer is full) */
void usart_ir_putchar_nonblocking(char c);