Question.4
A developer creates three UART driver instances:
class UART {
volatile uint32_t* base_addr;
uint32_t baud;
public:
UART(uint32_t addr, uint32_t b) : base_addr((uint32_t*)addr), baud(b) {}
void send(uint8_t byte) { /* write to base_addr */ }
};
UART uart1(0x40011000, 9600);
UART uart2(0x40004400, 115200);
UART uart3(0x40004800, 57600);How does this compare to the C approach of passing UART_Handle_t* to every function?