int main(int argc, char **argv) { InitGPIO(); while(1) { print_motor_status(); print_button_status(); /* int * pins = (int *) malloc(sizeof(int) * 22); int i = 0; while(i < 22) { pins[i] = GetGPIOPin(i); printf("%d ", pins[i]); i++; } printf("\n"); */ sleep(1); } CleanupGPIO(); CleanupPPC(); return 0; }
void cleanuppwm(void) { int i; // enable standby gpio_set_value(channels[0].stby, 0); rtdm_timer_destroy(&up_timer); for(i = 0; i < RC_NUM; ++i) rtdm_timer_destroy(&down_timer[i]); CleanupGPIO(channels, sizeof(channels) / sizeof(channels[0])); }
int main(int argc, char **argv) { printf("Begin\n"); InitGPIO(); //while(GetGPIOPin(8)) { // if(!GetGPIOPin(9)) { // printf("button is pressed\n"); // } //} SetGPIOPinDir(2,1); SetGPIOPinDir(3,1); SetGPIOPinDir(4,1); SetGPIOPinDir(5,1); SetGPIOPinDir(6,1); SetGPIOPinDir(7,1); SetGPIOPin(4); SetGPIOPin(7); while (1) { int left = GetGPIOPin(3); int right = GetGPIOPin(6); if(!GetGPIOPin(8)) { if(left) SetGPIOPin(3); else { ClearGPIOPin(3); } } if(!GetGPIOPin(9)) { if(left) SetGPIOPin(6); else { ClearGPIOPin(6); } } sleep(5); } CleanupGPIO(); return 0; }
void Motor_cleanup(){ CleanupGPIO(); }
static void hello_exit(void) { printk(KERN_ALERT "Module stopping.\n"); CleanupGPIO(); CleanupPPC(); }