本文整理汇总了C++中GPIOPinRead函数的典型用法代码示例。如果您正苦于以下问题:C++ GPIOPinRead函数的具体用法?C++ GPIOPinRead怎么用?C++ GPIOPinRead使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GPIOPinRead函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: toggle
void toggle(){
if(GPIOPinRead(GPIO_PORTF_BASE, GREEN_LED)){
GPIOPinWrite(GPIO_PORTF_BASE, GREEN_LED, 0);
}else{
GPIOPinWrite(GPIO_PORTF_BASE, GREEN_LED, GREEN_LED);
}
}
示例2: getDigit
//get Digit from IR
int getDigit () // determine binary number from pulse delay
{
waitTime=0;
while(!GPIOPinRead(GPIO_PORTB_BASE,GPIO_PIN_1))
{
}
if(waitTime >6)
return 2;
waitTime=0;
while(GPIOPinRead(GPIO_PORTB_BASE,GPIO_PIN_1))
{
}
if(waitTime>14)
return 1;
else
return 0;
}
示例3: Pin_Read
unsigned char Pin_Read(tPinName pin)
{
// Check for valid pin name
if (pin == NONE || pin == ERR)
return -1;
// Return 1 or 0
return GPIOPinRead(pins[pin].port.base, pins[pin].offset) == 0 ? 0 : 1;
}
示例4: main
int main(void)
{
//initialize the GPIO ports
PortFunctionInit();
// turn LED D1 on at the beginning
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 0x02);
bool button_first_time_pressed = false;
bool button_pressed = false;
float delay = 16000000/3/4; // half a second delay
int turn_led_on = 1;
//
// Loop forever.
//
while(1)
{
if(GPIOPinRead(GPIO_PORTJ_AHB_BASE, GPIO_PIN_1)==0x00) //SW2 is pressed
{
button_first_time_pressed = true;
button_pressed = true;
}
else
{
button_pressed = false;
}
// after button is pressed for the first time
if(button_first_time_pressed)
{
if(button_pressed)
{
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 0x00); // turn off D1
SysCtlDelay(delay); // half a second delay
turn_led_on = 1 - turn_led_on; // toggle between 0 and 1
if (turn_led_on)
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, 0x01); // turn on D2
else
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, 0x00); // turn off D2
}
else // toggle LED D1
{
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, 0x00); // turn off D2
SysCtlDelay(delay); // half a second delay
turn_led_on = 1 - turn_led_on; // toggle between 0 and 1
if (turn_led_on)
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 0x02); // turn on D1
else
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 0x00); // turn off D1
}
}
}
}
示例5: EvalDirBtnsHandler
// ******** OS_DownSwitch_Handler ************
// Check if time since last down press >.3s, for debouncing, call buttontask appropriately
// input: none,
// output: none,
void EvalDirBtnsHandler(){
IntDisable(INT_GPIOE);
GPIOPinIntClear(GPIO_PORTE_BASE, GPIO_PIN_1);
while(OS_MsTime() - btndown_time < 500); // Wait for 10 ms
if(GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_1) == 0){
//BUTTONTASK(); //supposed to trigger the function that button task points to
// Toggle Debug LED
if (GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_0) == 0)
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_PIN_0);
else
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0, 0);
}
btndown_time=OS_MsTime();
IntEnable(INT_GPIOE);
}
示例6: SelectBtnHandler
// ******** OS_SelectSwitch_Handler ************
// Check if time since last switch press >.3s, for debouncing, call buttontask appropriately
// input: none,
// output: none,
void SelectBtnHandler(){
IntDisable(INT_GPIOF);
GPIOPinIntClear(GPIO_PORTF_BASE, GPIO_PIN_1);
//currentTime=OS_MsTime();
while(OS_MsTime() - SDEBOUNCEPREV < 500); // Wait for 10 ms
if(GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_1) == 0){
// Toggle Debug LED
if (GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_0) == 0)
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_PIN_0);
else
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0, 0);
BUTTONTASK(); //supposed to trigger the function that button task points to
}
SDEBOUNCEPREV=OS_MsTime();
IntEnable(INT_GPIOF);
}
示例7: interrupt_handler
void interrupt_handler(void)
{
GPIOIntClear(GPIO_PORTB_BASE, GPIO_INT_PIN_2);
if(GPIOPinRead(GPIO_PORTB_BASE, GPIO_PIN_2) == 0x0) {
isr_flag = 1;
}
}
示例8: CheckSwitches
char CheckSwitches() {
long lSwt1;
long lSwt2;
chSwtPrev = chSwtCur;
lSwt1 = GPIOPinRead(SWT1Port, SWT1);
lSwt2 = GPIOPinRead(SWT2Port, SWT2);
chSwtCur = (lSwt1 | lSwt2) >> 6;
if(chSwtCur != chSwtPrev) {
fClearOled = true;
}
return chSwtCur;
}
示例9: brakeHandler
void brakeHandler(){
GPIOIntClear(GPIO_PORTB_BASE, GPIO_INT_PIN_0);
if(GPIOPinRead(GPIO_PORTB_BASE, GPIO_PIN_0) == 0x0)
{
enableSys = 0;
}
}
示例10: GPIOPinRead
bool Board::getLed(int32_t led) {
int32_t value;
if (led == LED_RED) {
value = GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_1);
if (value)
return true;
}
if (led == LED_BLUE) {
value = GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_2);
if (value)
return true;
}
if (led == LED_GREEN) {
value = GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_3);
if (value)
return true;
}
return false;
}
示例11: RD_6963
//========================
uint8 RD_6963()
{
uint8 read_data;
GPIOPinTypeGPIOInput(PORT_DATA6963, WHOLE_PORT ); //DATA 至数
GPIOPinWrite(PORT_SET6963 ,PIN_CE6963,0);
GPIOPinWrite(PORT_SET6963,PIN_RD6963,0);
read_data=(uint8)GPIOPinRead(PORT_DATA6963, WHOLE_PORT );
GPIOPinWrite(PORT_SET6963,PIN_CE6963|PIN_RD6963,PIN_CE6963|PIN_RD6963);
return(read_data);
}
示例12: main
//! With this setup it would seem like main() must be the first function in this file, otherwise
//! the wrong function gets called on reset.
void main(void)
{
volatile INT32U ulLoop;
volatile INT16U event;
volatile INT16U push;
//Hardware upstarts
initHW();
//! Start the OLED display and write a message on it
RIT128x96x4Init(ulSSI_FREQUENCY);
RIT128x96x4StringDraw("EMP", 15, 42, mainFULL_SCALE);
RIT128x96x4StringDraw("enter the code.....", 5, 49, mainFULL_SCALE);
RIT128x96x4StringDraw("SW2 SW3 SW4 SW5 SW6", 15, 57, mainFULL_SCALE);
// Entry Password see under inputs
// Wait for the select key to be pressed
while (GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_1));
// Wait for the select key to be pressed
while (GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_0));
// Wait for the select key to be pressed
while (GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_1));
// Wait for the select key to be pressed
while (GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_2));
// Wait for the select key to be pressed
while (GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_3));
// Clean the OLED display.
RIT128x96x4Clear();
//
// Loop forever.
//
while (1)
{
// Statmashine function
// This is where a statemachine could be added
event = GetKeyEvents();
push = select_button();
statemashine(event , push);
//all functions the
}
}
示例13: interrupt_handler
void interrupt_handler(void)
{
GPIOIntClear(GPIO_PORTF_BASE, GPIO_INT_PIN_2 | GPIO_INT_PIN_3);
if(GPIOPinRead(port_F, GPIO_PIN_2) == 0x0) {
display_flag = 1;
}
}
示例14: Timer0IntHandler
void Timer0IntHandler(void)
{
int i;
// Limpia el flag de interrupcion
TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
/* //Escribo el comando en el YEI
for(i=0; i<sizeof(todos_normalizados); i++){
UARTCharPut(UART4_BASE, todos_normalizados[i]);}*/
/* //Escribo el comando en el YEI
for(i=0; i<sizeof(giroscopo); i++){
UARTCharPut(UART4_BASE, giroscopo[i]);}*/
//Escribo el comando en el YEI
for(i=0; i<sizeof(aceleracion); i++){
UARTCharPut(UART4_BASE, aceleracion[i]);}
/* //Escribo el comando en el YEI
for(i=0; i<sizeof(magnetometro); i++){
UARTCharPut(UART4_BASE, magnetometro[i]);}*/
//Escribo el comando en el YEI
for(i=0; i<sizeof(orientacion); i++){
UARTCharPut(UART4_BASE, orientacion[i]);}
cThisChar='0';
int contador2=0;
int contador_end_lines=0;
do{
cThisChar=UARTCharGet(UART4_BASE);
BuffYEI[contador2]=cThisChar;
contador2=contador2+1;
if((cThisChar == '\n'))
contador_end_lines=contador_end_lines+1;
} while(contador_end_lines != 2);
rc = f_open(&Fil, "BuffGPS.TXT", FA_WRITE | FA_OPEN_ALWAYS); //abre o crea un archivo
rc = f_lseek(&Fil, Fil.fsize);
rc = f_write(&Fil, &BuffYEI, contador2, &bw);
rc = f_sync(&Fil);
rc = f_close(&Fil);
if(GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_2))
{
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 0);
}
else
{
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 4);
}
}
示例15: displayScore
void displayScore () {
char scoreStr[8];
if(score<0)score=0; //Dont wanna mock the user with negative scores
if (score>highScore) {
OrbitOledClear();
drawPusheen (); //Pusheen drawn on the right
//Code for displaying high score on the left (columns 0 - 7)
OrbitOledMoveTo(92, 0);
OrbitOledDrawString("NEW");
OrbitOledMoveTo(88, 8);
OrbitOledDrawString("HIGH");
OrbitOledMoveTo(84, 16);
OrbitOledDrawString("SCORE");
OrbitOledMoveTo(84,24);
sprintf(scoreStr, "%05d", score);
OrbitOledDrawString (scoreStr);
OrbitOledUpdate();
highScore=score;
}
else{
OrbitOledClear();;
//Display the current score
OrbitOledSetCursor (3, 2);
OrbitOledPutString ("SCORE:");
OrbitOledSetCursor (10, 2);
sprintf(scoreStr, "%05d", score);
OrbitOledPutString (scoreStr);
}
long lBtn1;
lBtn1 = GPIOPinRead(BTN1Port, BTN1);
while(lBtn1!=BTN1){
updateLED(4);
delay(100);
updateLED(0);
delay(100);
lBtn1 = GPIOPinRead(BTN1Port, BTN1);
}
}