mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 02:43:33 +08:00
Updated PX4 use / API of low level GPIO and other hardware-centric system facilities
This commit is contained in:
@@ -73,7 +73,7 @@ static struct i2c_dev_s *i2c;
|
||||
int i2c_main(int argc, char *argv[])
|
||||
{
|
||||
/* find the right I2C */
|
||||
i2c = up_i2cinitialize(PX4_I2C_BUS_ONBOARD);
|
||||
i2c = px4_i2cbus_initialize(PX4_I2C_BUS_ONBOARD);
|
||||
|
||||
if (i2c == NULL) {
|
||||
errx(1, "failed to locate I2C bus");
|
||||
|
||||
@@ -177,7 +177,7 @@ static void
|
||||
ramtron_attach(void)
|
||||
{
|
||||
/* initialize the right spi */
|
||||
struct spi_dev_s *spi = up_spiinitialize(PX4_SPI_BUS_RAMTRON);
|
||||
struct spi_dev_s *spi = px4_spibus_initialize(PX4_SPI_BUS_RAMTRON);
|
||||
|
||||
/* this resets the spi bus, set correct bus speed again */
|
||||
SPI_SETFREQUENCY(spi, 10 * 1000 * 1000);
|
||||
@@ -225,7 +225,7 @@ static void
|
||||
at24xxx_attach(void)
|
||||
{
|
||||
/* find the right I2C */
|
||||
struct i2c_dev_s *i2c = up_i2cinitialize(PX4_I2C_BUS_ONBOARD);
|
||||
struct i2c_dev_s *i2c = px4_i2cbus_initialize(PX4_I2C_BUS_ONBOARD);
|
||||
/* this resets the I2C bus, set correct bus speed again */
|
||||
I2C_SETFREQUENCY(i2c, 400000);
|
||||
|
||||
|
||||
@@ -121,12 +121,12 @@ int test_time(int argc, char *argv[])
|
||||
delta = 0;
|
||||
|
||||
for (unsigned i = 0; i < 100; i++) {
|
||||
uint32_t flags = irqsave();
|
||||
uint32_t flags = px4_enter_critical_section();
|
||||
|
||||
h = hrt_absolute_time();
|
||||
c = cycletime();
|
||||
|
||||
irqrestore(flags);
|
||||
px4_leave_critical_section(flags);
|
||||
|
||||
delta += h - c;
|
||||
}
|
||||
@@ -138,12 +138,12 @@ int test_time(int argc, char *argv[])
|
||||
|
||||
usleep(rand());
|
||||
|
||||
uint32_t flags = irqsave();
|
||||
uint32_t flags = px4_enter_critical_section();
|
||||
|
||||
c = cycletime();
|
||||
h = hrt_absolute_time();
|
||||
|
||||
irqrestore(flags);
|
||||
px4_leave_critical_section(flags);
|
||||
|
||||
delta = abs(h - c);
|
||||
deltadelta = abs(delta - lowdelta);
|
||||
|
||||
@@ -52,5 +52,5 @@ __EXPORT int usb_connected_main(int argc, char *argv[]);
|
||||
int
|
||||
usb_connected_main(int argc, char *argv[])
|
||||
{
|
||||
return stm32_gpioread(GPIO_OTGFS_VBUS) ? 0 : 1;
|
||||
return px4_arch_gpioread(GPIO_OTGFS_VBUS) ? 0 : 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user