Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: TLC59116
Fork of led-panel by
Revision 6:d813296f9f41, committed 2021-11-09
- Comitter:
- Suzutomo
- Date:
- Tue Nov 09 08:03:55 2021 +0000
- Parent:
- 5:f7b4ba4aa6af
- Commit message:
- Delete: comment code
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r f7b4ba4aa6af -r d813296f9f41 main.cpp --- a/main.cpp Tue Nov 09 08:01:59 2021 +0000 +++ b/main.cpp Tue Nov 09 08:03:55 2021 +0000 @@ -150,161 +150,4 @@ b *= 255; return ((int)r << 16) | ((int)g << 8) | (int)b; -} - - -/* -SPI spi(PB_15,PB_14,PB_13); - -DigitalOut cs(PC_0); - -DigitalIn sv2[8] = { - PC_4, - PA_10, - PB_13, - PB_5, - PB_14, - PB_4, - PB_15, - PB_10, -}; - -DigitalOut clk(PC_9); -DigitalOut oe(PC_5,0); -//PwmOut intb(PA_12); -PwmOut sdb(PA_11); -Thread te; - -volatile bool touch[8] = {0}; - - -const int generallyWait = 200; - -void GetData(char com,char *data,int length) -{ - cs = 0; - char enable = spi.write(com); - wait_us(generallyWait); - if (enable == 0x55) { - for (int i = 0; i < length; i++) { - data[i] = spi.write(0x00); - wait_us(generallyWait); - } - } else printf("error\r\n"); - cs = 1; -} - -void SetData(char com,char *data,int length) -{ - cs = 0; - char enable = spi.write(com); - wait_us(generallyWait); - if (enable == 0x55) { - for (int i = 0; i < length; i++) { - spi.write(data[i]); - wait_us(generallyWait); - } - } else printf("error\r\n"); - cs = 1; - wait_us(150*1e3); -} - -int Reset() -{ - cs = 0; - char enable = spi.write(0x04); - cs = 1; - wait_us(180 * 1e3); - return enable == 0x55; -} - -int EraseEeprom() -{ - cs = 0; - char enable = spi.write(0x0C); - cs = 1; - wait_us(60 * 1e3); - return enable == 0x55; -} - -int Calibrate() -{ - cs = 0; - char enable = spi.write(0x03); - cs = 1; - wait_us(180 * 1e3); - return enable == 0x55; -} - - -void teTh() -{ - int place[8] = {0,1,8,9,6,7,4,5}; - char *data; - data = new char[2]; - while(1) { - GetData(0xC1,data,2); - int d = (data[0] << 8)| data[1]; - for (int i = 0; i < 8; i++) { - touch[i] = (d >> place[i]) & 0x1; - } - - for (int i = 7; i >= 0; i--) { - printf("%x",touch[i]); - } - printf("\r\n"); - - //wait_us(100); - - } - delete data; -} - - -void main() { - cs = 1; - - spi.format(8,3); - spi.frequency(1500000); - - char* data; - printf("Reset : %s\r\n",Reset() ? "OK" : "FALSE"); - printf("Erase EEPROM : %s\r\n",EraseEeprom() ? "OK" : "FALSE"); - - - - - - - data = new char[1]; - data[0] = 0b11110010; - - SetData(0x90,data,1); - data[0] = 0b0; - SetData(0x97,data,1); - SetData(0x98,data,1); - - data[0] = 0b00101000; - for (int i = 0; i < 11; i++) { - SetData(0xA3 + i,data,1); - } - - - printf("Calibrate : %s\r\n",Calibrate() ? "OK" : "FALSE"); - - data = new char[42]; - GetData(0xC8,data,42); - - //spi.write(0xC9); -//wait_us(150); -//printf("%x\r\n",spi.write(0x00)); -//cs = 1; -//wait_us(50 * 1e3); - - - //while (user.read()); - //te.start(teTh); - - -} -*/ \ No newline at end of file +} \ No newline at end of file