| 65 | |
| 66 | |
| 67 | Point2D_t Keyboard::getKey() |
| 68 | { |
| 69 | Point2D_t coor; |
| 70 | coor.x = -1; |
| 71 | coor.y = -1; |
| 72 | |
| 73 | uint8_t input_value = 0; |
| 74 | |
| 75 | for (int i = 0; i < 8; i++) { |
| 76 | _set_output(output_list, i); |
| 77 | // printf("% 3d,\t", get_input(inputList)); |
| 78 | |
| 79 | input_value = _get_input(input_list); |
| 80 | |
| 81 | /* If key pressed */ |
| 82 | if (input_value) { |
| 83 | |
| 84 | /* Get X */ |
| 85 | for (int j = 0; j < 7; j++) { |
| 86 | if (input_value == X_map_chart[j].value) { |
| 87 | coor.x = (i > 3) ? X_map_chart[j].x_1 : X_map_chart[j].x_2; |
| 88 | break; |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | /* Get Y */ |
| 93 | coor.y = (i > 3) ? (i - 4) : i; |
| 94 | |
| 95 | /* Keep the same as picture */ |
| 96 | coor.y = -coor.y; |
| 97 | coor.y = coor.y + 3; |
| 98 | |
| 99 | |
| 100 | break; |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | // printf("%d,%d\n", x, y); |
| 105 | return coor; |
| 106 | } |
| 107 | |
| 108 | |
| 109 | uint8_t Keyboard::getKeyNum(Point2D_t keyCoor) |
nothing calls this directly
no outgoing calls
no test coverage detected