GPIO pins

Discussions and questions about the Crazyflie Nano Quadcopter
Post Reply
Posts: 51
Joined: Wed Dec 17, 2014 12:56 pm

GPIO pins

Post by Call_me_a_Cab » Fri Feb 27, 2015 5:02 pm

Hi all,
I have a keychain camera from a cheerson quad that I crashed one too many times, after messing around on a bread board, I find that if I pulse one on the pins low twice I can start to record video.

I would like to write some code to use the expansion pins to start and stop recording via a tactile switch to start with.

Could anyone help with where I should start looking at implementing the code? I think the stm32 IO 1-4 would be good to use but I'm concerned that I will inhibit some other functions if I start messing with the registers.

Any advice?

Posts: 1879
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: GPIO pins

Post by tobias » Mon Mar 02, 2015 10:15 am

Until we have implemented the expansion board API it is a bit more work to get it going. Please have a look in exptest.c where you can find all the expansion board pin defines and an example of how to set them up. You should be able to copy most of the code you need from there.

I guess the tactile switch is pulling a signal low to detect the button press. So configure the GPIO in open-drain mode:

Code: Select all

    GPIO_InitStructure.GPIO_Pin = GPIO_PIN_TO_USE
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
    GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
    GPIO_InitStructure.GPIO_Speed = GPIO_Low_Speed;
    GPIO_Init(GPIO_PORT_TO_USE, &GPIO_InitStructure);

Post Reply