summaryrefslogtreecommitdiff
path: root/src/keypad.hpp
blob: 8a9929083adab2f3855b9b84ea3fc9e79ad702fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "pico/stdlib.h"
#define OUT true
#define IN false
#define KEYPAD_LEN 4
#pragma once

class Keypad {
private:
  // Start private attributes.
  uint *rows{};
  uint *cols{};
  char chars[4][4];
  // End private attributes.
  
  // Start private methods.
  void initCharArray(char chars[4][4]);
  void init();
  uint pressedColumn();
  void pullPinsDown(uint *pins);
  void restartPins();
  // End private methods.
public:
  // Start public methods.
  Keypad(uint *rows, uint *cols, char chars[4][4]);
  bool keyPressed();
  char getKey();
  // End public methods.
};