Subsection 3.4.1 The Header File: uart.h
The header declares the three public functions the driver exposes. Everything else in
uart.c is an implementation detail hidden from the rest of the project.
// uart.h - USART2 driver interface for ENGS 28
#ifndef UART_H
#define UART_H
void uart2_init(void); // configure USART2 for 9600 8N1, PA2=TX, PA3=RX
void uart2_write(int ch); // transmit one byte (blocking)
int uart2_read(void); // receive one byte (blocking)
#endif // UART_H
Notice that
printf is not listed here. It comes from the C standard library. The driver connects printf to the UART via a retarget layer, described at the end of uart.c below.
