fn enable(&self) {
        // Enable the clock for the TWIM module
        unsafe {
            pm::enable_clock(self.master_clock);
        }

        //disable the i2c slave peripheral
        hil::i2c::I2CSlave::disable(self);

        let regs: &TWIMRegisters = unsafe { &*self.registers };

        // enable, reset, disable
        regs.control.set(0x1 << 0);
        regs.control.set(0x1 << 7);
        regs.control.set(0x1 << 1);

        // Init the bus speed
        self.set_bus_speed();

        // slew
        regs.slew_rate.set((0x2 << 28) | (7 << 16) | (7 << 0));

        // clear interrupts
        regs.status_clear.set(!0);
    }
/// This enables the entire I2C peripheral
This enables the entire I2C peripheral
This enables the entire I2C peripheral
fn enable(&self) {
        // Enable the clock for the TWIM module
        unsafe {
            pm::enable_clock(self.master_clock);
        }
        //disable the i2c slave peripheral
        hil::i2c::I2CSlave::disable(self);
        let regs: &TWIMRegisters = unsafe { &*self.registers };
        // enable, reset, disable
        regs.control.set(0x1 << 0);
        regs.control.set(0x1 << 7);
        regs.control.set(0x1 << 1);
        // Init the bus speed
        self.set_bus_speed();
        // slew
        regs.slew_rate.set((0x2 << 28) | (7 << 16) | (7 << 0));
        // clear interrupts
        regs.status_clear.set(!0);
    }
fn enable ( & self ) { // Enable the clock for the TWIM module unsafe { pm :: enable_clock ( self . master_clock ) ; } //disable the i2c slave peripheral hil :: i2c :: I2CSlave :: disable ( self ) ; let regs : & TWIMRegisters = unsafe { & * self . registers } ; // enable, reset, disable regs . control . set ( 0x1 << 0 ) ; regs . control . set ( 0x1 << 7 ) ; regs . control . set ( 0x1 << 1 ) ; // Init the bus speed self . set_bus_speed ( ) ; // slew regs . slew_rate . set ( ( 0x2 << 28 ) | ( 7 << 16 ) | ( 7 << 0 ) ) ; // clear interrupts regs . status_clear . set ( ! 0 ) ; }
This enables the entire I2C peripheral
This enables the entire I2C peripheral
&self
&self