//指定長度位寫入指定資料
/**
* this function writes multi-bit value of registers for mpu6***
* * @param dev the pointer of device driver structure
* @param reg the register for mpu6***
* @param start_bit the start position of the register
* @param len number of bits to write
* @param data value to write
* * @return the writing status, rt_eok reprensents writing multi-bit value of registers successfully.
*///指定長度位寫入指定資料
static rt_err_t mpu6***_write_bits
(struct mpu6***_device *dev, rt_uint8_t reg, rt_uint8_t start_bit, rt_uint8_t len, rt_uint8_t data)
mask =((
1<< len)-1
)<<
(start_bit - len +1)
;//切換到要復位的位上去
data <<=
(start_bit - len +1)
;// shift data into correct position 資料也移動到要寫入的位上去
data &
= mask;
// zero all non-important bits in data 所有不重要的位歸零 要寫入的資料,不重要的位歸零,以寫保護入其他資料
byte &=~
(mask)
;// 將現有位元組中的所有重要位歸零 讀出來的資料歸零
byte |
= data;
// combine data with existing byte 寫入
return
mpu6***_write_reg
(dev, reg, byte)
;}
非常完美的函式
非常完美的函式 if os event en 0 int8uos eventtaskrdy os event pevent,void msg,int8u msk ptcb ostcbpriotbl prio ptcb ostcbdly 0 ptcb ostcbeventptr os event 0 ...
非常簡單的函式
function filter array,test function istrue person console.log filter ancestry,istrue console.log呼叫filter函式後,array ancestry陣列 test istrue 函式 函式filter遍歷...
分享35個非常精美的宣傳冊設計(上篇)
這篇文章收集了35個非常精美的宣傳冊設計作品,希望能幫助設計師們從中獲得靈感,設計出更優秀的宣傳冊作品,一起欣賞。chp brochure sandera resorts brochure for recreation center brochure lake shore brochure wwf ...