Add alternative function to pinmap for STM32.

pull/8/head
Joe Turner 2013-04-24 09:39:28 +01:00
parent 40abe5fb74
commit 4718fc6e2b
2 changed files with 9 additions and 0 deletions

View File

@ -26,9 +26,15 @@ typedef struct {
PinName pin;
int peripheral;
int function;
#ifdef defined(TARGET_STM32F407)
int alternate_function;
#endif
} PinMap;
void pin_function(PinName pin, int function);
# if defined(TARGET_STM32F407)
void pin_alternate_function(PinName pin, int alternate_function);
#endif
void pin_mode (PinName pin, PinMode mode);
uint32_t pinmap_peripheral(PinName pin, const PinMap* map);

View File

@ -22,6 +22,9 @@ void pinmap_pinout(PinName pin, const PinMap *map) {
while (map->pin != NC) {
if (map->pin == pin) {
pin_function(pin, map->function);
#if defined(TARGET_STM32F407)
pin_alternate_function(pin, map->alternate_function);
#endif
pin_mode(pin, PullNone);
return;
}