# Generate hdmitiming command lines

print("DPI Command : ")
# Original 640x480x60Hz
# p = [0] *17
# p[0] =  640   # h_active_pixels = horizontal pixels (width)
# p[1] =  0   # h_sync_polarity = invert hsync polarity
# p[2] =  16   # h_front_porch   = horizontal forward padding from DE acitve edge
# p[3] =  96   # h_sync_pulse    = hsync pulse width in pixel clocks
# p[4] =  48   # h_back_porch    = vertical back padding from DE active edge
# p[5] =  480   # v_active_lines  = vertical pixels height (lines)
# p[6] =  0   # v_sync_polarity = invert vsync polarity
# p[7] =  11   # v_front_porch   = vertical forward padding from DE active edge
# p[8] =  2   # v_sync_pulse    = vsync pulse width in pixel clocks
# p[9] =  31   # v_back_porch    = vertical back padding from DE active edge
# p[10] = 0   # v_sync_offset_a = leave at zero
# p[11] = 0   # v_sync_offset_b = leave at zero
# p[12] = 0   # pixel_rep       = leave at zero
# p[13] = 60   # frame_rate      = screen refresh rate in Hz
# p[14] = 0   # interlaced      = leave at zero
# p[15] = 25175000   # pixel_freq      = clock frequency (width*height*framerate)
# p[16] = 1   # HDMI_ASPECT

# * The aspect ratio can be set to one of eight values (choose closest for your screen):

# HDMI_ASPECT_4_3 = 1
# HDMI_ASPECT_14_9 = 2
# HDMI_ASPECT_16_9 = 3
# HDMI_ASPECT_5_4 = 4
# HDMI_ASPECT_16_10 = 5
# HDMI_ASPECT_15_9 = 6
# HDMI_ASPECT_21_9 = 7
# HDMI_ASPECT_64_27 = 8

p = [0] *17
p[0] =  848   # h_active_pixels = horizontal pixels (width)
p[1] =  0   # h_sync_polarity = invert hsync polarity
p[2] =  24   # h_front_porch   = horizontal forward padding from DE acitve edge
p[3] =  80   # h_sync_pulse    = hsync pulse width in pixel clocks
p[4] =  104   # h_back_porch    = vertical back padding from DE active edge
p[5] =  480   # v_active_lines  = vertical pixels height (lines)
p[6] =  0   # v_sync_polarity = invert vsync polarity
p[7] =  3   # v_front_porch   = vertical forward padding from DE active edge
p[8] =  10   # v_sync_pulse    = vsync pulse width in pixel clocks
p[9] =  7   # v_back_porch    = vertical back padding from DE active edge
p[10] = 0   # v_sync_offset_a = leave at zero
p[11] = 0   # v_sync_offset_b = leave at zero
p[12] = 0   # pixel_rep       = leave at zero
p[13] = 60   # frame_rate      = screen refresh rate in Hz
p[14] = 0   # interlaced      = leave at zero
p[15] = 31500000   # pixel_freq      = clock frequency (width*height*framerate)
p[16] = 1   # HDMI_ASPECT

print("dpi_timings=", end='')
for i in p:
    print(i, end=' ')