コード例 #1
0
ファイル: main.c プロジェクト: Zeke-OS/zeke
int main(void)
{
    struct sched_param param = { .sched_priority = 0 };
    FILE * fp;
    size_t fb_size;

    if (sched_setscheduler(getpid(), SCHED_FIFO, &param)) {
        perror("failed to set SCHED_FIFO");
        return 1;
    }

    bip = bitmap_load("ball.bmp");
    if (!bip) {
        perror("Failed to load a bitmap");
        return 1;
    }

    fp = fopen("/dev/fbmm0", "r");
    if (!fp) {
        perror("Failed to open fb");
        return 1;
    }

    ioctl(fileno(fp), IOCTL_FB_GETRES, &resolution);
    fb_size = resolution.height * resolution.pitch + resolution.width * 3;

    fb = mmap(NULL, fb_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fileno(fp), 0);
    bf = malloc(fb_size);

    bouncer();

    munmap(fb, 0);

    return 0;
}
コード例 #2
0
ファイル: main.cpp プロジェクト: Nasrollah/uDeviceX
int main()
{
    const float L = 40;
    const int Nm = 3;
    const int n = L * L * L * Nm;
    const float dt = 0.02;

    printf("START EQUILIBRATION\n");
    Particles particles(n, L);
    particles.equilibrate(0.1, 100 * dt, dt, nullptr);
    printf("STOP EQUILIBRATION\n");
    const float sandwich_half_width = L / 2 - 1.7;
#if 1
    TomatoSandwich bouncer(L);
    bouncer.radius2 = 4;
    bouncer.half_width = sandwich_half_width;
#else
    SandwichBouncer bouncer(L);
    bouncer.half_width = sandwich_half_width;
#endif
 printf("START CARVING\n");
    Particles remaining = bouncer.carve(particles);

    printf("STOP TOMATO\n");
    //bouncer.frozenLayer[0].lammps_dump("icy.dump", 0);
    //bouncer.frozenLayer[1].lammps_dump("icy.dump", 1);
    //bouncer.frozenLayer[2].lammps_dump("icy.dump", 2);

    remaining.name = "fluid";
    
    //remaining1.bouncer = &bouncer;
    remaining.yg = 0.01;
    remaining.steps_per_dump = 10;
    remaining.equilibrate(0.1, 1500 * dt, dt, &bouncer);
    printf("particles have been equilibrated");
}
コード例 #3
0
ファイル: main.c プロジェクト: parkerpatriot/space-invaders
// This is invoked each time there is a change in the button state (result of a push or a bounce).
void pb_interrupt_handler() {
	// Clear the GPIO interrupt.

	// Turn off all PB interrupts for now.
	XGpio_InterruptGlobalDisable(&gpPB);
	// Get the current state of the buttons.
	u32 currentButtonState = XGpio_DiscreteRead(&gpPB, 1);

	bouncing = bouncer(currentButtonState);

	// Ack the PB interrupt.
	XGpio_InterruptClear(&gpPB, 0xFFFFFFFF);
	// Re-enable PB interrupts.
	XGpio_InterruptGlobalEnable(&gpPB);
}