| 84 | } |
| 85 | |
| 86 | void Keyboard_Class::updateKeyList() |
| 87 | { |
| 88 | _key_list_buffer.clear(); |
| 89 | Point2D_t coor; |
| 90 | uint8_t input_value = 0; |
| 91 | |
| 92 | for (int i = 0; i < 8; i++) |
| 93 | { |
| 94 | _set_output(output_list, i); |
| 95 | input_value = _get_input(input_list); |
| 96 | /* If key pressed */ |
| 97 | |
| 98 | if (input_value) |
| 99 | { |
| 100 | /* Get X */ |
| 101 | for (int j = 0; j < 7; j++) |
| 102 | { |
| 103 | if (input_value & (0x01 << j)) |
| 104 | { |
| 105 | coor.x = (i > 3) ? X_map_chart[j].x_1 : X_map_chart[j].x_2; |
| 106 | |
| 107 | /* Get Y */ |
| 108 | coor.y = (i > 3) ? (i - 4) : i; |
| 109 | // printf("%d,%d\t", coor.x, coor.y); |
| 110 | |
| 111 | /* Keep the same as picture */ |
| 112 | coor.y = -coor.y; |
| 113 | coor.y = coor.y + 3; |
| 114 | |
| 115 | _key_list_buffer.push_back(coor); |
| 116 | } |
| 117 | } |
| 118 | } |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | uint8_t Keyboard_Class::isPressed() |
| 123 | { |