OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [bootloaders/] [orpmon/] [cmds/] [touch.c] - Diff between revs 175 and 406

Show entire file | Details | Blame | View Log

Rev 175 Rev 406
Line 7... Line 7...
        unsigned long x, y, z1, z2;
        unsigned long x, y, z1, z2;
        float res;
        float res;
 
 
        if (argc == 0) {
        if (argc == 0) {
                printf("usage:  -r  read coordinates\n");
                printf("usage:  -r  read coordinates\n");
                printf("        -c  read coordinates in a loop (press any key to exit)\n");
                printf
        }
                    ("        -c  read coordinates in a loop (press any key to exit)\n");
        else if (argc == 1) {
        } else if (argc == 1) {
                if (!strcmp(argv[0], "-r")) {
                if (!strcmp(argv[0], "-r")) {
                        spi_init(0, 1000000, 21, 0, 1, 0);
                        spi_init(0, 1000000, 21, 0, 1, 0);
                        printf("X = %.3lx\n", spi_xmit(0xd3l << 13) & 0xfff);
                        printf("X = %.3lx\n", spi_xmit(0xd3l << 13) & 0xfff);
                        printf("Y = %.3lx\n", spi_xmit(0x93l << 13) & 0xfff);
                        printf("Y = %.3lx\n", spi_xmit(0x93l << 13) & 0xfff);
                }
                } else if (!strcmp(argv[0], "-c")) {
                else if (!strcmp(argv[0], "-c")) {
 
                        spi_init(0, 1000000, 21, 0, 1, 0);
                        spi_init(0, 1000000, 21, 0, 1, 0);
                        while (1) {
                        while (1) {
                                x = spi_xmit(0xd3l << 13) & 0xfff;
                                x = spi_xmit(0xd3l << 13) & 0xfff;
                                z1 = spi_xmit(0xb3l << 13) & 0xfff;
                                z1 = spi_xmit(0xb3l << 13) & 0xfff;
                                z2 = spi_xmit(0xc3l << 13) & 0xfff;
                                z2 = spi_xmit(0xc3l << 13) & 0xfff;
Line 32... Line 31...
                                }
                                }
                                if (testc())
                                if (testc())
                                        break;
                                        break;
                        }
                        }
                }
                }
        }
        } else {
        else {
 
                printf("usage:  -r  read coordinates\n");
                printf("usage:  -r  read coordinates\n");
                printf("        -c  read coordinates in a loop (press any key to exit)\n");
                printf
 
                    ("        -c  read coordinates in a loop (press any key to exit)\n");
        }
        }
 
 
        return 0;
        return 0;
}
}
 
 
void module_touch_init (void)
void module_touch_init (void)
{
{
  register_command ("touch", "", "touch screen utility", touch_cmd);
  register_command ("touch", "", "touch screen utility", touch_cmd);
}
}
 
 
 
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.