GPIO output to Expansion header pins?

Firmware/software/electronics/mechanics
Post Reply
DesTinY
Member
Posts: 97
Joined: Sat Feb 09, 2013 5:18 pm
Location: Bünde, Germany

GPIO output to Expansion header pins?

Post by DesTinY »

Hi,
i want to use two digital output bits on the Expansion header.
Question: Is it possible? Can I Remap e.g. EXT_SPI_xxx Pins in the FW to digital outputs?

Maybe that is also interesting for every one who wants to switch on external peripherals like LEDs, buzzer or something else.
I need it for the CrazyCrane project to control the external motor driver IC :D 8-)
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: GPIO output to Expansion header pins?

Post by tobias »

Yes you can use them as GPIO pins but you need to initialise them in the code in order to be able to use them. How familiar are you with MCU:s? As the expansion pins are not externally protected it might be wise to put a series resistor between the expansion port and the motor driver.

Then you would need a trigger mechanism and what would be simplest to do right now is to as parameters for them. e.g.

Code: Select all

...
uint8_t craneUp;
uint8_t craneDown;
...
PARAM_GROUP_START(crane)
PARAM_ADD(PARAM_UINT8, up, &craneUp)
PARAM_ADD(PARAM_UINT8, down, &craneDown)
PARAM_GROUP_STOP(crane)
The parameters will then automatically end up in the param tab in the cf-client and you can manipulate them from there. Later you can directly map the parameters to e.g. button but we take that when you get here.
Good luck! (love your crane by the way :D )
DesTinY
Member
Posts: 97
Joined: Sat Feb 09, 2013 5:18 pm
Location: Bünde, Germany

Re: GPIO output to Expansion header pins?

Post by DesTinY »

Hi Tobias,
I'm not so familiar with MCUs.
But i've managed to map 2 Dig. Out GPIO to the EXT Header and can switch it with parameters! Juhu :D
But i don't know where i should call my extioUpdate() funktion. At the moment i call it in the workerLoop() :oops:
Can you give me a TIP where i can call it cyclic.

Next step is to map the parameter to buttons on the controller. Don't know how, until now. ;)
EDIT: I think i will look at the hover mode mod by phiamo for the button mappings
Post Reply