Permalink
Checking mergeability…
Don’t worry, you can still create the pull request.
Comparing changes
Choose two branches to see what’s changed or to start a new pull request.
If you need to, you can also .
Open a pull request
Create a new pull request by comparing changes across two branches. If you need to, you can also .
- 7 commits
- 5 files changed
- 0 comments
- 1 contributor
Commits on Sep 18, 2018
Unified
Split
Showing
with
558 additions
and 511 deletions.
- +31 −2 MonomeController.cpp
- +2 −0 MonomeController.h
- +481 −482 MonomeFTDI.cpp
- +6 −5 MonomeFTDI.h
- +38 −22 MonomeHost.ino
| @@ -136,6 +136,21 @@ uint8_t MonomeController::CheckDeviceDesc(char* mstr, char* pstr, char* sstr) { | ||
| setup_series(16, 8); | ||
| return 1; | ||
| } | ||
| // if( strncmp(buf, "m10", 3) == 0 ) { | ||
| // // series 128 | ||
| // PRINT_DBG("\r\n 128 found!"); | ||
| // | ||
| // setup_mext(16, 8); | ||
| // return 1; | ||
| // } | ||
| //// | ||
| // if( strncmp(buf, "m11", 3) == 0 ) { | ||
| // // arc4 | ||
| // PRINT_DBG("\r\n arc4 found!"); | ||
| // | ||
| // setup_series(16, 8); | ||
| // return 1; | ||
| // } | ||
| if( strncmp(buf, "m256-", 5) == 0 ) { | ||
| // series 256 | ||
| setup_series(16, 16); | ||
| @@ -365,19 +380,24 @@ uint8_t MonomeController::setup_mext(void) | ||
|
|
||
| rx_bytes = 0; | ||
|
|
||
| while(rx_bytes != 6) { | ||
| while(rx_bytes < 6) { | ||
| delay(1); | ||
| ftdi_.write(1, &w); // query | ||
| PRINT_DBG("\r\n ftidway"); | ||
|
|
||
| delay(1); | ||
| ftdi_.read(); | ||
|
|
||
| delay(1); | ||
| rx_bytes = ftdi_.rx_bytes(); | ||
| PRINT_DBG(rx_bytes); | ||
| } | ||
|
|
||
| prx = ftdi_.rx_buf(); | ||
|
|
||
| PRINT_DBG("\r\n ftdi"); | ||
|
|
||
|
|
||
| prx++; // 1st returned byte is 0 | ||
| if(*prx == 1) { | ||
| desc_.device = eDeviceGrid; | ||
| @@ -398,6 +418,7 @@ uint8_t MonomeController::setup_mext(void) | ||
| desc_.cols = 16; | ||
| } | ||
| else { | ||
| PRINT_DBG("\r\n bail"); | ||
| return 0; // bail | ||
| } | ||
| desc_.tilt = 1; | ||
| @@ -406,10 +427,12 @@ uint8_t MonomeController::setup_mext(void) | ||
| desc_.device = eDeviceArc; | ||
| desc_.encs = *(++prx); | ||
| } else { | ||
| PRINT_DBG("\r\n bail"); | ||
|
|
||
| return 0; // bail | ||
| } | ||
|
|
||
| // get id | ||
| // get id | ||
| w = 1; | ||
| delay(1); | ||
| ftdi_.write(1, &w); | ||
| @@ -485,6 +508,8 @@ void MonomeController::parse_serial_mext(void) { | ||
| uint8_t com; | ||
| uint8_t rx_bytes; | ||
|
|
||
| // PRINT_DBG("parse\n"); | ||
|
|
||
| rx_bytes = ftdi_.rx_bytes(); | ||
| if( rx_bytes ) { | ||
| nbp = 0; | ||
| @@ -494,11 +519,15 @@ void MonomeController::parse_serial_mext(void) { | ||
| nbp++; | ||
| switch(com) { | ||
| case 0x20: // grid key up | ||
| // PRINT_DBG("grid key up"); | ||
|
|
||
| (*grid_key_)( *prx, *(prx+1), 0); | ||
| nbp += 2; | ||
| prx += 2; | ||
| break; | ||
| case 0x21: // grid key down | ||
| // PRINT_DBG("grid key down"); | ||
|
|
||
| (*grid_key_)( *prx, *(prx+1), 1); | ||
| nbp += 2; | ||
| prx += 2; | ||
| @@ -87,6 +87,8 @@ class MonomeController : public MonomeReportParser { | ||
| // parse serial data | ||
| // void Parse(MonomeFtdi* ftdi, uint32_t len, uint8_t *buf) { | ||
| void Parse(void) { | ||
| // PRINT_DBG("parse!!\n"); | ||
|
|
||
| /// FIXME | ||
| /// as noted in MonomeFTDI.h, this is pretty bad form | ||
| (this->*parse_serial_)(); | ||
Oops, something went wrong.