Struct rustduino::atmega2560p::com::usart_initialize::UsartObject[][src]

#[repr(C, packed)]
pub struct UsartObject { pub usart: *mut Usart, pub name: UsartNum, }
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: UsartNum

Implementations

Can be use to initialize a USART with default settings.

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.

Can be used to stop the functioning of initialized USART.

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 - a UsartDataSize object, 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.

This creates a raw pointer for formation of the serial structure ahead to control all the USARTs of ATMEGA2560P at one place.

Arguments

  • num - a UsartNum object, which defines the USART for whom new reference is to be created.

Returns

  • a UsartObject - which will be used to control the USART.

Disable global interrupts for smooth non-interrupted functioning of USART.

Re-enable global interrupts.

Set clock polarity mode according to input from user.

Arguments

  • mode - a UsartPolarity object, which will be set for the USART.

Set’s various modes of the USART which is activated.

Arguments

  • mode - a UsartModes object, which will be set for the USART.

Set’s the power reduction register so that USART functioning is allowed.

Arguments

  • num - a UsartNum object, for which the power configurations of the USART will be set.

Set the appropriate bits for flushing out transmission and recieval.

Reset the USART.

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 - a UsartModes object, which defines the mode of USART to use.
  • baud - a i64, the baud rate of USART the user wants to set.
  • size - a UsartDatSize object, the size of set of bits to transmit.
  • parity - a UsartParity object, which gives the Parity bit mode for USART.
  • stop - a UsartStop object, 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.

Can be used to check parity error.

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.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.