Struct rustduino::atmega2560p::com::usart_initialize::UsartObject [−][src]
Expand description
Contains the Usart as a Raw Pointer along with it’s name. This controls a USART as a object for careful implementation.
Fields
usart: *mut Usartname: UsartNumImplementations
Can be use to initialize with given baud rate and remaining settings will be set to default.
Arguments
baud1- a i64, the baud rate of USART the user wants to set.
Enables the Transmitter, once it is enabled it takes control of the TXDn pin as a transmitting output.
Storing data in Transmit Buffer.
Arguments
data- a u32, the data to be transmitted.len- aUsartDataSizeobject, which contains the length of data frame of USART.
Checks that transmission buffer if ready for transmission.
Returns
a boolean- Which is true if ready otherwise false.
This waits for the transmission to complete by checking the appropriate register.
This is used to disable the Transmitter and once disabled the pins used for USART return into their default I/O pin mode.
Sends a character byte of 5,6,7 or 8 bits.
Arguments
data- a u8, consisting of the current data frame to send from USART.
Send’s data of type string byte by byte using USART.
Arguments
data- a static string object, which is to be transmitted using USART.
Send’s data of type integer(u32) byte by byte.
Arguments
data- a u32, which is to be transmitted using USART.
Send’s data of type float(f64) byte by byte till the precision required.
Arguments
data- a f32, which is to be transmitted using USART.precision- a u32, the number of decimal precision required in the transmission.
Disable global interrupts for smooth non-interrupted functioning of USART.
Set clock polarity mode according to input from user.
Arguments
mode- aUsartPolarityobject, which will be set for the USART.
Set’s various modes of the USART which is activated.
Arguments
mode- aUsartModesobject, which will be set for the USART.
Set’s the power reduction register so that USART functioning is allowed.
Arguments
num- aUsartNumobject, for which the power configurations of the USART will be set.
Set the appropriate bits for flushing out transmission and recieval.
pub unsafe fn initialize(
&mut self,
mode: UsartModes,
baud: i64,
stop: UsartStop,
size: UsartDataSize,
parity: UsartParity
)
pub unsafe fn initialize(
&mut self,
mode: UsartModes,
baud: i64,
stop: UsartStop,
size: UsartDataSize,
parity: UsartParity
)
This is the cumulative function for initializing a particular USART and it will take all the necessary details about the mode in which the USART pin is to be used.
Arguments
mode- aUsartModesobject, which defines the mode of USART to use.baud- a i64, the baud rate of USART the user wants to set.size- aUsartDatSizeobject, the size of set of bits to transmit.parity- aUsartParityobject, which gives the Parity bit mode for USART.stop- aUsartStopobject, which will be used to set the stop bits of data frame.
Enables the reciever function of microcontroller, whithout enabling it no communication is possible.
Checks if the data is avialable for reading or not.
Returns
a boolean- Which is false for no reading data and true if everything fine.
This is used to recieve data of one frame. Either 5 to 8 bits and 9 bits of data can be recieved from this function. In case of 5 to 8 bits this function returns u8. In case of 9 bits it retuns u32 of which first 9 bits are data recieved and remaining bits are insignificant. In case if an frame error or parity error occurs, this function returns Nothing.
Returns
a Option<u32>- which is NULL in case of wrong settings and read data u32 if valid input.
Can be used to check frame error,Data OverRun and Parity errors.
Returns
a boolean- Which is true if error occurs,else false.
Disables the reciever function of microcontroller.
Clears the unread data in the receive buffer by flushing it
This is used to recieve data of one frame. But it only functions when already data is available for read.which can be checked by available function. Either 5 to 8 bits and 9 bits of data can be recieved from this function. In case of 5 to 8 bits this function returns u8. In case of 9 bits it retuns u32 of which first 9 bits are data recieved and remaining bits are insignificant. In case ,if an frame error or parity error occurs, this function returns nothing.
Returns
a Option<u32>- which is NULL in case of wrong settings and read data u32 if valid input.