mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-07 01:21:36 +08:00
nxphlite-v3:Define and use sensor reset pins
Define and use the Sensor reset pins. Added the cide to reset the nxphlite-v3 sensors.
This commit is contained in:
committed by
Daniel Agar
parent
c66c830909
commit
a7422dc9b6
@@ -228,11 +228,12 @@ __BEGIN_DECLS
|
|||||||
#define GPIO_SPI2_EXT (GPIO_LOWDRIVE | GPIO_OUTPUT_ONE | PIN_PORTD | PIN15)
|
#define GPIO_SPI2_EXT (GPIO_LOWDRIVE | GPIO_OUTPUT_ONE | PIN_PORTD | PIN15)
|
||||||
|
|
||||||
/* SPI device reset signals
|
/* SPI device reset signals
|
||||||
* In Inactive state
|
* In Active state
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define GPIO_GM_nRST (GPIO_LOWDRIVE | GPIO_OUTPUT_ONE | PIN_PORTD | PIN12)
|
/* Init in reset */
|
||||||
#define GPIO_A_RST (GPIO_LOWDRIVE | GPIO_OUTPUT_ZER0 | PIN_PORTA | PIN25)
|
#define GPIO_GM_nRST (GPIO_LOWDRIVE | GPIO_OUTPUT_ZER0 | PIN_PORTD | PIN12)
|
||||||
|
#define GPIO_A_RST (GPIO_LOWDRIVE | GPIO_OUTPUT_ONE | PIN_PORTA | PIN25)
|
||||||
|
|
||||||
/* Sensor interrupts */
|
/* Sensor interrupts */
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,25 @@ static const uint32_t spi2selects_gpio[] = PX4_EXTERNAL_BUS_CS_GPIO;
|
|||||||
|
|
||||||
__EXPORT void board_spi_reset(int ms)
|
__EXPORT void board_spi_reset(int ms)
|
||||||
{
|
{
|
||||||
|
/* First float the A_MISO line tied to SA0 */
|
||||||
|
|
||||||
|
kinetis_pinconfig(PX4_MK_GPIO(PIN_SPI1_SIN, PIN_MODE_ANALOG));
|
||||||
|
|
||||||
|
/* Power Down and up */
|
||||||
|
kinetis_gpiowrite(GPIO_SENSOR_P_EN, true);
|
||||||
|
up_mdelay(1);
|
||||||
|
kinetis_gpiowrite(GPIO_SENSOR_P_EN, false);
|
||||||
|
up_mdelay(1);
|
||||||
|
|
||||||
|
/* Set Rests Active */
|
||||||
|
|
||||||
|
kinetis_gpiowrite(GPIO_GM_nRST, false);
|
||||||
|
kinetis_gpiowrite(GPIO_A_RST, true);
|
||||||
|
up_mdelay(ms);
|
||||||
|
kinetis_gpiowrite(GPIO_A_RST, false);
|
||||||
|
kinetis_gpiowrite(GPIO_GM_nRST, true);
|
||||||
|
|
||||||
|
kinetis_pinconfig(PIN_SPI1_SIN);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,9 +114,8 @@ __EXPORT void board_spi_reset(int ms)
|
|||||||
|
|
||||||
void nxphlite_spidev_initialize(void)
|
void nxphlite_spidev_initialize(void)
|
||||||
{
|
{
|
||||||
|
board_spi_reset(10);
|
||||||
|
|
||||||
kinetis_pinconfig(GPIO_GM_nRST);
|
|
||||||
kinetis_pinconfig(GPIO_A_RST);
|
|
||||||
kinetis_pinconfig(GPIO_EXTI_BARO_INT1);
|
kinetis_pinconfig(GPIO_EXTI_BARO_INT1);
|
||||||
kinetis_pinconfig(GPIO_P_INT);
|
kinetis_pinconfig(GPIO_P_INT);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user