这篇教程C++ stm32_gpiowrite函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中stm32_gpiowrite函数的典型用法代码示例。如果您正苦于以下问题:C++ stm32_gpiowrite函数的具体用法?C++ stm32_gpiowrite怎么用?C++ stm32_gpiowrite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了stm32_gpiowrite函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: stm32_configgpiovoidPX4FMU::gpio_reset(void){ /* * Setup default GPIO config - all pins as GPIOs, input if * possible otherwise output if possible. */ for (unsigned i = 0; i < _ngpio; i++) { if (_gpio_tab[i].input != 0) { stm32_configgpio(_gpio_tab[i].input); } else if (_gpio_tab[i].output != 0) { stm32_configgpio(_gpio_tab[i].output); } }#if defined(CONFIG_ARCH_BOARD_PX4FMU_V1) /* if we have a GPIO direction control, set it to zero (input) */ stm32_gpiowrite(GPIO_GPIO_DIR, 0); stm32_configgpio(GPIO_GPIO_DIR);#endif}
开发者ID:MonashUAS,项目名称:Firmware,代码行数:22,
示例2: stm32_spiinitialize__EXPORT void weak_function stm32_spiinitialize(void){ stm32_configgpio(GPIO_SPI_CS_DATAFLASH); stm32_configgpio(GPIO_SPI_CS_BMP280); stm32_configgpio(GPIO_SPI_CS_MPU6000); stm32_configgpio(GPIO_SPI_CS_SDCARD); stm32_configgpio(GPIO_SPI_CS_EXP_MPU6000); stm32_configgpio(GPIO_SPI_CS_EXP_FREE); stm32_configgpio(GPIO_SPI_CS_EXP_HMC5983); /* De-activate all peripherals, * required for some peripheral * state machines */ stm32_gpiowrite(GPIO_SPI_CS_DATAFLASH, 1); stm32_gpiowrite(GPIO_SPI_CS_BMP280, 1); stm32_gpiowrite(GPIO_SPI_CS_MPU6000, 1); stm32_gpiowrite(GPIO_SPI_CS_SDCARD, 1); stm32_gpiowrite(GPIO_SPI_CS_EXP_MPU6000, 1); stm32_gpiowrite(GPIO_SPI_CS_EXP_FREE, 1); stm32_gpiowrite(GPIO_SPI_CS_EXP_HMC5983, 1);}
开发者ID:SquadroneSystem,项目名称:vrbrain_nuttx,代码行数:22,
示例3: stm32_spi3select__EXPORT void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected){ /* SPI select is active low, so write !selected to select the device */ switch (devid) { case SPIDEV_MMCSD: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_SDCARD, !selected); stm32_gpiowrite(GPIO_SPI_CS_DATAFLASH, 1); stm32_gpiowrite(GPIO_SPI_CS_EEPROM, 1); break; case SPIDEV_FLASH: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_DATAFLASH, !selected); stm32_gpiowrite(GPIO_SPI_CS_EEPROM, 1); stm32_gpiowrite(GPIO_SPI_CS_SDCARD, 1); break; default: break; }}
开发者ID:LukeMike,项目名称:vrbrain_nuttx,代码行数:24,
示例4: arch_sporadic_lowpriorityvoid arch_sporadic_lowpriority(FAR struct tcb_s *tcb){ stm32_gpiowrite(GPIO_SCHED_HIGHPRI, false);}
开发者ID:AlexShiLucky,项目名称:NuttX,代码行数:4,
示例5: stm32_spi1selectvoid stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected){ spidbg("devid: %d CS: %s/n", (int)devid, selected ? "assert" : "de-assert"); stm32_gpiowrite(GPIO_MEMS_CS, !selected);}
开发者ID:jrosberg,项目名称:NuttX-L21,代码行数:6,
示例6: board_spi_reset__EXPORT void board_spi_reset(int ms){ // TODO: DRDY ///* disable SPI bus 1 DRDY */ //stm32_configgpio(GPIO_DRDY_OFF_PORTD_PIN15); //stm32_configgpio(GPIO_DRDY_OFF_PORTC_PIN14); //stm32_configgpio(GPIO_DRDY_OFF_PORTE_PIN12); //stm32_gpiowrite(GPIO_DRDY_OFF_PORTD_PIN15, 0); //stm32_gpiowrite(GPIO_DRDY_OFF_PORTC_PIN14, 0); //stm32_gpiowrite(GPIO_DRDY_OFF_PORTE_PIN12, 0); /* disable SPI bus 1 CS */ stm32_configgpio(GPIO_SPI1_CS_MEMS_OFF); stm32_gpiowrite(GPIO_SPI1_CS_MEMS_OFF, 0); /* disable SPI bus 2 CS */ stm32_configgpio(GPIO_SPI2_CS_SDCARD_OFF); stm32_gpiowrite(GPIO_SPI2_CS_SDCARD_OFF, 0); /* disable SPI bus 3 CS */ stm32_configgpio(GPIO_SPI3_CS_BARO_OFF); stm32_gpiowrite(GPIO_SPI3_CS_BARO_OFF, 0); stm32_configgpio(GPIO_SPI3_CS_OSD_OFF); stm32_gpiowrite(GPIO_SPI3_CS_OSD_OFF, 0); /* disable SPI bus 1*/ stm32_configgpio(GPIO_SPI1_SCK_OFF); stm32_configgpio(GPIO_SPI1_MISO_OFF); stm32_configgpio(GPIO_SPI1_MOSI_OFF); stm32_gpiowrite(GPIO_SPI1_SCK_OFF, 0); stm32_gpiowrite(GPIO_SPI1_MISO_OFF, 0); stm32_gpiowrite(GPIO_SPI1_MOSI_OFF, 0); /* disable SPI bus 2*/ stm32_configgpio(GPIO_SPI2_SCK_OFF); stm32_configgpio(GPIO_SPI2_MISO_OFF); stm32_configgpio(GPIO_SPI2_MOSI_OFF); stm32_gpiowrite(GPIO_SPI2_SCK_OFF, 0); stm32_gpiowrite(GPIO_SPI2_MISO_OFF, 0); stm32_gpiowrite(GPIO_SPI2_MOSI_OFF, 0); /* disable SPI bus 3*/ stm32_configgpio(GPIO_SPI3_SCK_OFF); stm32_configgpio(GPIO_SPI3_MISO_OFF); stm32_configgpio(GPIO_SPI3_MOSI_OFF); stm32_gpiowrite(GPIO_SPI3_SCK_OFF, 0); stm32_gpiowrite(GPIO_SPI3_MISO_OFF, 0); stm32_gpiowrite(GPIO_SPI3_MOSI_OFF, 0); /* wait a bit before starting SPI, different times didn't influence results */ usleep(100); stm32_spiinitialize(); stm32_configgpio(GPIO_SPI1_SCK); stm32_configgpio(GPIO_SPI1_MISO); stm32_configgpio(GPIO_SPI1_MOSI); // TODO: why do we not enable SPI2 here? stm32_configgpio(GPIO_SPI3_SCK); stm32_configgpio(GPIO_SPI3_MISO); stm32_configgpio(GPIO_SPI3_MOSI);}
开发者ID:AlexisTM,项目名称:Firmware,代码行数:68,
示例7: nsh_archinitialize__EXPORT int nsh_archinitialize(void){ int result; message("/n"); /* configure always-on ADC pins */ stm32_configgpio(GPIO_ADC1_IN0); stm32_configgpio(GPIO_ADC1_IN10); stm32_configgpio(GPIO_ADC1_IN11); stm32_configgpio(GPIO_UART_SBUS_INVERTER);#ifdef CONFIG_RC_INPUTS_TYPE(RC_INPUT_SBUS) stm32_gpiowrite(GPIO_UART_SBUS_INVERTER, 1);#else stm32_gpiowrite(GPIO_UART_SBUS_INVERTER, 0);#endif /* configure the high-resolution time/callout interface */ hrt_init(); /* configure CPU load estimation */#ifdef CONFIG_SCHED_INSTRUMENTATION cpuload_initialize_once();#endif /* initial BUZZER state */ drv_buzzer_start(); buzzer_off(BUZZER_EXT); /* initial LED state */ drv_led_start(); led_off(LED_AMBER); led_off(LED_BLUE); led_off(LED_GREEN); led_off(LED_EXT1); led_off(LED_EXT2); /* Configure SPI-based devices */ message("[boot] Initializing SPI port 1/n"); spi1 = up_spiinitialize(1); if (!spi1) { message("[boot] FAILED to initialize SPI port 1/r/n"); led_on(LED_AMBER); return -ENODEV; } /* Default SPI1 to 1MHz and de-assert the known chip selects. */ SPI_SETFREQUENCY(spi1, 10000000); SPI_SETBITS(spi1, 8); SPI_SETMODE(spi1, SPIDEV_MODE3); SPI_SELECT(spi1, GPIO_SPI_CS_MS5611, false); SPI_SELECT(spi1, GPIO_SPI_CS_EXP_MS5611, false); SPI_SELECT(spi1, GPIO_SPI_CS_EXP_MPU6000, false); SPI_SELECT(spi1, GPIO_SPI_CS_EXP_HMC5983, false); SPI_SELECT(spi1, GPIO_SPI_CS_EXP_WIFI_EEPROM, false); up_udelay(20); message("[boot] Successfully initialized SPI port 1/r/n");// message("[boot] Initializing Wireless Module/n");// wireless_archinitialize(); message("[boot] Initializing SPI port 2/n"); spi2 = up_spiinitialize(2); if (!spi2) { message("[boot] FAILED to initialize SPI port 2/r/n"); led_on(LED_AMBER); return -ENODEV; } /* Default SPI2 to 1MHz and de-assert the known chip selects. */ SPI_SETFREQUENCY(spi2, 10000000); SPI_SETBITS(spi2, 8); SPI_SETMODE(spi2, SPIDEV_MODE3); SPI_SELECT(spi2, GPIO_SPI_CS_MPU6000, false); SPI_SELECT(spi2, GPIO_SPI_CS_IMU_MS5611, false); SPI_SELECT(spi2, GPIO_SPI_CS_IMU_MPU6000, false);//.........这里部分代码省略.........
开发者ID:SquadroneSystem,项目名称:vrbrain_nuttx,代码行数:101,
示例8: stm32_spi1select__EXPORT void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected){ /* SPI select is active low, so write !selected to select the device */ switch (devid) { case PX4_SPIDEV_ICM: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_MPU9250, 1); stm32_gpiowrite(GPIO_SPI_CS_HMC5983, 1); stm32_gpiowrite(GPIO_SPI_CS_MS5611, 1); stm32_gpiowrite(GPIO_SPI_CS_ICM_20608_G, !selected); break; case PX4_SPIDEV_ACCEL_MAG: /* Making sure the other peripherals are not selected */ break; case PX4_SPIDEV_BARO: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_MPU9250, 1); stm32_gpiowrite(GPIO_SPI_CS_HMC5983, 1); stm32_gpiowrite(GPIO_SPI_CS_MS5611, !selected); stm32_gpiowrite(GPIO_SPI_CS_ICM_20608_G, 1); break; case PX4_SPIDEV_HMC: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_MPU9250, 1); stm32_gpiowrite(GPIO_SPI_CS_HMC5983, !selected); stm32_gpiowrite(GPIO_SPI_CS_MS5611, 1); stm32_gpiowrite(GPIO_SPI_CS_ICM_20608_G, 1); break; case PX4_SPIDEV_MPU: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_MPU9250, !selected); stm32_gpiowrite(GPIO_SPI_CS_HMC5983, 1); stm32_gpiowrite(GPIO_SPI_CS_MS5611, 1); stm32_gpiowrite(GPIO_SPI_CS_ICM_20608_G, 1); break; default: break; }}
开发者ID:1002victor,项目名称:Firmware,代码行数:45,
示例9: stm32_spi1select__EXPORT void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected){ /* SPI select is active low, so write !selected to select the device */ switch (devid) { case SPIDEV_FLASH: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_DATAFLASH, !selected); stm32_gpiowrite(GPIO_SPI_CS_MS5611, 1); stm32_gpiowrite(GPIO_SPI_CS_EEPROM, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT1, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT2, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT3, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT4, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT5, 1); break; case SPIDEV_EEPROM: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_DATAFLASH, 1); stm32_gpiowrite(GPIO_SPI_CS_EEPROM, !selected); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT1, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT2, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT3, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT4, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT5, 1); stm32_gpiowrite(GPIO_SPI_CS_MS5611, 1); break; case SPIDEV_DF_EXT1: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_DATAFLASH, 1); stm32_gpiowrite(GPIO_SPI_CS_EEPROM, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT1, !selected); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT2, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT3, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT4, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT5, 1); stm32_gpiowrite(GPIO_SPI_CS_MS5611, 1); break; case SPIDEV_DF_EXT2: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_DATAFLASH, 1); stm32_gpiowrite(GPIO_SPI_CS_EEPROM, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT1, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT2, !selected); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT3, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT4, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT5, 1); stm32_gpiowrite(GPIO_SPI_CS_MS5611, 1); break; case SPIDEV_DF_EXT3: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_DATAFLASH, 1); stm32_gpiowrite(GPIO_SPI_CS_EEPROM, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT1, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT2, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT3, !selected); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT4, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT5, 1); stm32_gpiowrite(GPIO_SPI_CS_MS5611, 1); break; case SPIDEV_DF_EXT4: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_DATAFLASH, 1); stm32_gpiowrite(GPIO_SPI_CS_EEPROM, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT1, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT2, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT3, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT4, !selected); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT5, 1); stm32_gpiowrite(GPIO_SPI_CS_MS5611, 1); break; case SPIDEV_DF_EXT5: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_DATAFLASH, 1); stm32_gpiowrite(GPIO_SPI_CS_EEPROM, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT1, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT2, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT3, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT4, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT5, !selected); stm32_gpiowrite(GPIO_SPI_CS_MS5611, 1); break; case SPIDEV_MS5611: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_MS5611, !selected); stm32_gpiowrite(GPIO_SPI_CS_DATAFLASH, 1); stm32_gpiowrite(GPIO_SPI_CS_EEPROM, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT1, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT2, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT3, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT4, 1); stm32_gpiowrite(GPIO_SPI_CS_DF_EXT5, 1); break; default: break; }//.........这里部分代码省略.........
开发者ID:casro,项目名称:vrbrain_nuttx,代码行数:101,
示例10: nsh_archinitialize__EXPORT int nsh_archinitialize(void){ int result; message("/n"); /* configure always-on ADC pins */ stm32_configgpio(GPIO_ADC1_IN10); stm32_configgpio(GPIO_ADC1_IN11);#if APM_BUILD_TYPE(APM_BUILD_ArduPlane) stm32_configgpio(GPIO_GPIO0_INPUT); stm32_configgpio(GPIO_ADC1_IN14);#endif stm32_configgpio(GPIO_UART_SBUS_INVERTER);#if CONFIG_RC_INPUTS_TYPE(RC_INPUT_SBUS) stm32_gpiowrite(GPIO_UART_SBUS_INVERTER, 1);#else stm32_gpiowrite(GPIO_UART_SBUS_INVERTER, 0);#endif /* configure the high-resolution time/callout interface */ hrt_init(); /* configure the DMA allocator */ dma_alloc_init(); /* configure CPU load estimation */#ifdef CONFIG_SCHED_INSTRUMENTATION cpuload_initialize_once();#endif /* set up the serial DMA polling */ static struct hrt_call serial_dma_call; struct timespec ts; /* * Poll at 1ms intervals for received bytes that have not triggered * a DMA event. */ ts.tv_sec = 0; ts.tv_nsec = 1000000; hrt_call_every(&serial_dma_call, ts_to_abstime(&ts), ts_to_abstime(&ts), (hrt_callout)stm32_serial_dma_poll, NULL); /* initial BUZZER state */ drv_buzzer_start(); buzzer_off(BUZZER_EXT); /* initial LED state */ drv_led_start(); led_off(LED_AMBER); led_off(LED_BLUE); led_off(LED_GREEN); led_off(LED_EXT1); led_off(LED_EXT2); /* Configure SPI-based devices */ message("[boot] Initializing SPI port 1/n"); spi1 = up_spiinitialize(1); if (!spi1) { message("[boot] FAILED to initialize SPI port 1/r/n"); led_on(LED_AMBER); return -ENODEV; } /* Default SPI1 to 1MHz and de-assert the known chip selects. */ SPI_SETFREQUENCY(spi1, 10000000); SPI_SETBITS(spi1, 8); SPI_SETMODE(spi1, SPIDEV_MODE3); SPI_SELECT(spi1, SPIDEV_WIRELESS, false); SPI_SELECT(spi1, SPIDEV_FLASH, false); SPI_SELECT(spi1, SPIDEV_MS5611, false); SPI_SELECT(spi1, SPIDEV_EXP_MS5611, false); SPI_SELECT(spi1, SPIDEV_EXP_MPU6000, false); SPI_SELECT(spi1, SPIDEV_EXP_HMC5983, false); up_udelay(20); message("[boot] Successfully initialized SPI port 1/r/n"); message("[boot] Initializing SPI port 2/n"); spi2 = up_spiinitialize(2); if (!spi2) { message("[boot] FAILED to initialize SPI port 2/r/n"); led_on(LED_AMBER); return -ENODEV; } /* Default SPI2 to 1MHz and de-assert the known chip selects. */ SPI_SETFREQUENCY(spi2, 10000000); SPI_SETBITS(spi2, 8);//.........这里部分代码省略.........
开发者ID:LukeMike,项目名称:vrbrain_nuttx,代码行数:101,
示例11: stm32_usbpullupint stm32_usbpullup(FAR struct usbdev_s *dev, bool enable){ usbtrace(TRACE_DEVPULLUP, (uint16_t)enable); stm32_gpiowrite(GPIO_USB_PULLUP, !enable); return OK;}
开发者ID:acassis,项目名称:ros2_nuttx,代码行数:6,
示例12: phy_set_ledstatic void phy_set_led(int led, bool state){ /* Active High */ stm32_gpiowrite(g_ledmap[led], state);}
开发者ID:AlexShiLucky,项目名称:NuttX,代码行数:6,
示例13: arch_sporadic_startvoid arch_sporadic_start(FAR struct tcb_s *tcb){ stm32_gpiowrite(GPIO_SCHED_HIGHPRI, true);}
开发者ID:AlexShiLucky,项目名称:NuttX,代码行数:4,
示例14: stm32_gpiowritevoidPWMIN::_turn_off(){ stm32_gpiowrite(GPIO_VDD_RANGEFINDER_EN, 0);}
开发者ID:JW-CHOI,项目名称:Firmware,代码行数:5,
示例15: stm32_spi2select__EXPORT void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected){ /* SPI select is active low, so write !selected to select the device */ switch (devid) { case SPIDEV_MPU6000: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_MPU6000, !selected); stm32_gpiowrite(GPIO_SPI_CS_IMU_MS5611, 1); stm32_gpiowrite(GPIO_SPI_CS_IMU_MPU6000, 1); stm32_gpiowrite(GPIO_SPI_CS_IMU_HMC5983, 1); break; case SPIDEV_IMU_MS5611: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_MPU6000, 1); stm32_gpiowrite(GPIO_SPI_CS_IMU_MS5611, !selected); stm32_gpiowrite(GPIO_SPI_CS_IMU_MPU6000, 1); stm32_gpiowrite(GPIO_SPI_CS_IMU_HMC5983, 1); break; case SPIDEV_IMU_MPU6000: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_MPU6000, 1); stm32_gpiowrite(GPIO_SPI_CS_IMU_MS5611, 1); stm32_gpiowrite(GPIO_SPI_CS_IMU_MPU6000, !selected); stm32_gpiowrite(GPIO_SPI_CS_IMU_HMC5983, 1); break; case SPIDEV_IMU_HMC5983: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_MPU6000, 1); stm32_gpiowrite(GPIO_SPI_CS_IMU_MS5611, 1); stm32_gpiowrite(GPIO_SPI_CS_IMU_MPU6000, 1); stm32_gpiowrite(GPIO_SPI_CS_IMU_HMC5983, !selected); break; default: break; }}
开发者ID:LukeMike,项目名称:vrbrain_nuttx,代码行数:42,
示例16: nsh_archinitialize__EXPORT int nsh_archinitialize(void){ int result; stm32_configgpio(GPIO_SENSOR_PWR_EN); stm32_gpiowrite(GPIO_SENSOR_PWR_EN, true); stm32_configgpio(GPIO_GPS_PWR_EN); stm32_gpiowrite(GPIO_GPS_PWR_EN, true); stm32_configgpio(GPIO_TELE_PWR_EN); stm32_gpiowrite(GPIO_TELE_PWR_EN, true); /* configure always-on ADC pins */ stm32_configgpio(GPIO_ADC1_IN1); stm32_configgpio(GPIO_ADC1_IN11); /* IN12 and IN13 further below */ /* configure the high-resolution time/callout interface */ hrt_init(); /* configure CPU load estimation */#ifdef CONFIG_SCHED_INSTRUMENTATION cpuload_initialize_once();#endif /* set up the serial DMA polling */ static struct hrt_call serial_dma_call; struct timespec ts; /* * Poll at 1ms intervals for received bytes that have not triggered * a DMA event. */ ts.tv_sec = 0; ts.tv_nsec = 1000000; hrt_call_every(&serial_dma_call, ts_to_abstime(&ts), ts_to_abstime(&ts), (hrt_callout)stm32_serial_dma_poll, NULL); /* initial LED state */ drv_led_start(); led_off(LED_AMBER); led_off(LED_BLUE); /* Configure SPI-based devices */ //spi1 = up_spiinitialize(1); //if (!spi1) { // message("[boot] FAILED to initialize SPI port 1/r/n"); // up_ledon(LED_AMBER); // return -ENODEV; //} /* Default SPI1 to 1MHz and de-assert the known chip selects. */ //SPI_SETFREQUENCY(spi1, 10000000); //SPI_SETBITS(spi1, 8); //SPI_SETMODE(spi1, SPIDEV_MODE3); //SPI_SELECT(spi1, PX4_SPIDEV_GYRO, false); //SPI_SELECT(spi1, PX4_SPIDEV_ACCEL, false); //SPI_SELECT(spi1, PX4_SPIDEV_MPU, false); //up_udelay(20); //message("[boot] Successfully initialized SPI port 1/r/n"); /* * If SPI2 is enabled in the defconfig, we loose some ADC pins as chip selects. * Keep the SPI2 init optional and conditionally initialize the ADC pins */ //#ifdef CONFIG_STM32_SPI2 // spi2 = up_spiinitialize(2); /* Default SPI2 to 1MHz and de-assert the known chip selects. */ // SPI_SETFREQUENCY(spi2, 10000000); // SPI_SETBITS(spi2, 8); // SPI_SETMODE(spi2, SPIDEV_MODE3); // SPI_SELECT(spi2, PX4_SPIDEV_GYRO, false); // SPI_SELECT(spi2, PX4_SPIDEV_ACCEL_MAG, false); // message("[boot] Initialized SPI port2 (ADC IN12/13 blocked)/n"); //#else // spi2 = NULL; // message("[boot] Enabling IN12/13 instead of SPI2/n"); // /* no SPI2, use pins for ADC */ // stm32_configgpio(GPIO_ADC1_IN12); // stm32_configgpio(GPIO_ADC1_IN13); // jumperable to MPU6000 DRDY on some boards //#endif /* Get the SPI port for the microSD slot */ message("[boot] Initializing SPI port 2/n"); spi2 = up_spiinitialize(2); if (!spi2) { message("[boot] FAILED to initialize SPI port 2/n");//.........这里部分代码省略.........
开发者ID:sarthakkaingade,项目名称:Firmware_beta,代码行数:101,
示例17: board_get_hwidstruct ara_board_info *ara_board_init(void) { int i; enum hwid hwid = board_get_hwid(); board_info = NULL; /* Check HWID, assign board_info struct and the Switch ES revision */ switch (hwid) { case HWID_DB3_0_1: board_info = &db3_board_info; dbg_info("HWID found as DB3.0/3.1/n"); break; case HWID_DB3_2: /* DB3.0/1 with ES3 Switch */ board_info = &db3_board_info; board_info->sw_data.rev = SWITCH_REV_ES3; dbg_info("HWID found as DB3.2/n"); break; case HWID_DB3_5: /* EVT1.5 + DB3.5 pwrmon + specific mapping of physical interfaces */ board_info = &evt1_5_board_info; board_info->pwrmon = &db3_5_pwrmon; board_info->interfaces = db3_5_interfaces; board_info->nr_interfaces = db3_5_nr_interfaces; dbg_info("HWID found as DB3.5/n"); break; case HWID_EVT1: board_info = &evt1_board_info; dbg_info("HWID found as EVT1/n"); break; case HWID_EVT1_5: board_info = &evt1_5_board_info; dbg_info("HWID found as EVT1.5/n"); break; case HWID_EVT1_6: board_info = &evt1_5_board_info; board_info->sw_data.rev = SWITCH_REV_ES2; dbg_info("HWID found as EVT1.6/n"); break; default: return NULL; } /* Disable the I/O Expanders for now */ for (i = 0; i < board_info->nr_io_expanders; i++) { struct io_expander_info *io_exp = &board_info->io_expanders[i]; stm32_configgpio(io_exp->reset); stm32_gpiowrite(io_exp->reset, false); } /* * Register the STM32 GPIOs to Gpio Chip * * This needs to happen before the I/O Expanders registration, which * uses some STM32 pins */ stm32_gpio_init(); /* Register the TCA64xx I/O Expanders GPIOs to Gpio Chip */ for (i = 0; i < board_info->nr_io_expanders; i++) { struct io_expander_info *io_exp = &board_info->io_expanders[i]; io_exp->i2c_dev = up_i2cinitialize(io_exp->i2c_bus); if (!io_exp->i2c_dev) { dbg_error("%s(): Failed to get I/O Expander I2C bus %u/n", __func__, io_exp->i2c_bus); goto err_deinit_gpio; } else { if (tca64xx_init(&io_exp->io_exp_driver_data, io_exp->part, io_exp->i2c_dev, io_exp->i2c_addr, io_exp->reset, io_exp->irq, io_exp->gpio_base) < 0) { dbg_error("%s(): Failed to register I/O Expander(0x%02x)/n", __func__, io_exp->i2c_addr); goto err_uninit_i2c; } } } /* Run the board specific code */ if (board_info->board_init) { if (board_info->board_init(board_info)) { dbg_error("%s(): Failed to initalize board/n", __func__); goto err_uninit_i2c; } } /* Return the board specific info */ return board_info; err_uninit_i2c: /* Done in reverse order to account for possible IRQ chaining. */ for (i = board_info->nr_io_expanders - 1; i >= 0; i--) { struct io_expander_info *io_exp = &board_info->io_expanders[i]; if (io_exp->i2c_dev) { up_i2cuninitialize(io_exp->i2c_dev); } }//.........这里部分代码省略.........
开发者ID:JasonHung,项目名称:nuttx,代码行数:101,
示例18: definedvoidPX4FMU::sensor_reset(int ms){#if defined(CONFIG_ARCH_BOARD_PX4FMU_V2) if (ms < 1) { ms = 1; } /* disable SPI bus */ stm32_configgpio(GPIO_SPI_CS_GYRO_OFF); stm32_configgpio(GPIO_SPI_CS_ACCEL_MAG_OFF); stm32_configgpio(GPIO_SPI_CS_BARO_OFF); stm32_configgpio(GPIO_SPI_CS_MPU_OFF); stm32_gpiowrite(GPIO_SPI_CS_GYRO_OFF, 0); stm32_gpiowrite(GPIO_SPI_CS_ACCEL_MAG_OFF, 0); stm32_gpiowrite(GPIO_SPI_CS_BARO_OFF, 0); stm32_gpiowrite(GPIO_SPI_CS_MPU_OFF, 0); stm32_configgpio(GPIO_SPI1_SCK_OFF); stm32_configgpio(GPIO_SPI1_MISO_OFF); stm32_configgpio(GPIO_SPI1_MOSI_OFF); stm32_gpiowrite(GPIO_SPI1_SCK_OFF, 0); stm32_gpiowrite(GPIO_SPI1_MISO_OFF, 0); stm32_gpiowrite(GPIO_SPI1_MOSI_OFF, 0); stm32_configgpio(GPIO_GYRO_DRDY_OFF); stm32_configgpio(GPIO_MAG_DRDY_OFF); stm32_configgpio(GPIO_ACCEL_DRDY_OFF); stm32_configgpio(GPIO_EXTI_MPU_DRDY_OFF); stm32_gpiowrite(GPIO_GYRO_DRDY_OFF, 0); stm32_gpiowrite(GPIO_MAG_DRDY_OFF, 0); stm32_gpiowrite(GPIO_ACCEL_DRDY_OFF, 0); stm32_gpiowrite(GPIO_EXTI_MPU_DRDY_OFF, 0); /* set the sensor rail off */ stm32_configgpio(GPIO_VDD_3V3_SENSORS_EN); stm32_gpiowrite(GPIO_VDD_3V3_SENSORS_EN, 0); /* wait for the sensor rail to reach GND */ usleep(ms * 1000); warnx("reset done, %d ms", ms); /* re-enable power */ /* switch the sensor rail back on */ stm32_gpiowrite(GPIO_VDD_3V3_SENSORS_EN, 1); /* wait a bit before starting SPI, different times didn't influence results */ usleep(100); /* reconfigure the SPI pins */#ifdef CONFIG_STM32_SPI1 stm32_configgpio(GPIO_SPI_CS_GYRO); stm32_configgpio(GPIO_SPI_CS_ACCEL_MAG); stm32_configgpio(GPIO_SPI_CS_BARO); stm32_configgpio(GPIO_SPI_CS_MPU); /* De-activate all peripherals, * required for some peripheral * state machines */ stm32_gpiowrite(GPIO_SPI_CS_GYRO, 1); stm32_gpiowrite(GPIO_SPI_CS_ACCEL_MAG, 1); stm32_gpiowrite(GPIO_SPI_CS_BARO, 1); stm32_gpiowrite(GPIO_SPI_CS_MPU, 1); // // XXX bring up the EXTI pins again // stm32_configgpio(GPIO_GYRO_DRDY); // stm32_configgpio(GPIO_MAG_DRDY); // stm32_configgpio(GPIO_ACCEL_DRDY); // stm32_configgpio(GPIO_EXTI_MPU_DRDY);#endif#endif}
开发者ID:Bjarne-Madsen,项目名称:Firmware,代码行数:79,
示例19: arch_sporadic_suspendvoid arch_sporadic_suspend(FAR struct tcb_s *tcb){ stm32_gpiowrite(GPIO_SCHED_RUNNING, false);}
开发者ID:AlexShiLucky,项目名称:NuttX,代码行数:4,
示例20: stm32_setledsvoid stm32_setleds(uint8_t ledset){ stm32_gpiowrite(GPIO_LED_STATUS, (ledset & BOARD_LED1_BIT) != 0);}
开发者ID:FreddieChopin,项目名称:NuttX,代码行数:4,
示例21: arch_sporadic_resumevoid arch_sporadic_resume(FAR struct tcb_s *tcb){ stm32_gpiowrite(GPIO_SCHED_RUNNING, true);}
开发者ID:AlexShiLucky,项目名称:NuttX,代码行数:4,
示例22: stm32_setledsvoid stm32_setleds(uint8_t ledset){ stm32_gpiowrite(GPIO_LED1, (ledset & BOARD_LED1_BIT) == 0); stm32_gpiowrite(GPIO_LED2, (ledset & BOARD_LED2_BIT) == 0);}
开发者ID:FreddieChopin,项目名称:NuttX,代码行数:5,
示例23: board_userled_allvoid board_userled_all(uint8_t ledset){ stm32_gpiowrite(GPIO_LED1, (ledset & BOARD_LED1_BIT) == 0); stm32_gpiowrite(GPIO_LED2, (ledset & BOARD_LED2_BIT) == 0); stm32_gpiowrite(GPIO_LED3, (ledset & BOARD_LED3_BIT) == 0);}
开发者ID:acassis,项目名称:ros2_nuttx,代码行数:6,
示例24: phy_set_ledstatic void phy_set_led(int led, bool state){ /* Pull Up to switch on */ stm32_gpiowrite(g_ledmap[led], state);}
开发者ID:Aerovinci,项目名称:Firmware,代码行数:5,
示例25: stm32_configgpioint stm32_configgpio(uint32_t cfgset){ uintptr_t base; uint32_t regval; uint32_t setting; unsigned int regoffset; unsigned int port; unsigned int pin; unsigned int pos; unsigned int pinmode; irqstate_t flags; /* Verify that this hardware supports the select GPIO port */ port = (cfgset & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT; if (port >= STM32F7_NGPIO) { return -EINVAL; } /* Get the port base address */ base = g_gpiobase[port]; /* Get the pin number and select the port configuration register for that * pin */ pin = (cfgset & GPIO_PIN_MASK) >> GPIO_PIN_SHIFT; /* Set up the mode register (and remember whether the pin mode) */ switch (cfgset & GPIO_MODE_MASK) { default: case GPIO_INPUT: /* Input mode */ pinmode = GPIO_MODER_INPUT; break; case GPIO_OUTPUT: /* General purpose output mode */ stm32_gpiowrite(cfgset, (cfgset & GPIO_OUTPUT_SET) != 0); /* Set the initial output value */ pinmode = GPIO_MODER_OUTPUT; break; case GPIO_ALT: /* Alternate function mode */ pinmode = GPIO_MODER_ALT; break; case GPIO_ANALOG: /* Analog mode */ pinmode = GPIO_MODER_ANALOG; break; } /* Interrupts must be disabled from here on out so that we have mutually * exclusive access to all of the GPIO configuration registers. */ flags = enter_critical_section(); /* Now apply the configuration to the mode register */ regval = getreg32(base + STM32_GPIO_MODER_OFFSET); regval &= ~GPIO_MODER_MASK(pin); regval |= ((uint32_t)pinmode << GPIO_MODER_SHIFT(pin)); putreg32(regval, base + STM32_GPIO_MODER_OFFSET); /* Set up the pull-up/pull-down configuration (all but analog pins) */ setting = GPIO_PUPDR_NONE; if (pinmode != GPIO_MODER_ANALOG) { switch (cfgset & GPIO_PUPD_MASK) { default: case GPIO_FLOAT: /* No pull-up, pull-down */ break; case GPIO_PULLUP: /* Pull-up */ setting = GPIO_PUPDR_PULLUP; break; case GPIO_PULLDOWN: /* Pull-down */ setting = GPIO_PUPDR_PULLDOWN; break; } } regval = getreg32(base + STM32_GPIO_PUPDR_OFFSET); regval &= ~GPIO_PUPDR_MASK(pin); regval |= (setting << GPIO_PUPDR_SHIFT(pin)); putreg32(regval, base + STM32_GPIO_PUPDR_OFFSET); /* Set the alternate function (Only alternate function pins) */ if (pinmode == GPIO_MODER_ALT) { setting = (cfgset & GPIO_AF_MASK) >> GPIO_AF_SHIFT; }
开发者ID:a1ien,项目名称:nuttx,代码行数:98,
示例26: up_lcdsetpolaritystatic void up_lcdsetpolarity(bool pol){ stm32_gpiowrite(GPIO_LED, pol); stm32_gpiowrite(GPIO_MEMLCD_EXTCOMIN, pol);}
开发者ID:Nuages,项目名称:terrarium_2015,代码行数:5,
示例27: stm32_spi4select__EXPORT void stm32_spi4select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected){ /* SPI select is active low, so write !selected to select the device */ switch (devid) { case PX4_SPIDEV_GYRO: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_GYRO, !selected); stm32_gpiowrite(GPIO_SPI_CS_ACCEL_MAG, 1); stm32_gpiowrite(GPIO_SPI_CS_BARO, 1); stm32_gpiowrite(GPIO_SPI_CS_MPU, 1); break; case PX4_SPIDEV_ACCEL_MAG: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_GYRO, 1); stm32_gpiowrite(GPIO_SPI_CS_ACCEL_MAG, !selected); stm32_gpiowrite(GPIO_SPI_CS_BARO, 1); stm32_gpiowrite(GPIO_SPI_CS_MPU, 1); break; case PX4_SPIDEV_BARO: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_GYRO, 1); stm32_gpiowrite(GPIO_SPI_CS_ACCEL_MAG, 1); stm32_gpiowrite(GPIO_SPI_CS_BARO, !selected);// stm32_gpiowrite(GPIO_SPI_CS_FRAM,1); stm32_gpiowrite(GPIO_SPI_CS_MPU, 1); break;// case PX4_SPIDEV_FLASH:// stm32_gpiowrite(GPIO_SPI_CS_BARO,1);// stm32_gpiowrite(GPIO_SPI_CS_FRAM,!selected);// break; case PX4_SPIDEV_MPU: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_GYRO, 1); stm32_gpiowrite(GPIO_SPI_CS_ACCEL_MAG, 1); stm32_gpiowrite(GPIO_SPI_CS_BARO, 1); stm32_gpiowrite(GPIO_SPI_CS_MPU, !selected); break; default: break; }}
开发者ID:27Seanerz,项目名称:Firmware,代码行数:47,
示例28: stm32_spi3select__EXPORT void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected){ /* there can only be one device on this bus, so always select it */ stm32_gpiowrite(GPIO_SPI_CS_SDCARD, !selected);}
开发者ID:HimanshuKamat,项目名称:Firmware,代码行数:5,
示例29: stm32_spi2select__EXPORT void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected){ /* SPI select is active low, so write !selected to select the device */ switch (devid) { case PX4_SPIDEV_EXT0: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_EXT0, !selected); stm32_gpiowrite(GPIO_SPI_CS_EXT1, 1); stm32_gpiowrite(GPIO_SPI_CS_EXT2, 1); stm32_gpiowrite(GPIO_SPI_CS_EXT3, 1); break; case PX4_SPIDEV_EXT1: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_EXT0, 1); stm32_gpiowrite(GPIO_SPI_CS_EXT1, !selected); stm32_gpiowrite(GPIO_SPI_CS_EXT2, 1); stm32_gpiowrite(GPIO_SPI_CS_EXT3, 1); break; case PX4_SPIDEV_EXT2: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_EXT0, 1); stm32_gpiowrite(GPIO_SPI_CS_EXT1, 1); stm32_gpiowrite(GPIO_SPI_CS_EXT2, !selected); stm32_gpiowrite(GPIO_SPI_CS_EXT3, 1); break; case PX4_SPIDEV_EXT3: /* Making sure the other peripherals are not selected */ stm32_gpiowrite(GPIO_SPI_CS_EXT0, 1); stm32_gpiowrite(GPIO_SPI_CS_EXT1, 1); stm32_gpiowrite(GPIO_SPI_CS_EXT2, 1); stm32_gpiowrite(GPIO_SPI_CS_EXT3, !selected); break; default: break; }}
开发者ID:27Seanerz,项目名称:Firmware,代码行数:42,
注:本文中的stm32_gpiowrite函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ stod函数代码示例 C++ stm32_gpioread函数代码示例 |