Using WiPhone Custom Buttons

There are four User-defined buttons in WiPhone Keypad which can be used by users to directly access any assigned function against each key. You can add any functionality to these buttons and use as per your convenience.In Production version of WiPhone firmware, the functionality of these buttons are kept disabled but you can enable it by following this guide. Below image shows location of these buttons on WiPhone Keypad marked through “User1 … User4”.


How to Do in Firmware

To enable functionality of these buttons in firmware, Follow as:
  1. comment #define WIPHONE_PRODUCTION and #define DIAGNOSTICS_ONLY in config.h
  2. uncomment #define STEAL_THE_USER_BUTTONS in config.h

Now in WiPhone.ino F1-F4 keys can be used for user defined functions.

In WiPhone.ino, we already created some example functionalities against each user keys

  • F1 User Key is used for toggling state of LCD, keypad LEDs and Vibration motor.
  • F2 User Key is used for audio test. Ringtone will be played to audio output.
  • F3 User Key is toggle between Loudspeaker and Earspeaker.
  • F4 User Key is used to enter in light sleep mode.

Similarly, you can assign these User Keys to any functions you like and access those functions with ease of just a single button press.

      // Process key
      if (keyPressed == WIPHONE_KEY_F1) {

      if (keyPressed == WIPHONE_KEY_F2) {

      if (keyPressed == WIPHONE_KEY_F3) {

      if (keyPressed == WIPHONE_KEY_F4) {

      if (keyPressed == WIPHONE_KEY_F1) {
        //allDigitalWrite(ENABLE_DAUGHTER_33V, HIGH);
        allDigitalWrite(VIBRO_MOTOR_CONTROL, HIGH);
        allDigitalWrite(KEYBOARD_LED, LOW);
        allDigitalWrite(VIBRO_MOTOR_CONTROL, LOW);
        allDigitalWrite(KEYBOARD_LED, HIGH);

      if (keyPressed == WIPHONE_KEY_F2) {

      if (keyPressed == WIPHONE_KEY_F3) {
        bool isLoud = !audio->isLoudspeaker();
        log_d("Loudspeaker: %d", isLoud);
        log_d("WiFi Mode: %d", WiFi.getMode());
        log_d("WiFi Status: %d", WiFi.status());

      if (keyPressed == WIPHONE_KEY_F4) {
        //esp_sleep_enable_ext1_wakeup(BUTTON_PIN_BITMASK, ESP_EXT1_WAKEUP_ANY_HIGH);
        esp_sleep_enable_ext0_wakeup((gpio_num_t)KEYBOARD_INTERRUPT_PIN,0); //1 = Low to High, 0 = High to Low. Pin pulled HIGH
        log_d("begin delay");
        delay(500); // debounce
        log_d("begin light sleep");
        delay(10); // let print finish


        //gui.frameToSerial();    // "screenshot"