pub fn read(&mut self, offset: u16, data: &mut [u8; 4]) {
        let v = if (AMBA_ID_LOW..=AMBA_ID_HIGH).contains(&offset) {
            let index = ((offset - AMBA_ID_LOW) >> 2) as usize;
            u32::from(AMBA_IDS[index])
        } else {
            match offset {
                RTCDR => self.get_rtc_value(),
                RTCMR => {
                    // Read the match register.
                    // TODO: Implement the match register functionality.
                    self.mr
                }
                RTCLR => self.lr,
                RTCCR => 1, // RTC is always enabled.
                RTCIMSC => self.imsc,
                RTCRIS => self.ris,
                RTCMIS => self.ris & self.imsc,
                _ => {
                    // RTCICR is write only.  For reads of this register or
                    // an invalid offset, call the invalid_read method of the
                    // events struct and return.
                    self.events.invalid_read();
                    return;
                }
            }
        };

        *data = v.to_le_bytes();
    }
/// Handles a read request from the driver at `offset` offset from the
/// base register address.
///
/// # Arguments
/// * `offset` - The offset from the base register specifying
///              the register to be read.
/// * `data` - The little-endian, 4 byte array storing the read value.
///
/// # Example
///
/// You can see an example of how to use this function in the
/// [`Example` section from `Rtc`](struct.Rtc.html#example).
Handles a read request from the driver at `offset` offset from the
base register address.
Handles a read request from the driver at ` offset ` offset from the base register address .
pub fn read(&mut self, offset: u16, data: &mut [u8; 4]) {
        let v = if (AMBA_ID_LOW..=AMBA_ID_HIGH).contains(&offset) {
            let index = ((offset - AMBA_ID_LOW) >> 2) as usize;
            u32::from(AMBA_IDS[index])
        } else {
            match offset {
                RTCDR => self.get_rtc_value(),
                RTCMR => {
                    // Read the match register.
                    // TODO: Implement the match register functionality.
                    self.mr
                }
                RTCLR => self.lr,
                RTCCR => 1, // RTC is always enabled.
                RTCIMSC => self.imsc,
                RTCRIS => self.ris,
                RTCMIS => self.ris & self.imsc,
                _ => {
                    // RTCICR is write only.  For reads of this register or
                    // an invalid offset, call the invalid_read method of the
                    // events struct and return.
                    self.events.invalid_read();
                    return;
                }
            }
        };
        *data = v.to_le_bytes();
    }
pub fn read ( & mut self , offset : u16 , data : & mut [ u8 ; 4 ] ) { let v = if ( AMBA_ID_LOW ..= AMBA_ID_HIGH ) . contains ( & offset ) { let index = ( ( offset - AMBA_ID_LOW ) >> 2 ) as usize ; u32 :: from ( AMBA_IDS [ index ] ) } else { match offset { RTCDR => self . get_rtc_value ( ) , RTCMR => { // Read the match register. // TODO: Implement the match register functionality. self . mr } RTCLR => self . lr , RTCCR => 1 , // RTC is always enabled. RTCIMSC => self . imsc , RTCRIS => self . ris , RTCMIS => self . ris & self . imsc , _ => { // RTCICR is write only.  For reads of this register or // an invalid offset, call the invalid_read method of the // events struct and return. self . events . invalid_read ( ) ; return ; } } } ; * data = v . to_le_bytes ( ) ; }
Handles a read request from the driver at `offset` offset from the
base register address.
Handles a read request from the driver at ` offset ` offset from the base register address .
&mut self
offset
u16
data
&mut [u8; 4]
example
You can see an example of how to use this function in the
[`Example` section from `Rtc`](struct.Rtc.html#example).
You can see an example of how to use this function in the [ ` Example ` section from ` Rtc ` ] ( struct . Rtc . html#example ) .