// Autogenerated C header file for Matrix Keypad
#ifndef _JACDAC_SPEC_MATRIX_KEYPAD_H
#define _JACDAC_SPEC_MATRIX_KEYPAD_H 1

#define JD_SERVICE_CLASS_MATRIX_KEYPAD  0x13062dc8

// enum Variant (uint8_t)
#define JD_MATRIX_KEYPAD_VARIANT_MEMBRANE 0x1
#define JD_MATRIX_KEYPAD_VARIANT_KEYBOARD 0x2
#define JD_MATRIX_KEYPAD_VARIANT_ELASTOMER 0x3
#define JD_MATRIX_KEYPAD_VARIANT_ELASTOMER_LEDPIXEL 0x4

/**
 * Read-only. The coordinate of the button currently pressed. Keys are zero-indexed from left to right, top to bottom:
 * ``row = index / columns``, ``column = index % columns``.
 */
#define JD_MATRIX_KEYPAD_REG_PRESSED JD_REG_READING
typedef struct jd_matrix_keypad_pressed {
    uint8_t index[0];
} jd_matrix_keypad_pressed_t;


/**
 * Constant # uint8_t. Number of rows in the matrix
 */
#define JD_MATRIX_KEYPAD_REG_ROWS 0x180

/**
 * Constant # uint8_t. Number of columns in the matrix
 */
#define JD_MATRIX_KEYPAD_REG_COLUMNS 0x181

/**
 * Constant. The characters printed on the keys if any, in indexing sequence.
 */
#define JD_MATRIX_KEYPAD_REG_LABELS 0x182
typedef struct jd_matrix_keypad_labels {
    char label[0][0];  // string0
} jd_matrix_keypad_labels_t;


/**
 * Constant Variant (uint8_t). The type of physical keypad. If the variant is ``ElastomerLEDPixel``
 * and the next service on the device is a ``LEDPixel`` service, it is considered
 * as the service controlling the LED pixel on the keypad.
 */
#define JD_MATRIX_KEYPAD_REG_VARIANT JD_REG_VARIANT

/**
 * Argument: uint8_t. Emitted when a key, at the given index, goes from inactive (`pressed == 0`) to active.
 */
#define JD_MATRIX_KEYPAD_EV_DOWN JD_EV_ACTIVE

/**
 * Argument: uint8_t. Emitted when a key, at the given index, goes from active (`pressed == 1`) to inactive.
 */
#define JD_MATRIX_KEYPAD_EV_UP JD_EV_INACTIVE

/**
 * Argument: uint8_t. Emitted together with `up` when the press time was not longer than 500ms.
 */
#define JD_MATRIX_KEYPAD_EV_CLICK 0x80

/**
 * Argument: uint8_t. Emitted together with `up` when the press time was more than 500ms.
 */
#define JD_MATRIX_KEYPAD_EV_LONG_CLICK 0x81

#endif
