# Here we need to comment out this code for understanding
import board # This is the Adafruit CircuitPython board module
from kmk_keyboard import KMKKeyboard # This is the Keyboard module
from keys import KC # This is the Keycode module
from scanners import DiodeOrientation # This is the DiodeOrientation module
from modules.layers import Layers # This is the Layers module
from modules.encoder import EncoderHandler # This is the EncoderHandler module
from extensions.RGB import RGB
from extensions.rgb import AnimationModes



encoder_handler = EncoderHandler() # This is the EncoderHandler module
keyboard = KMKKeyboard() # This is the Keyboard module
layers = Layers() # This is the Layers module
keyboard.modules = [layers, encoder_handler] # This is the Keyboard module

# Declarations of the keys Row and Column
keyboard.col_pins = (board.GP0, board.GP1, board.GP2, board.GP3, board.GP4, board.GP5, board.GP6, board.GP7, board.GP8, board.GP9, board.GP10, board.GP11, board.GP13)
keyboard.row_pins = (board.GP12, board.GP14, board.GP15, board.GP16)
keyboard.diode_orientation = DiodeOrientation.COL2ROW

# Encoder volume control with no button handling and divisor of 2
encoder_handler.pins = ((board.GP18, board.GP19, None, True, 2,),) # regular direction encoder with no button handling and divisor of 
encoder_handler.map = [((KC.AUDIO_VOL_DOWN, KC.AUDIO_VOL_UP),)]

# Filler keys
XXXXXXX = KC.NO

# LEDs
rgb = RGB(pixel_pin=board.GP17, num_pixels=48, val_limit=25, val_step=2, val_default=4,
        hue_step=5,
        hue_default=0,
        sat_step=5,
        sat_default=100,
        rgb_order=(1, 0, 2),
        animation_speed=1,
        breathe_center=1,  # 1.0-2.7a
        knight_effect_length=3,
        animation_mode=AnimationModes.STATIC,
        reverse_animation=False,
        refresh_rate=60,)
keyboard.extensions.append(rgb)

# Keymap
keyboard.keymap = [
    [KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8,       KC.N9,       KC.N0,          KC.MINUS,    XXXXXXX,  XXXXXXX,
     KC.Q,  KC.W,  KC.E,  KC.R,  KC.T,  KC.Y,  KC.U,  KC.I,        KC.O,        KC.P,           KC.LBRACKET, XXXXXXX,  XXXXXXX,
     KC.A,  KC.S,  KC.D,  KC.F,  KC.G,  KC.H,  KC.J,  KC.K,        KC.L,        KC.SCOLON,      KC.QUOTE,    KC.UP,    KC.DOWN,
     KC.Z,  KC.X,  KC.C,  KC.V,  KC.B,  KC.N,  KC.M,  KC.KP_MINUS, KC.KP_SLASH, KC.KP_ASTERISK, KC.KP_PLUS,  KC.LEFT, KC.RIGHT,]
    ]

# Starting the keyboard
if __name__ == '__main__':
    keyboard.go()
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT