Subversion Repositories NaviCtrl

Compare Revisions

Ignore whitespace Rev 6 → Rev 7

/branches/V0.1 killagreg/led.c
0,0 → 1,29
#include "led.h"
 
 
void Led_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
 
SCU_APBPeriphClockConfig(__GPIO5, ENABLE); // Enable the GPIO5 Clock
/*Configure LED_GRN at pin GPIO5.6 and LED_ROT at pin GPIO5.7*/
GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7;
GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ;
GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt1 ;
GPIO_Init(GPIO5, &GPIO_InitStructure);
 
/* Configure SD_SWITCH at pin GPIO5.3*/
GPIO_InitStructure.GPIO_Direction = GPIO_PinInput;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3;
GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull;
GPIO_InitStructure.GPIO_Alternate = GPIO_InputAlt1;
GPIO_Init(GPIO5, &GPIO_InitStructure);
LED_GRN_OFF;
LED_RED_OFF;
}
 
 
 
/branches/V0.1 killagreg/led.h
0,0 → 1,17
#ifndef _LED_H
#define _LED_H
 
#include "91x_lib.h"
 
#define LED_GRN_ON GPIO_WriteBit(GPIO5, GPIO_Pin_6, Bit_SET)
#define LED_GRN_OFF GPIO_WriteBit(GPIO5, GPIO_Pin_6, Bit_RESET)
#define LED_GRN_TOGGLE if (GPIO_ReadBit(GPIO5, GPIO_Pin_6)) LED_GRN_OFF; else LED_GRN_ON;
 
#define LED_RED_ON GPIO_WriteBit(GPIO5, GPIO_Pin_7, Bit_SET)
#define LED_RED_OFF GPIO_WriteBit(GPIO5, GPIO_Pin_7, Bit_RESET)
#define LED_RED_TOGGLE if (GPIO_ReadBit(GPIO5, GPIO_Pin_7)) LED_RED_OFF; else LED_RED_ON;
 
extern void Led_Init(void);
 
#endif //_LED_H