0

I'm having a hard time understanding how the Arduino libraries are defining the address for accessing the registers of the USART modules.

I cant find definition for udr(pointer) as used in the delegated constructor for Hardware Serial. So how does the class gets the underlying address? And what type of declaration is this?

HardwareSerial::HardwareSerial(
 volatile uint8_t *ubrrh, volatile uint8_t *ubrrl,
 volatile uint8_t *ucsra, volatile uint8_t *ucsrb,
 volatile uint8_t *ucsrc, volatile uint8_t *udr) :
 _ubrrh(ubrrh), _ubrrl(ubrrl),
 _ucsra(ucsra), _ucsrb(ucsrb), _ucsrc(ucsrc),
 _udr(udr),
 _rx_buffer_head(0), _rx_buffer_tail(0),
 _tx_buffer_head(0), _tx_buffer_tail(0)
{
}
asked Dec 10, 2017 at 18:41

1 Answer 1

0

It is handed the addresses when the object is constrcted:

 HardwareSerial Serial(&UBRRH, &UBRRL, &UCSRA, &UCSRB, &UCSRC, &UDR);

&UDR is passed as *udr. That is then assigned to _udr in the initialiser list.

answered Dec 10, 2017 at 18:43

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.