platforms: add px4_udelay and px4_mdelay

- NuttX: up_udelay and up_mdelay
 - Linux: usleep and msleep
This commit is contained in:
Daniel Agar
2021-02-26 17:56:14 -05:00
parent f1f396e338
commit e0ade94d25
4 changed files with 12 additions and 6 deletions
+4 -4
View File
@@ -237,9 +237,9 @@ ADIS16477::read_reg16(uint8_t reg)
cmd[0] = ((reg | DIR_READ) << 8) & 0xff00;
transferhword(cmd, nullptr, 1);
up_udelay(T_STALL);
px4_udelay(T_STALL);
transferhword(nullptr, cmd, 1);
up_udelay(T_STALL);
px4_udelay(T_STALL);
return cmd[0];
}
@@ -262,9 +262,9 @@ ADIS16477::write_reg16(uint8_t reg, uint16_t value)
cmd[1] = (((reg + 0x1) | DIR_WRITE) << 8) | ((0xff00 & value) >> 8);
transferhword(cmd, nullptr, 1);
up_udelay(T_STALL);
px4_udelay(T_STALL);
transferhword(cmd + 1, nullptr, 1);
up_udelay(T_STALL);
px4_udelay(T_STALL);
}
void
@@ -563,7 +563,7 @@ uint16_t ADIS16448::RegisterRead(Register reg)
cmd[0] = (static_cast<uint16_t>(reg) << 8);
transferhword(cmd, nullptr, 1);
usleep(SPI_STALL_PERIOD);
px4_udelay(SPI_STALL_PERIOD);
transferhword(nullptr, cmd, 1);
return cmd[0];
@@ -578,7 +578,7 @@ void ADIS16448::RegisterWrite(Register reg, uint16_t value)
cmd[1] = (((static_cast<uint16_t>(reg) + 1) | DIR_WRITE) << 8) | ((0xFF00 & value) >> 8);
transferhword(cmd, nullptr, 1);
usleep(SPI_STALL_PERIOD);
px4_udelay(SPI_STALL_PERIOD);
transferhword(cmd + 1, nullptr, 1);
}