|
|
@@ -351,15 +351,21 @@ static void ml5238_clear_bits(uint8_t regaddr, uint8_t bit) {
|
|
|
int ml5238_write(uint8_t regaddr, uint8_t data){
|
|
|
uint16_t send_data=(((uint16_t)regaddr)<<(0x09))|((uint16_t)data);
|
|
|
ml5238_cs(0);
|
|
|
+ task_udelay(1); //min 100ns
|
|
|
int ret = spi0_send_uint16(send_data, NULL);
|
|
|
+ task_udelay(1);
|
|
|
ml5238_cs(1);
|
|
|
+ task_udelay(1);
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
static int ml5238_read(uint8_t regaddr, uint8_t *data){
|
|
|
uint16_t send_data=((((uint16_t)regaddr)<<(0x09))|0x0100u)|((uint16_t)0x00u);
|
|
|
ml5238_cs(0);
|
|
|
+ task_udelay(1);
|
|
|
int ret = spi0_send_uint16(send_data, data);
|
|
|
+ task_udelay(1);
|
|
|
ml5238_cs(1);
|
|
|
+ task_udelay(1);
|
|
|
return ret;
|
|
|
}
|