61 lines
815 B
C
61 lines
815 B
C
|
/*
|
||
|
* usart1.h
|
||
|
*
|
||
|
* Created on: Dec 25, 2023
|
||
|
* Author: Francesco Gritti
|
||
|
|
||
|
|
||
|
===== EXAMPLE USAGE ======================
|
||
|
|
||
|
int main(void) {
|
||
|
|
||
|
clock_config();
|
||
|
USART1_init (115200);
|
||
|
|
||
|
__enable_irq();
|
||
|
|
||
|
while (1) {
|
||
|
|
||
|
flib_printf ("USART demo\n");
|
||
|
HAL_Delay(1000);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
void USART1_rxCallback (void) {
|
||
|
// echo back received characters
|
||
|
char c;
|
||
|
while (USART1_getch (&c)){
|
||
|
USART1_putch (c);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
*/
|
||
|
|
||
|
#ifndef USART1_h
|
||
|
#define USART1_h
|
||
|
|
||
|
|
||
|
#include "ftypes.h"
|
||
|
|
||
|
|
||
|
|
||
|
void USART1_init (u64 baudrate);
|
||
|
void USART1_disable (void);
|
||
|
void USART1_enable (void);
|
||
|
void USART1_putch (char c);
|
||
|
void USART1_puts (const char * s);
|
||
|
void USART1_nputs (const char * s, u16 i);
|
||
|
void USART1_flush ();
|
||
|
void USART1_rxCallback (void);
|
||
|
|
||
|
|
||
|
u8 USART1_getch (char * c);
|
||
|
u16 USART1_available (void);
|
||
|
|
||
|
|
||
|
|
||
|
#endif /* USART1_h */
|