// Teams
void keyboard_Mode1() {
  if (key) {
    switch (key) {
      case KEYBOARD_KEY1:                                           // mute
        Consumer.write(MEDIA_VOLUME_MUTE);
        break;
      case KEYBOARD_KEY2:                                           // chat
        Keyboard.press(KEY_LEFT_GUI);
        Keyboard.press(KEY_ESC);
        pixels.setPixelColor(KEYBOARD_KEY2, pixels.Color(0,150,0)); 
        break;
      case KEYBOARD_KEY3:                                           // 
        Keyboard.press(KEY_LEFT_GUI);
        Keyboard.press(KEYPAD_ADD);
        pixels.setPixelColor(KEYBOARD_KEY3, pixels.Color(0,150,0)); 
        break;         
      case KEYBOARD_KEY4:
        Consumer.write(MEDIA_PLAY_PAUSE);
        break;
      case KEYBOARD_KEY5:                                           // accept audio
        Keyboard.press(KEY_LEFT_CTRL);
        Keyboard.press(KEY_LEFT_SHIFT);
        Keyboard.print('a');
        pixels.setPixelColor(KEYBOARD_KEY5, pixels.Color(0,150,0)); 
        break;
      case KEYBOARD_KEY6:                                           // raise hand
        Keyboard.press(KEY_LEFT_CTRL);
        Keyboard.press(KEY_LEFT_SHIFT);
        Keyboard.print('k');
        pixels.setPixelColor(KEYBOARD_KEY6, pixels.Color(0,150,0)); 
        break;
      case KEYBOARD_KEY7:                                           // share screen
        Keyboard.press(KEY_LEFT_CTRL);  
        Keyboard.press(KEY_LEFT_SHIFT);
        Keyboard.print('e');
        pixels.setPixelColor(KEYBOARD_KEY7, pixels.Color(0,150,0)); 
        break;
      case KEYBOARD_KEY8:                                           // escape
        Keyboard.press(KEY_ESC);
        pixels.setPixelColor(KEYBOARD_KEY8, pixels.Color(0,150,0)); 
        break;
      case KEYBOARD_KEY9:                                           // accept video call
        Keyboard.press(KEY_LEFT_CTRL);  
        Keyboard.press(KEY_LEFT_SHIFT);
        Keyboard.print('a');
        pixels.setPixelColor(KEYBOARD_KEY9, pixels.Color(0,150,0)); 
        break;    
      case KEYBOARD_KEYA:                                           // toggle microphone
        Keyboard.press(KEY_LEFT_CTRL);
        Keyboard.press(KEY_LEFT_SHIFT);
        Keyboard.print('m');
        pixels.setPixelColor(KEYBOARD_KEYA, pixels.Color(0,150,0)); 
        break;
      case KEYBOARD_KEYB:                                           // toggle camera
        Keyboard.press(KEY_LEFT_CTRL);  
        Keyboard.press(KEY_LEFT_SHIFT);
        Keyboard.print('o');
        pixels.setPixelColor(KEYBOARD_KEYB, pixels.Color(0,150,0)); 
        break;
      case KEYBOARD_KEYC:                                           // hang up
        Keyboard.press(KEY_LEFT_CTRL);  
        Keyboard.press(KEY_LEFT_SHIFT);
        Keyboard.print('h');
        pixels.setPixelColor(KEYBOARD_KEYC, pixels.Color(0,150,0)); 
        break;
    }
    pixels.show();
    delay(SYSTEM_KEY_WAIT);
    Keyboard.releaseAll();
    colorUpdate = 1;
  }
}


void colors_Mode1() {
  if (colorUpdate == 1) {
    pixels.setPixelColor(KEYBOARD_KEY0, pixels.Color(  0,   0,   0)); // off
    pixels.setPixelColor(KEYBOARD_KEY1, pixels.Color(  0,   0,   0)); // off
    pixels.setPixelColor(KEYBOARD_KEY2, pixels.Color(  0,   0,   0)); // off
    pixels.setPixelColor(KEYBOARD_KEY3, pixels.Color( 63,  63,  63)); // gray
    pixels.setPixelColor(KEYBOARD_KEY4, pixels.Color(  0,   0,   0)); // off
    pixels.setPixelColor(KEYBOARD_KEY5, pixels.Color(  0,  31,   0)); // accept audio
    pixels.setPixelColor(KEYBOARD_KEY6, pixels.Color( 31,  31,   0)); // raise hand
    pixels.setPixelColor(KEYBOARD_KEY7, pixels.Color( 31,  31,  31)); // screen share
    pixels.setPixelColor(KEYBOARD_KEY8, pixels.Color(  0,   0,   0)); // off
    pixels.setPixelColor(KEYBOARD_KEY9, pixels.Color(  0, 127,   0)); // accept video
    pixels.setPixelColor(KEYBOARD_KEYA, pixels.Color(  0,   0, 127)); // toggle microphone
    pixels.setPixelColor(KEYBOARD_KEYB, pixels.Color(  0,   0,  31)); // toggle camera
    pixels.setPixelColor(KEYBOARD_KEYC, pixels.Color(127,   0,   0)); // hang up
    
    pixels.show();
    
    colorUpdate = 0;
  }
}

void encoderA_Mode1(){
  long newPos = RotaryEncoderA.read()/ROTARY_SENSITIVITY; 
  if (newPos != positionEncoderA && newPos < positionEncoderA) {
    positionEncoderA = newPos;
    Consumer.write(MEDIA_VOLUME_UP);
  }

  if (newPos != positionEncoderA && newPos > positionEncoderA) {
    positionEncoderA = newPos;
    Consumer.write(MEDIA_VOLUME_DOWN);
  }
}

void encoderB_Mode0(){
  long newPos = RotaryEncoderB.read()/ROTARY_SENSITIVITY; 
  if (newPos != positionEncoderB && newPos < positionEncoderB) {
    positionEncoderB = newPos;
    Consumer.write(MEDIA_NEXT);
  }

  if (newPos != positionEncoderB && newPos > positionEncoderB) {
    positionEncoderB = newPos;
    Consumer.write(MEDIA_PREVIOUS);
  }
}

void display_Mode1() {
}
