2016-02-23 01:56:52 +08:00
/*
generate and update c / c + + files
this also replaces the buildcpp tool
*/
2015-12-21 02:31:07 +08:00
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
2016-02-28 02:23:57 +08:00
# include <error.h>
2016-02-23 01:51:48 +08:00
# include <ctype.h>
# include <unistd.h>
2015-12-21 02:31:07 +08:00
/*===========================================*/
2016-06-26 03:34:58 +08:00
/* ll_hvline */
# define U8X8_HVLINE "u8g2_ll_hvline_vertical_top_lsb"
2015-12-23 16:04:24 +08:00
# define COM_4WSPI 0x0001
# define COM_3WSPI 0x0002
# define COM_6800 0x0004
# define COM_8080 0x0008
2016-07-23 17:26:33 +08:00
# define COM_I2C 0x0010
2016-02-28 02:23:57 +08:00
# define COM_ST7920SPI 0x0020 /* mostly identical to COM_4WSPI, but does not use DC */
2016-07-23 17:26:33 +08:00
# define COM_UART 0x0040
2016-12-05 05:48:27 +08:00
# define COM_KS0108 0x0080 /* mostly identical to 6800 mode, but has more chip select lines */
2015-12-23 16:04:24 +08:00
struct interface
{
const char * interface_name ; /* SW_SPI */
const char * setpin_function ; /* u8x8_SetPin_4Wire_SW_SPI */
const char * arduino_com_procedure ; /* u8x8_byte_4wire_sw_spi */
const char * arduino_gpio_procedure ; /* u8x8_gpio_and_delay_arduino */
const char * pins_with_type ; /* uint8_t clock, uint8_t data, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE */
const char * pins_plain ; /* clock, data, cs, dc, reset */
2015-12-24 03:54:16 +08:00
const char * pins_md_plain ; /* clock, data, cs, dc, reset */
2016-05-16 15:16:54 +08:00
const char * generic_com_procedure ; /* u8x8_byte_4wire_sw_spi, this is used for documentation, so it suould be generic for all uC architectures */
2015-12-23 16:04:24 +08:00
} ;
2015-12-21 02:31:07 +08:00
struct display
{
2016-05-01 17:08:11 +08:00
/* this name must match the display part of the device procedure */
/* u8x8_d_<controller>_<display> */
const char * name ;
2015-12-21 02:31:07 +08:00
} ;
struct controller
{
2016-05-01 17:08:11 +08:00
/* the name must match the controller part of the device procedure */
/* u8x8_d_<controller>_<display> */
2015-12-21 02:31:07 +08:00
const char * name ;
2016-05-01 17:08:11 +08:00
2015-12-21 02:31:07 +08:00
int tile_width ;
int tile_height ;
2016-02-23 01:51:48 +08:00
const char * ll_hvline ;
2015-12-21 02:31:07 +08:00
const char * cad ;
2016-02-28 02:23:57 +08:00
const char * cad_shortname ;
2015-12-23 16:04:24 +08:00
unsigned com ;
2016-07-23 17:26:33 +08:00
char * note ;
unsigned is_generate_u8g2_class ; /* currently not used, instead conrolled by COM_UART */
2015-12-21 02:31:07 +08:00
struct display display_list [ 10 ] ; /* usually not used completly, but space does not matter much here */
} ;
struct controller controller_list [ ] =
{
{
2017-01-07 04:18:46 +08:00
" ssd1305 " , 16 , 4 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_6800 | COM_8080 ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " 128x32_noname " } ,
{ NULL }
}
} ,
{
" ssd1305 " , 16 , 4 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_ssd13xx_i2c " , " i2c " , COM_I2C ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " 128x32_noname " } ,
{ NULL }
}
} ,
{
" ssd1306 " , 16 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_3WSPI | COM_6800 | COM_8080 ,
2016-07-23 17:26:33 +08:00
" " , /* is_generate_u8g2_class= */ 1 ,
2016-02-29 05:32:14 +08:00
{
{ " 128x64_noname " } ,
2016-12-27 07:14:44 +08:00
{ " 128x64_vcomh0 " } ,
2016-02-29 05:32:14 +08:00
{ NULL }
}
} ,
{
2016-06-23 05:58:14 +08:00
" ssd1306 " , 16 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_ssd13xx_i2c " , " i2c " , COM_I2C ,
2016-07-23 17:26:33 +08:00
" " , /* is_generate_u8g2_class= */ 1 ,
2015-12-21 02:31:07 +08:00
{
{ " 128x64_noname " } ,
2016-12-27 07:14:44 +08:00
{ " 128x64_vcomh0 " } ,
2015-12-21 02:31:07 +08:00
{ NULL }
}
} ,
2016-05-14 04:51:02 +08:00
{
" sh1106 " , 16 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_3WSPI | COM_6800 | COM_8080 | COM_8080 ,
2016-07-23 17:26:33 +08:00
" Not tested " , /* is_generate_u8g2_class= */ 1 ,
2016-05-14 04:51:02 +08:00
{
{ " 128x64_noname " } ,
2016-12-27 07:14:44 +08:00
{ " 128x64_vcomh0 " } ,
2016-05-14 04:51:02 +08:00
{ NULL }
}
} ,
{
2016-06-23 05:58:14 +08:00
" sh1106 " , 16 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_ssd13xx_i2c " , " i2c " , COM_I2C ,
2016-07-23 17:26:33 +08:00
" Not tested " , /* is_generate_u8g2_class= */ 1 ,
2016-05-14 04:51:02 +08:00
{
{ " 128x64_noname " } ,
2016-12-27 07:14:44 +08:00
{ " 128x64_vcomh0 " } ,
2016-05-14 04:51:02 +08:00
{ NULL }
}
} ,
{
" ssd1306 " , 16 , 4 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_3WSPI | COM_6800 | COM_8080 | COM_8080 ,
2016-07-23 17:26:33 +08:00
" " , /* is_generate_u8g2_class= */ 1 ,
2016-05-14 04:51:02 +08:00
{
{ " 128x32_univision " } ,
{ NULL }
}
} ,
{
2016-06-23 05:58:14 +08:00
" ssd1306 " , 16 , 4 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_ssd13xx_i2c " , " i2c " , COM_I2C ,
2016-07-23 17:26:33 +08:00
" " , /* is_generate_u8g2_class= */ 1 ,
2016-05-14 04:51:02 +08:00
{
{ " 128x32_univision " } ,
{ NULL }
}
2016-05-26 16:33:09 +08:00
} ,
2016-11-20 21:57:53 +08:00
{
" ssd1306 " , 8 , 6 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_3WSPI | COM_6800 | COM_8080 | COM_8080 ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " 64x48_er " } ,
{ NULL }
}
} ,
{
" ssd1306 " , 8 , 6 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_ssd13xx_i2c " , " i2c " , COM_I2C ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " 64x48_er " } ,
{ NULL }
}
} ,
2017-01-12 05:30:54 +08:00
{
" ssd1309 " , 16 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_6800 | COM_8080 ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
2017-04-09 17:28:03 +08:00
{ " 128x64_noname2 " } ,
2017-01-12 05:30:54 +08:00
{ NULL }
}
} ,
{
" ssd1309 " , 16 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_ssd13xx_i2c " , " i2c " , COM_I2C ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
2017-04-09 17:28:03 +08:00
{ " 128x64_noname2 " } ,
2017-01-12 05:30:54 +08:00
{ NULL }
}
} ,
2017-04-09 17:28:03 +08:00
{
" ssd1309 " , 16 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_6800 | COM_8080 ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " 128x64_noname0 " } ,
{ NULL }
}
} ,
{
" ssd1309 " , 16 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_ssd13xx_i2c " , " i2c " , COM_I2C ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " 128x64_noname0 " } ,
{ NULL }
}
} ,
2016-11-20 21:57:53 +08:00
2016-09-25 16:26:39 +08:00
{
2017-01-05 15:44:08 +08:00
" ssd1325 " , 16 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_3WSPI | COM_6800 | COM_8080 ,
2016-09-25 16:26:39 +08:00
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " nhd_128x64 " } ,
{ NULL }
}
} ,
2017-01-05 15:44:08 +08:00
{
" ssd1325 " , 16 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_ssd13xx_i2c " , " i2c " , COM_I2C ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " nhd_128x64 " } ,
{ NULL }
}
} ,
{
" ssd1327 " , 12 , 12 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_3WSPI | COM_6800 | COM_8080 ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " seeed_96x96 " } ,
{ NULL }
}
} ,
{
" ssd1327 " , 12 , 12 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_ssd13xx_i2c " , " i2c " , COM_I2C ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " seeed_96x96 " } ,
{ NULL }
}
} ,
2017-03-07 02:45:34 +08:00
{
" ssd1329 " , 16 , 12 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_6800 | COM_8080 ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " 128x96_noname " } ,
{ NULL }
}
} ,
2017-01-05 15:44:08 +08:00
2016-06-22 05:23:11 +08:00
{
" ld7032 " , 8 , 4 , " u8g2_ll_hvline_horizontal_right_lsb " , " u8x8_cad_011 " , " " , COM_4WSPI ,
2016-07-23 17:26:33 +08:00
" " , /* is_generate_u8g2_class= */ 1 ,
2016-06-22 05:23:11 +08:00
{
{ " 60x32 " } ,
{ NULL }
}
} ,
2016-06-23 05:58:14 +08:00
{
" ld7032 " , 8 , 4 , " u8g2_ll_hvline_horizontal_right_lsb " , " u8x8_cad_ld7032_i2c " , " i2c " , COM_I2C ,
2016-07-23 17:26:33 +08:00
" " , /* is_generate_u8g2_class= */ 1 ,
2016-06-23 05:58:14 +08:00
{
{ " 60x32 " } ,
{ NULL }
}
} ,
2016-01-04 07:31:49 +08:00
{
2016-02-28 02:23:57 +08:00
" st7920 " , 24 , 4 , " u8g2_ll_hvline_horizontal_right_lsb " , " u8x8_cad_001 " , " p " , COM_8080 ,
2016-07-23 17:26:33 +08:00
" " , /* is_generate_u8g2_class= */ 1 ,
2016-01-04 07:31:49 +08:00
{
{ " 192x32 " } ,
{ NULL }
}
} ,
2016-10-01 14:37:18 +08:00
{
" st7920 " , 24 , 4 , " u8g2_ll_hvline_horizontal_right_lsb " , " u8x8_cad_001 " , " " , COM_6800 ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " 192x32 " } ,
{ NULL }
}
} ,
2015-12-21 02:31:07 +08:00
{
2016-02-28 02:23:57 +08:00
" st7920 " , 24 , 4 , " u8g2_ll_hvline_horizontal_right_lsb " , " u8x8_cad_st7920_spi " , " s " , COM_ST7920SPI ,
2016-07-23 17:26:33 +08:00
" " , /* is_generate_u8g2_class= */ 1 ,
2016-02-28 02:23:57 +08:00
{
{ " 192x32 " } ,
{ NULL }
}
} ,
{
" st7920 " , 16 , 8 , " u8g2_ll_hvline_horizontal_right_lsb " , " u8x8_cad_001 " , " p " , COM_8080 ,
2016-07-23 17:26:33 +08:00
" " , /* is_generate_u8g2_class= */ 1 ,
2016-02-28 02:23:57 +08:00
{
{ " 128x64 " } ,
{ NULL }
}
} ,
2016-10-01 14:37:18 +08:00
{
" st7920 " , 16 , 8 , " u8g2_ll_hvline_horizontal_right_lsb " , " u8x8_cad_001 " , " " , COM_6800 ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " 128x64 " } ,
{ NULL }
}
} ,
2016-02-28 02:23:57 +08:00
{
" st7920 " , 16 , 8 , " u8g2_ll_hvline_horizontal_right_lsb " , " u8x8_cad_st7920_spi " , " s " , COM_ST7920SPI ,
2016-07-23 17:26:33 +08:00
" " , /* is_generate_u8g2_class= */ 1 ,
2016-02-28 02:23:57 +08:00
{
{ " 128x64 " } ,
{ NULL }
}
} ,
2016-05-25 02:26:46 +08:00
{
2016-05-25 04:53:40 +08:00
" ls013b7dh03 " , 16 , 16 , " u8g2_ll_hvline_horizontal_right_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI , /* cad procedure is not required (no DC for this display) so it could be a dummy procedure here */
2016-07-23 17:26:33 +08:00
" " , /* is_generate_u8g2_class= */ 1 ,
2016-05-25 02:26:46 +08:00
{
{ " 128x128 " } ,
{ NULL }
}
} ,
2016-02-28 02:23:57 +08:00
{
2016-05-26 14:31:29 +08:00
" uc1701 " , 13 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_3WSPI | COM_6800 | COM_8080 ,
2016-07-23 17:26:33 +08:00
" " , /* is_generate_u8g2_class= */ 1 ,
2015-12-21 02:31:07 +08:00
{
2016-05-26 16:33:09 +08:00
{ " ea_dogs102 " } ,
2015-12-21 02:31:07 +08:00
{ NULL }
}
2016-05-26 14:31:29 +08:00
} ,
2016-08-17 04:38:56 +08:00
{
" uc1701 " , 16 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_3WSPI | COM_6800 | COM_8080 ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " mini12864 " } ,
{ NULL }
}
} ,
2016-12-15 22:04:12 +08:00
{
" pcd8544 " , 11 , 6 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI ,
" No HW flip " , /* is_generate_u8g2_class= */ 1 ,
{
{ " 84x48 " } ,
{ NULL }
}
} ,
2017-01-02 00:23:01 +08:00
{
" pcf8812 " , 12 , 9 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI ,
" No HW flip " , /* is_generate_u8g2_class= */ 1 ,
{
{ " 96x65 " } ,
{ NULL }
}
} ,
2016-12-18 17:35:18 +08:00
{
" uc1604 " , 24 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_3WSPI | COM_6800 | COM_8080 ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " jlx19264 " } ,
{ NULL }
}
} ,
{
" uc1604 " , 24 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_uc16xx_i2c " , " i2c " , COM_I2C ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " jlx19264 " } ,
{ NULL }
}
} ,
2016-11-23 03:18:51 +08:00
{
" uc1608 " , 30 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_3WSPI ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " erc24064 " } ,
{ NULL }
}
} ,
{
" uc1608 " , 30 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_uc16xx_i2c " , " i2c " , COM_I2C ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " erc24064 " } ,
{ NULL }
}
} ,
2016-12-07 05:51:15 +08:00
{
" uc1608 " , 30 , 16 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_3WSPI ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " 240x128 " } ,
{ NULL }
}
} ,
{
" uc1608 " , 30 , 16 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_uc16xx_i2c " , " i2c " , COM_I2C ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " 240x128 " } ,
{ NULL }
}
} ,
2016-10-15 23:08:04 +08:00
{
" uc1610 " , 20 , 13 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_3WSPI ,
2016-11-13 03:28:27 +08:00
" 3W SPI not tested " , /* is_generate_u8g2_class= */ 1 ,
2016-10-15 23:08:04 +08:00
{
{ " ea_dogxl160 " } ,
{ NULL }
}
2016-11-13 03:28:27 +08:00
} ,
{
2016-11-13 03:31:55 +08:00
" uc1610 " , 20 , 13 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_uc16xx_i2c " , " i2c " , COM_I2C ,
2016-11-13 03:28:27 +08:00
" 3W SPI not tested, I2C not tested " , /* is_generate_u8g2_class= */ 1 ,
{
{ " ea_dogxl160 " } ,
{ NULL }
}
} ,
{
" uc1611 " , 30 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_3WSPI ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " ea_dogm240 " } ,
{ NULL }
}
} ,
2016-11-12 23:17:56 +08:00
{
" uc1611 " , 30 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_uc16xx_i2c " , " i2c " , COM_I2C ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " ea_dogm240 " } ,
{ NULL }
}
} ,
2016-11-13 03:28:27 +08:00
{
" uc1611 " , 30 , 16 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_3WSPI ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " ea_dogxl240 " } ,
{ NULL }
}
} ,
{
" uc1611 " , 30 , 16 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_uc16xx_i2c " , " i2c " , COM_I2C ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " ea_dogxl240 " } ,
{ NULL }
}
} ,
2017-03-01 04:14:44 +08:00
# ifdef NOTUSED
2017-02-28 20:22:28 +08:00
{
" uc1617 " , 16 , 16 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_3WSPI ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " jlx128128 " } ,
{ NULL }
}
} ,
{
" uc1617 " , 16 , 16 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_uc16xx_i2c " , " i2c " , COM_I2C ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " jlx128128 " } ,
{ NULL }
}
} ,
2017-03-01 04:14:44 +08:00
# endif
2016-11-12 23:17:56 +08:00
2016-05-26 14:31:29 +08:00
{
" st7565 " , 16 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_3WSPI | COM_6800 | COM_8080 ,
2016-07-23 17:26:33 +08:00
" " , /* is_generate_u8g2_class= */ 1 ,
2016-05-26 14:31:29 +08:00
{
2016-05-26 16:33:09 +08:00
{ " ea_dogm128 " } ,
2016-12-17 04:59:40 +08:00
{ " zolen_128x64 " } ,
2016-12-27 07:14:44 +08:00
{ " lm6059 " } ,
2017-02-04 03:54:05 +08:00
{ " erc12864 " } ,
2017-02-09 12:43:53 +08:00
{ " nhd_c12864 " } ,
2016-05-26 16:33:09 +08:00
{ NULL }
} ,
} ,
{
" st7565 " , 16 , 4 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_3WSPI | COM_6800 | COM_8080 ,
2016-07-23 17:26:33 +08:00
" " , /* is_generate_u8g2_class= */ 1 ,
2016-05-26 16:33:09 +08:00
{
{ " nhd_c12832 " } ,
2016-05-26 14:31:29 +08:00
{ NULL }
}
2016-07-02 13:09:27 +08:00
} ,
2017-01-07 19:59:30 +08:00
{
" st7565 " , 17 , 4 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_3WSPI | COM_6800 | COM_8080 ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " ea_dogm132 " } ,
{ NULL }
}
} ,
2017-01-02 20:27:28 +08:00
{
" st7567 " , 17 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_6800 | COM_8080 ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " pi_132x64 " } ,
{ NULL }
}
} ,
2017-01-15 18:50:13 +08:00
{
" st7588 " , 16 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_3WSPI | COM_6800 | COM_8080 ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " jlx12864 " } ,
{ NULL }
} ,
} ,
{ /* the ST7588 has the same I2C protocol as the SSD13xx */
" st7588 " , 16 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_ssd13xx_i2c " , " i2c " , COM_I2C ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " jlx12864 " } ,
{ NULL }
}
} ,
2017-02-16 05:17:49 +08:00
2017-02-18 18:44:59 +08:00
# ifdef NOT_YET_IMPLEMENTED
2017-02-16 05:17:49 +08:00
{
" st75256 " , 32 , 16 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_011 " , " " , COM_4WSPI | COM_3WSPI | COM_6800 | COM_8080 ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " jlx256128 " } ,
{ NULL }
} ,
} ,
/* the ST75256 has the same I2C protocol as the SSD13xx, BUT: for arguments have the data bit set!!!! */
/* this means, we need to implement a u8x8_cad_ssd13xx_i2c procedure with cad 011 functionality */
{
" st75256 " , 32 , 16 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_ssd13xx_i2c " , " i2c " , COM_I2C ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " jlx256128 " } ,
{ NULL }
}
} ,
# endif
2017-01-15 18:50:13 +08:00
2017-01-04 23:48:47 +08:00
{
" nt7534 " , 16 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_6800 | COM_8080 ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " tg12864r " } ,
{ NULL }
}
} ,
2017-01-11 05:35:39 +08:00
{
" ist3020 " , 24 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_6800 | COM_8080 ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " erc19264 " } ,
{ NULL }
}
} ,
2016-12-05 05:48:27 +08:00
{
" ks0108 " , 16 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_KS0108 ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " 128x64 " } ,
{ NULL }
} ,
} ,
2016-12-09 05:37:18 +08:00
{
" ks0108 " , 24 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_KS0108 ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " erm19264 " } ,
{ NULL }
} ,
} ,
2016-12-31 19:14:17 +08:00
{
" lc7981 " , 20 , 10 , " u8g2_ll_hvline_horizontal_right_lsb " , " u8x8_cad_100 " , " " , COM_6800 ,
" U8x8 not supported, no powerdown, no HW flip, no constrast " , /* is_generate_u8g2_class= */ 1 ,
{
{ " 160x80 " } ,
{ NULL }
}
} ,
2017-03-27 01:43:12 +08:00
{
" lc7981 " , 20 , 20 , " u8g2_ll_hvline_horizontal_right_lsb " , " u8x8_cad_100 " , " " , COM_6800 ,
" U8x8 not supported, no powerdown, no HW flip, no constrast " , /* is_generate_u8g2_class= */ 1 ,
{
{ " 160x160 " } ,
{ NULL }
}
} ,
2017-02-14 06:18:41 +08:00
{
" lc7981 " , 30 , 16 , " u8g2_ll_hvline_horizontal_right_lsb " , " u8x8_cad_100 " , " " , COM_6800 ,
" U8x8 not supported, no powerdown, no HW flip, no constrast " , /* is_generate_u8g2_class= */ 1 ,
{
{ " 240x128 " } ,
{ NULL }
}
} ,
2016-12-31 19:14:17 +08:00
2016-07-02 13:09:27 +08:00
{
" t6963 " , 30 , 16 , " u8g2_ll_hvline_horizontal_right_lsb " , " u8x8_cad_100 " , " " , COM_8080 ,
2016-07-23 17:26:33 +08:00
" " , /* is_generate_u8g2_class= */ 1 ,
2016-07-02 13:09:27 +08:00
{
{ " 240x128 " } ,
{ NULL }
}
} ,
2016-07-16 14:03:47 +08:00
{
2016-11-03 01:53:19 +08:00
" t6963 " , 30 , 8 , " u8g2_ll_hvline_horizontal_right_lsb " , " u8x8_cad_100 " , " " , COM_8080 ,
" " , /* is_generate_u8g2_class= */ 1 ,
{
{ " 240x64 " } ,
{ NULL }
}
} ,
{
" t6963 " , 32 , 8 , " u8g2_ll_hvline_horizontal_right_lsb " , " u8x8_cad_100 " , " " , COM_8080 ,
2016-08-13 01:16:49 +08:00
" Not tested " , /* is_generate_u8g2_class= */ 1 ,
2016-07-16 14:03:47 +08:00
{
{ " 256x64 " } ,
{ NULL }
}
} ,
2016-07-03 16:14:47 +08:00
{
" t6963 " , 16 , 8 , " u8g2_ll_hvline_horizontal_right_lsb " , " u8x8_cad_100 " , " " , COM_8080 ,
2016-08-13 01:16:49 +08:00
" Not tested " , /* is_generate_u8g2_class= */ 1 ,
2016-07-03 16:14:47 +08:00
{
{ " 128x64 " } ,
{ NULL }
}
2016-07-15 03:23:34 +08:00
} ,
{
2016-09-29 05:23:07 +08:00
" ssd1322 " , 32 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_011 " , " " , COM_4WSPI | COM_3WSPI | COM_6800 | COM_8080 ,
2016-09-30 03:08:36 +08:00
" Requires U8G2_16BIT (see u8g2.h) " , /* is_generate_u8g2_class= */ 1 ,
2016-07-15 03:23:34 +08:00
{
2016-09-29 05:23:07 +08:00
{ " nhd_256x64 " } ,
2016-07-15 03:23:34 +08:00
{ NULL }
}
2016-07-23 17:26:33 +08:00
} ,
2016-12-28 15:02:53 +08:00
{
" ssd1606 " , 22 , 9 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_011 " , " " , COM_4WSPI | COM_3WSPI ,
2016-12-30 14:54:47 +08:00
" Partly supported by U8x8, no HW flip, no contrast setting " , /* is_generate_u8g2_class= */ 1 ,
2016-12-28 15:02:53 +08:00
{
{ " 172x72 " } ,
{ NULL }
}
} ,
2017-01-22 00:48:43 +08:00
{
" ssd1607 " , 25 , 25 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_011 " , " " , COM_4WSPI | COM_3WSPI ,
" Partly supported by U8x8, no HW flip, no contrast setting " , /* is_generate_u8g2_class= */ 1 ,
{
{ " 200x200 " } ,
{ NULL }
}
} ,
2016-08-13 01:16:49 +08:00
{
" sed1330 " , 30 , 16 , " u8g2_ll_hvline_horizontal_right_lsb " , " u8x8_cad_100 " , " " , COM_6800 | COM_8080 ,
" Not tested, might work for RA8835 and SED1335 also " , /* is_generate_u8g2_class= */ 1 ,
{
{ " 240x128 " } ,
{ NULL }
}
} ,
2016-09-24 01:43:35 +08:00
{
" ra8835 " , 30 , 16 , " u8g2_ll_hvline_horizontal_right_lsb " , " u8x8_cad_100 " , " " , COM_6800 | COM_8080 ,
" Tested with RA8835 " , /* is_generate_u8g2_class= */ 1 ,
{
{ " nhd_240x128 " } ,
{ NULL }
}
} ,
2016-07-23 17:26:33 +08:00
{
" a2printer " , 48 , 30 , " u8g2_ll_hvline_horizontal_right_lsb " , " u8x8_cad_empty " , " " , COM_UART ,
" " , /* is_generate_u8g2_class= */ 0 ,
{
{ " 384x240 " } ,
{ NULL }
}
2016-07-03 16:14:47 +08:00
}
2015-12-21 02:31:07 +08:00
} ;
2015-12-23 16:04:24 +08:00
struct interface interface_list [ ] =
{
2015-12-23 17:44:20 +08:00
/* 0 */
2015-12-23 16:04:24 +08:00
{
2015-12-23 17:44:20 +08:00
" 4W_SW_SPI " ,
2015-12-23 16:04:24 +08:00
" u8x8_SetPin_4Wire_SW_SPI " ,
2016-05-16 15:16:54 +08:00
" u8x8_byte_arduino_4wire_sw_spi " , /* improved version over u8x8_byte_4wire_sw_spi */
2015-12-23 16:04:24 +08:00
" u8x8_gpio_and_delay_arduino " ,
" uint8_t clock, uint8_t data, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE " ,
2015-12-24 03:54:16 +08:00
" clock, data, cs, dc, reset " ,
" clock, data, cs, dc [, reset] " ,
" u8x8_byte_4wire_sw_spi "
2015-12-23 16:04:24 +08:00
} ,
2015-12-23 17:44:20 +08:00
/* 1 */
2015-12-23 16:04:24 +08:00
{
2015-12-23 17:44:20 +08:00
" 4W_HW_SPI " ,
2015-12-23 16:04:24 +08:00
" u8x8_SetPin_4Wire_HW_SPI " ,
2015-12-23 17:04:08 +08:00
" u8x8_byte_arduino_hw_spi " ,
2015-12-23 16:04:24 +08:00
" u8x8_gpio_and_delay_arduino " ,
" uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE " ,
2015-12-24 03:54:16 +08:00
" cs, dc, reset " ,
" cs, dc [, reset] " ,
2016-02-10 05:50:57 +08:00
" uC specific "
2015-12-23 17:44:20 +08:00
} ,
/* 2 */
{
" 6800 " ,
" u8x8_SetPin_8Bit_6800 " ,
" u8x8_byte_8bit_6800mode " ,
" u8x8_gpio_and_delay_arduino " ,
" uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, uint8_t enable, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE " ,
2015-12-24 03:54:16 +08:00
" d0, d1, d2, d3, d4, d5, d6, d7, enable, cs, dc, reset " ,
" d0, d1, d2, d3, d4, d5, d6, d7, enable, cs, dc [, reset] " ,
" u8x8_byte_8bit_6800mode "
2015-12-23 17:44:20 +08:00
} ,
/* 3 */
{
" 8080 " ,
" u8x8_SetPin_8Bit_8080 " ,
2016-11-26 15:40:58 +08:00
" u8x8_byte_arduino_8bit_8080mode " ,
2015-12-23 17:44:20 +08:00
" u8x8_gpio_and_delay_arduino " ,
" uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, uint8_t enable, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE " ,
2015-12-24 03:54:16 +08:00
" d0, d1, d2, d3, d4, d5, d6, d7, enable, cs, dc, reset " ,
" d0, d1, d2, d3, d4, d5, d6, d7, enable, cs, dc [, reset] " ,
" u8x8_byte_8bit_8080mode "
2015-12-23 17:44:20 +08:00
} ,
/* 4 */
{
" 3W_SW_SPI " ,
" u8x8_SetPin_3Wire_SW_SPI " ,
" u8x8_byte_3wire_sw_spi " ,
" u8x8_gpio_and_delay_arduino " ,
" uint8_t clock, uint8_t data, uint8_t cs, uint8_t reset = U8X8_PIN_NONE " ,
2015-12-24 03:54:16 +08:00
" clock, data, cs, reset " ,
" clock, data, cs [, reset] " ,
" u8x8_byte_3wire_sw_spi "
2015-12-23 16:04:24 +08:00
} ,
2015-12-23 17:44:20 +08:00
/* 5 */
{
" 3W_HW_SPI " ,
" " ,
" " ,
" " ,
" uint8_t cs, uint8_t reset = U8X8_PIN_NONE " ,
2015-12-24 03:54:16 +08:00
" cs, reset " ,
" cs [, reset] " ,
2016-02-10 05:50:57 +08:00
" uC specific "
2015-12-23 17:44:20 +08:00
} ,
/* 6 */
{
" SW_I2C " ,
2016-06-23 05:58:14 +08:00
" u8x8_SetPin_SW_I2C " ,
2016-03-01 01:04:34 +08:00
" u8x8_byte_sw_i2c " /* "u8x8_byte_ssd13xx_sw_i2c" */ ,
2015-12-23 17:44:20 +08:00
" u8x8_gpio_and_delay_arduino " ,
" uint8_t clock, uint8_t data, uint8_t reset = U8X8_PIN_NONE " ,
2015-12-24 03:54:16 +08:00
" clock, data, reset " ,
" clock, data [, reset] " ,
2016-03-01 01:04:34 +08:00
" u8x8_byte_sw_i2c " /* "u8x8_byte_ssd13xx_sw_i2c" */
2015-12-23 17:44:20 +08:00
} ,
/* 7 */
{
" HW_I2C " ,
2016-06-23 05:58:14 +08:00
" u8x8_SetPin_HW_I2C " ,
2016-05-15 06:05:41 +08:00
" u8x8_byte_arduino_hw_i2c " ,
" u8x8_gpio_and_delay_arduino " ,
2017-02-05 18:25:47 +08:00
" uint8_t reset = U8X8_PIN_NONE, uint8_t clock = U8X8_PIN_NONE, uint8_t data = U8X8_PIN_NONE " ,
" reset, clock, data " ,
" [reset [, clock, data]] " ,
2016-02-10 05:50:57 +08:00
" uC specific "
2015-12-23 17:44:20 +08:00
} ,
2016-02-27 04:58:40 +08:00
/* 8 */
{
2016-02-28 02:23:57 +08:00
/* ST7920 */ " SW_SPI " ,
" u8x8_SetPin_3Wire_SW_SPI " , /* use the 3 wire interface, because the DC is not used */
2016-11-26 19:48:09 +08:00
" u8x8_byte_arduino_4wire_sw_spi " , /* improved version over u8x8_byte_4wire_sw_spi */
2016-02-27 04:58:40 +08:00
" u8x8_gpio_and_delay_arduino " ,
" uint8_t clock, uint8_t data, uint8_t cs, uint8_t reset = U8X8_PIN_NONE " ,
" clock, data, cs, reset " ,
" clock, data, cs [, reset] " ,
2016-02-28 02:23:57 +08:00
" u8x8_byte_4wire_sw_spi " , /* "u8x8_byte_st7920_sw_spi" */
2016-02-27 04:58:40 +08:00
} ,
/* 9 */
{
2016-02-28 02:23:57 +08:00
/* ST7920 */ " HW_SPI " ,
2016-06-24 06:58:17 +08:00
" u8x8_SetPin_ST7920_HW_SPI " ,
" u8x8_byte_arduino_hw_spi " ,
" u8x8_gpio_and_delay_arduino " ,
2016-02-27 04:58:40 +08:00
" uint8_t cs, uint8_t reset = U8X8_PIN_NONE " ,
" cs, reset " ,
" cs [, reset] " ,
" uC specific "
} ,
2016-11-13 00:30:14 +08:00
/* 10 */
{
" 2ND_HW_I2C " ,
" u8x8_SetPin_HW_I2C " ,
" u8x8_byte_arduino_2nd_hw_i2c " ,
" u8x8_gpio_and_delay_arduino " ,
" uint8_t reset = U8X8_PIN_NONE " ,
" reset " ,
" [reset] " ,
" uC specific "
} ,
2016-12-05 05:48:27 +08:00
/* 11 */
{
" " ,
" u8x8_SetPin_KS0108 " ,
2016-12-14 12:35:03 +08:00
" u8x8_byte_arduino_ks0108 " ,
2016-12-05 05:48:27 +08:00
" u8x8_gpio_and_delay_arduino " ,
" uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, uint8_t enable, uint8_t dc, uint8_t cs0, uint8_t cs1, uint8_t cs2, uint8_t reset = U8X8_PIN_NONE " ,
" d0, d1, d2, d3, d4, d5, d6, d7, enable, dc, cs0, cs1, cs2, reset " ,
" d0, d1, d2, d3, d4, d5, d6, d7, enable, dc, cs0, cs1, cs2 [, reset] " ,
" u8x8_byte_ks0108 "
} ,
2015-12-23 17:44:20 +08:00
2016-06-24 06:58:17 +08:00
2015-12-23 16:04:24 +08:00
} ;
2015-12-23 05:23:42 +08:00
2016-02-28 02:23:57 +08:00
/*===========================================*/
# define STR_MAX 1024
char * str_list [ STR_MAX ] ;
int str_cnt = 0 ;
int str_exists ( const char * s )
{
int i ;
for ( i = 0 ; i < str_cnt ; i + + )
{
if ( strcmp ( str_list [ i ] , s ) = = 0 )
return 1 ;
}
return 0 ;
}
void str_add ( const char * s )
{
if ( str_exists ( s ) )
return ;
if ( str_cnt > = STR_MAX )
{
error ( 1 , 0 , " max number of strings reached " ) ;
}
else
{
str_list [ str_cnt ] = strdup ( s ) ;
str_cnt + + ;
}
}
2015-12-23 05:23:42 +08:00
/*===========================================*/
/*
copy file from source_file_name to dest_file_name
*/
int file_copy ( const char * source_file_name , const char * dest_file_name )
{
int ch ;
FILE * source_fp ;
FILE * dest_fp ;
source_fp = fopen ( source_file_name , " r " ) ;
dest_fp = fopen ( dest_file_name , " w " ) ;
if ( source_fp = = NULL | | dest_fp = = NULL )
return 0 ;
while ( ( ch = fgetc ( source_fp ) ) ! = EOF )
fputc ( ch , dest_fp ) ;
fclose ( source_fp ) ;
fclose ( dest_fp ) ;
return 1 ;
}
/*
Insert file " insertname " between lines " start_line " and " end_line " of file " filename "
*/
int insert_into_file ( const char * filename , const char * insertname , const char * start_line , const char * end_line )
{
int ch ;
static char line [ 1024 * 4 ] ;
const char * tmpname = " tmp.h " ;
FILE * source_fp ;
FILE * dest_fp ;
FILE * insert_fp ;
if ( file_copy ( filename , tmpname ) = = 0 )
return 0 ;
source_fp = fopen ( tmpname , " r " ) ;
dest_fp = fopen ( filename , " w " ) ;
insert_fp = fopen ( insertname , " r " ) ;
if ( source_fp = = NULL | | dest_fp = = NULL | | insert_fp = = NULL )
return 0 ;
for ( ; ; )
{
if ( fgets ( line , 1024 * 4 , source_fp ) = = NULL )
break ;
if ( strncmp ( line , start_line , strlen ( start_line ) ) = = 0 )
{
fputs ( line , dest_fp ) ;
while ( ( ch = fgetc ( insert_fp ) ) ! = EOF )
fputc ( ch , dest_fp ) ;
fputs ( " \n " , dest_fp ) ;
for ( ; ; )
{
if ( fgets ( line , 1024 * 4 , source_fp ) = = NULL )
break ;
if ( strncmp ( line , end_line , strlen ( end_line ) ) = = 0 )
{
fputs ( line , dest_fp ) ;
break ;
}
}
}
else
{
fputs ( line , dest_fp ) ;
}
}
fclose ( insert_fp ) ;
fclose ( source_fp ) ;
fclose ( dest_fp ) ;
unlink ( tmpname ) ;
2016-01-04 07:31:49 +08:00
printf ( " patched %s \n " , filename ) ;
2015-12-23 05:23:42 +08:00
return 1 ;
}
2015-12-21 02:31:07 +08:00
/*===========================================*/
char * strlowercase ( const char * s )
{
int i , len = strlen ( s ) ;
static char buf [ 1024 ] ;
2015-12-21 06:39:27 +08:00
for ( i = 0 ; i < = len ; i + + )
2015-12-21 02:31:07 +08:00
buf [ i ] = tolower ( s [ i ] ) ;
return buf ;
}
2015-12-21 06:39:27 +08:00
char * struppercase ( const char * s )
{
int i , len = strlen ( s ) ;
static char buf [ 1024 ] ;
for ( i = 0 ; i < = len ; i + + )
buf [ i ] = toupper ( s [ i ] ) ;
return buf ;
}
2015-12-21 02:31:07 +08:00
/*===========================================*/
FILE * buf_code_fp ;
FILE * buf_header_fp ;
FILE * setup_code_fp ;
2015-12-22 22:20:52 +08:00
FILE * setup_header_fp ;
2015-12-23 17:04:08 +08:00
FILE * u8g2_cpp_header_fp ;
2015-12-24 01:44:00 +08:00
FILE * u8x8_cpp_header_fp ;
2015-12-21 02:31:07 +08:00
2015-12-24 18:32:33 +08:00
FILE * u8x8_setup_c_md_fp ;
FILE * u8x8_setup_cpp_md_fp ;
FILE * u8g2_setup_c_md_fp ;
FILE * u8g2_setup_cpp_md_fp ;
2016-02-28 02:23:57 +08:00
const char * get_setup_function_name ( int controller_idx , int display_idx , const char * postfix )
{
static char s [ 1024 ] ;
strcpy ( s , " u8g2_Setup_ " ) ;
strcat ( s , strlowercase ( controller_list [ controller_idx ] . name ) ) ;
strcat ( s , " _ " ) ;
if ( controller_list [ controller_idx ] . cad_shortname [ 0 ] ! = ' \0 ' )
{
strcat ( s , strlowercase ( controller_list [ controller_idx ] . cad_shortname ) ) ;
strcat ( s , " _ " ) ;
}
strcat ( s , strlowercase ( controller_list [ controller_idx ] . display_list [ display_idx ] . name ) ) ;
strcat ( s , " _ " ) ;
strcat ( s , postfix ) ;
2016-05-14 04:51:02 +08:00
return s ;
2016-02-28 02:23:57 +08:00
}
2015-12-21 02:31:07 +08:00
2015-12-22 22:20:52 +08:00
void do_setup_prototype ( FILE * fp , int controller_idx , int display_idx , const char * postfix )
{
2016-02-28 02:23:57 +08:00
/*
2015-12-23 05:23:42 +08:00
fprintf ( fp , " void u8g2_Setup_ " ) ;
2015-12-22 22:20:52 +08:00
fprintf ( fp , " %s_ " , strlowercase ( controller_list [ controller_idx ] . name ) ) ;
fprintf ( fp , " %s_ " , strlowercase ( controller_list [ controller_idx ] . display_list [ display_idx ] . name ) ) ;
2015-12-24 06:18:29 +08:00
fprintf ( fp , " %s(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb) " , postfix ) ;
2016-02-28 02:23:57 +08:00
*/
fprintf ( fp , " void %s " , get_setup_function_name ( controller_idx , display_idx , postfix ) ) ;
fprintf ( fp , " (u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb) " ) ;
2015-12-22 22:20:52 +08:00
}
2015-12-21 02:31:07 +08:00
2015-12-23 16:04:24 +08:00
/*===========================================*/
2015-12-24 01:44:00 +08:00
/*
class U8X8_SSD1306_128X64_4W_SW_SPI : public U8X8 {
public : U8X8_SSD1306_128X64_4W_SW_SPI ( uint8_t clock , uint8_t data , uint8_t cs , uint8_t dc , uint8_t reset = U8X8_PIN_NONE ) : U8X8 ( ) {
u8x8_Setup ( getU8x8 ( ) , u8x8_d_ssd1306_128x64_noname , u8x8_cad_001 , u8x8_byte_4wire_sw_spi , u8x8_gpio_and_delay_arduino ) ;
u8x8_SetPin_4Wire_SW_SPI ( getU8x8 ( ) , clock , data , cs , dc , reset ) ;
}
}
*/
void do_u8x8_header ( int controller_idx , int display_idx , int interface_idx )
{
FILE * fp = u8x8_cpp_header_fp ;
fprintf ( fp , " class U8X8_ " ) ;
fprintf ( fp , " %s_ " , struppercase ( controller_list [ controller_idx ] . name ) ) ;
2016-12-05 05:48:27 +08:00
fprintf ( fp , " %s " , struppercase ( controller_list [ controller_idx ] . display_list [ display_idx ] . name ) ) ;
if ( interface_list [ interface_idx ] . interface_name [ 0 ] ! = ' \0 ' )
fprintf ( fp , " _%s " , struppercase ( interface_list [ interface_idx ] . interface_name ) ) ;
2015-12-24 01:44:00 +08:00
fprintf ( fp , " : public U8X8 { \n " ) ;
fprintf ( fp , " public: " ) ;
fprintf ( fp , " U8X8_ " ) ;
fprintf ( fp , " %s_ " , struppercase ( controller_list [ controller_idx ] . name ) ) ;
2016-12-05 05:48:27 +08:00
fprintf ( fp , " %s " , struppercase ( controller_list [ controller_idx ] . display_list [ display_idx ] . name ) ) ;
if ( interface_list [ interface_idx ] . interface_name [ 0 ] ! = ' \0 ' )
fprintf ( fp , " _%s " , struppercase ( interface_list [ interface_idx ] . interface_name ) ) ;
2015-12-24 01:44:00 +08:00
fprintf ( fp , " (%s) : U8X8() { \n " , interface_list [ interface_idx ] . pins_with_type ) ;
fprintf ( fp , " " ) ;
fprintf ( fp , " u8x8_Setup(getU8x8(), u8x8_d_ " ) ;
fprintf ( fp , " %s_ " , strlowercase ( controller_list [ controller_idx ] . name ) ) ;
fprintf ( fp , " %s, " , strlowercase ( controller_list [ controller_idx ] . display_list [ display_idx ] . name ) ) ;
fprintf ( fp , " %s, " , strlowercase ( controller_list [ controller_idx ] . cad ) ) ;
fprintf ( fp , " %s, " , interface_list [ interface_idx ] . arduino_com_procedure ) ;
fprintf ( fp , " %s); \n " , interface_list [ interface_idx ] . arduino_gpio_procedure ) ;
fprintf ( fp , " " ) ;
fprintf ( fp , " %s(getU8x8(), " , interface_list [ interface_idx ] . setpin_function ) ;
fprintf ( fp , " %s); \n " , interface_list [ interface_idx ] . pins_plain ) ;
fprintf ( fp , " } \n " ) ;
fprintf ( fp , " }; \n " ) ;
}
2015-12-23 16:04:24 +08:00
/*
class U8G2_SSD1306_128x64_NONAME_1_SW_SPI : public U8G2
{
public :
U8G2_SSD1306_128x64_NONAME_1_SW_SPI ( const u8g2_cb_t * rotation , uint8_t clock , uint8_t data , uint8_t cs , uint8_t dc , uint8_t reset = U8X8_PIN_NONE )
{
2015-12-24 06:18:29 +08:00
u8g2_Setup_ssd1306_128x64_noname_1 ( & u8g2 , rotation , u8x8_byte_4wire_sw_spi , u8x8_gpio_and_delay_arduino , ) ;
2015-12-23 16:04:24 +08:00
u8x8_SetPin_4Wire_SW_SPI ( getU8x8 ( ) , clock , data , cs , dc , reset ) ;
}
} ;
*/
2015-12-24 01:44:00 +08:00
2015-12-23 16:04:24 +08:00
void do_display_interface ( int controller_idx , int display_idx , const char * postfix , int interface_idx )
{
2016-02-27 05:16:08 +08:00
2015-12-23 17:04:08 +08:00
FILE * fp = u8g2_cpp_header_fp ;
2016-02-27 05:16:08 +08:00
2016-02-29 05:24:05 +08:00
printf ( " %s %s " , postfix , interface_list [ interface_idx ] . interface_name ) ;
2016-02-27 05:16:08 +08:00
2015-12-23 16:04:24 +08:00
fprintf ( fp , " class U8G2_ " ) ;
fprintf ( fp , " %s_ " , struppercase ( controller_list [ controller_idx ] . name ) ) ;
fprintf ( fp , " %s_ " , struppercase ( controller_list [ controller_idx ] . display_list [ display_idx ] . name ) ) ;
2016-12-05 05:48:27 +08:00
fprintf ( fp , " %s " , struppercase ( postfix ) ) ;
if ( interface_list [ interface_idx ] . interface_name [ 0 ] ! = ' \0 ' )
fprintf ( fp , " _%s " , struppercase ( interface_list [ interface_idx ] . interface_name ) ) ;
2015-12-23 16:04:24 +08:00
fprintf ( fp , " : public U8G2 { \n " ) ;
fprintf ( fp , " public: " ) ;
fprintf ( fp , " U8G2_ " ) ;
fprintf ( fp , " %s_ " , struppercase ( controller_list [ controller_idx ] . name ) ) ;
fprintf ( fp , " %s_ " , struppercase ( controller_list [ controller_idx ] . display_list [ display_idx ] . name ) ) ;
2016-12-05 05:48:27 +08:00
fprintf ( fp , " %s " , struppercase ( postfix ) ) ;
if ( interface_list [ interface_idx ] . interface_name [ 0 ] ! = ' \0 ' )
fprintf ( fp , " _%s " , struppercase ( interface_list [ interface_idx ] . interface_name ) ) ;
2015-12-23 16:04:24 +08:00
fprintf ( fp , " (const u8g2_cb_t *rotation, " ) ;
2015-12-23 17:44:20 +08:00
fprintf ( fp , " %s) : U8G2() { \n " , interface_list [ interface_idx ] . pins_with_type ) ;
2015-12-23 16:04:24 +08:00
fprintf ( fp , " " ) ;
2016-02-28 02:23:57 +08:00
/*
2015-12-23 16:04:24 +08:00
fprintf ( fp , " u8g2_Setup_ " ) ;
fprintf ( fp , " %s_ " , strlowercase ( controller_list [ controller_idx ] . name ) ) ;
fprintf ( fp , " %s_ " , strlowercase ( controller_list [ controller_idx ] . display_list [ display_idx ] . name ) ) ;
fprintf ( fp , " %s " , postfix ) ;
2016-02-28 02:23:57 +08:00
*/
fprintf ( fp , " %s " , get_setup_function_name ( controller_idx , display_idx , postfix ) ) ;
2015-12-23 16:04:24 +08:00
fprintf ( fp , " (&u8g2, " ) ;
2015-12-24 06:18:29 +08:00
fprintf ( fp , " rotation, " ) ;
2015-12-23 16:04:24 +08:00
fprintf ( fp , " %s, " , interface_list [ interface_idx ] . arduino_com_procedure ) ;
2015-12-24 06:18:29 +08:00
fprintf ( fp , " %s); \n " , interface_list [ interface_idx ] . arduino_gpio_procedure ) ;
2015-12-23 16:04:24 +08:00
fprintf ( fp , " " ) ;
fprintf ( fp , " %s(getU8x8(), " , interface_list [ interface_idx ] . setpin_function ) ;
fprintf ( fp , " %s); \n " , interface_list [ interface_idx ] . pins_plain ) ;
fprintf ( fp , " } \n " ) ;
2015-12-23 17:04:08 +08:00
fprintf ( fp , " }; \n " ) ;
2015-12-23 16:04:24 +08:00
2015-12-24 01:44:00 +08:00
if ( strcmp ( postfix , " 1 " ) = = 0 )
do_u8x8_header ( controller_idx , display_idx , interface_idx ) ;
2015-12-23 16:04:24 +08:00
}
2015-12-24 01:44:00 +08:00
2015-12-21 02:31:07 +08:00
/*===========================================*/
2015-12-21 06:39:27 +08:00
void do_display ( int controller_idx , int display_idx , const char * postfix )
{
2016-02-28 02:23:57 +08:00
2015-12-22 22:20:52 +08:00
do_setup_prototype ( setup_header_fp , controller_idx , display_idx , postfix ) ;
fprintf ( setup_header_fp , " ; \n " ) ;
do_setup_prototype ( setup_code_fp , controller_idx , display_idx , postfix ) ;
fprintf ( setup_code_fp , " \n " ) ;
2015-12-21 06:39:27 +08:00
fprintf ( setup_code_fp , " { \n " ) ;
2015-12-22 05:24:05 +08:00
fprintf ( setup_code_fp , " uint8_t tile_buf_height; \n " ) ;
2015-12-23 05:23:42 +08:00
fprintf ( setup_code_fp , " uint8_t *buf; \n " ) ;
fprintf ( setup_code_fp , " u8g2_SetupDisplay(u8g2, u8x8_d_ " ) ;
2015-12-21 06:39:27 +08:00
fprintf ( setup_code_fp , " %s_ " , strlowercase ( controller_list [ controller_idx ] . name ) ) ;
fprintf ( setup_code_fp , " %s, " , strlowercase ( controller_list [ controller_idx ] . display_list [ display_idx ] . name ) ) ;
fprintf ( setup_code_fp , " %s, " , controller_list [ controller_idx ] . cad ) ;
2015-12-22 05:24:05 +08:00
fprintf ( setup_code_fp , " byte_cb, gpio_and_delay_cb); \n " ) ;
2015-12-23 05:23:42 +08:00
fprintf ( setup_code_fp , " buf = " ) ;
2015-12-22 22:20:52 +08:00
fprintf ( setup_code_fp , " u8g2_m_%s_%d_%s(&tile_buf_height); \n " , strlowercase ( controller_list [ controller_idx ] . name ) , controller_list [ controller_idx ] . tile_width , postfix ) ;
2016-02-23 01:51:48 +08:00
fprintf ( setup_code_fp , " u8g2_SetupBuffer(u8g2, buf, tile_buf_height, %s, rotation); \n " , controller_list [ controller_idx ] . ll_hvline ) ;
2015-12-21 06:39:27 +08:00
fprintf ( setup_code_fp , " } \n " ) ;
2015-12-23 16:04:24 +08:00
/* generate interfaces for this display */
if ( controller_list [ controller_idx ] . com & COM_4WSPI )
{
do_display_interface ( controller_idx , display_idx , postfix , 0 ) ; /* SW SPI */
do_display_interface ( controller_idx , display_idx , postfix , 1 ) ; /* HW SPI */
}
if ( controller_list [ controller_idx ] . com & COM_3WSPI )
{
2015-12-23 17:44:20 +08:00
do_display_interface ( controller_idx , display_idx , postfix , 4 ) ; /* 3wire SW SPI */
//do_display_interface(controller_idx, display_idx, postfix, 5); /* 3wire HW SPI (not implemented) */
2015-12-23 16:04:24 +08:00
}
if ( controller_list [ controller_idx ] . com & COM_6800 )
{
2015-12-23 17:44:20 +08:00
do_display_interface ( controller_idx , display_idx , postfix , 2 ) ; /* 6800 mode */
2015-12-23 16:04:24 +08:00
}
if ( controller_list [ controller_idx ] . com & COM_8080 )
{
2015-12-23 17:44:20 +08:00
do_display_interface ( controller_idx , display_idx , postfix , 3 ) ; /* 8080 mode */
2015-12-23 16:04:24 +08:00
}
2016-06-23 05:58:14 +08:00
if ( controller_list [ controller_idx ] . com & COM_I2C )
2015-12-23 16:04:24 +08:00
{
2016-05-15 06:05:41 +08:00
do_display_interface ( controller_idx , display_idx , postfix , 6 ) ; /* SW I2C */
do_display_interface ( controller_idx , display_idx , postfix , 7 ) ; /* HW I2C */
2016-11-13 00:30:14 +08:00
do_display_interface ( controller_idx , display_idx , postfix , 10 ) ; /* 2nd HW I2C */
2015-12-23 16:04:24 +08:00
}
2016-02-27 04:58:40 +08:00
if ( controller_list [ controller_idx ] . com & COM_ST7920SPI )
{
2016-02-27 05:16:08 +08:00
do_display_interface ( controller_idx , display_idx , postfix , 8 ) ; /* ST7920 SW SPI */
2016-06-24 06:58:17 +08:00
do_display_interface ( controller_idx , display_idx , postfix , 9 ) ; /* HW SPI (not yet implemented) */
2016-02-27 04:58:40 +08:00
}
2016-07-23 17:26:33 +08:00
if ( controller_list [ controller_idx ] . com & COM_UART )
{
/* currently there is no Arduino C++ interface, instead the interface is created manually in the example */
}
2016-12-05 05:48:27 +08:00
if ( controller_list [ controller_idx ] . com & COM_KS0108 )
{
do_display_interface ( controller_idx , display_idx , postfix , 11 ) ; /* KS0108 6800 parallel mode */
}
2015-12-23 16:04:24 +08:00
2015-12-21 06:39:27 +08:00
}
2015-12-21 02:31:07 +08:00
void do_controller_buffer_code ( int idx , const char * postfix , int buf_len , int rows )
{
int display_idx ;
2016-02-28 02:23:57 +08:00
char s [ 1024 ] ;
sprintf ( s , " u8g2_m_%s_%d_%s " , strlowercase ( controller_list [ idx ] . name ) , controller_list [ idx ] . tile_width , postfix ) ;
2015-12-21 02:31:07 +08:00
2016-02-28 02:23:57 +08:00
if ( str_exists ( s ) = = 0 )
{
str_add ( s ) ;
//FILE *fp = stdout;
fprintf ( buf_code_fp , " uint8_t *%s(uint8_t *page_cnt) \n " , s ) ;
fprintf ( buf_code_fp , " { \n " ) ;
fprintf ( buf_code_fp , " static uint8_t buf[%d]; \n " , buf_len ) ;
fprintf ( buf_code_fp , " *page_cnt = %d; \n " , rows ) ;
fprintf ( buf_code_fp , " return buf; \n " ) ;
fprintf ( buf_code_fp , " } \n " ) ;
fprintf ( buf_header_fp , " uint8_t *%s(uint8_t *page_cnt); \n " , s ) ;
}
2015-12-21 02:31:07 +08:00
display_idx = 0 ;
2015-12-22 05:24:05 +08:00
fprintf ( setup_code_fp , " /* %s %s */ \n " , controller_list [ idx ] . name , postfix ) ;
2015-12-21 02:31:07 +08:00
while ( controller_list [ idx ] . display_list [ display_idx ] . name ! = NULL )
{
2015-12-21 06:39:27 +08:00
do_display ( idx , display_idx , postfix ) ;
2015-12-21 02:31:07 +08:00
display_idx + + ;
}
}
void do_controller_list ( void )
{
int i ;
for ( i = 0 ; i < sizeof ( controller_list ) / sizeof ( * controller_list ) ; i + + )
{
2016-02-29 05:24:05 +08:00
printf ( " %s: " , controller_list [ i ] . name ) ;
2015-12-22 05:24:05 +08:00
fprintf ( setup_code_fp , " /* %s */ \n " , controller_list [ i ] . name ) ;
2015-12-21 02:31:07 +08:00
do_controller_buffer_code ( i , " 1 " , controller_list [ i ] . tile_width * 8 , 1 ) ;
do_controller_buffer_code ( i , " 2 " , controller_list [ i ] . tile_width * 8 * 2 , 2 ) ;
do_controller_buffer_code ( i , " f " , controller_list [ i ] . tile_width * 8 * controller_list [ i ] . tile_height , controller_list [ i ] . tile_height ) ;
2016-02-29 05:24:05 +08:00
printf ( " \n " ) ;
2015-12-21 02:31:07 +08:00
}
}
2015-12-24 03:54:16 +08:00
2015-12-24 18:32:33 +08:00
int is_arduino_cpp = 1 ;
int is_u8g2 = 1 ;
FILE * md_fp ;
2015-12-24 03:54:16 +08:00
void do_md_display ( int controller_idx , int display_idx )
{
2015-12-24 18:32:33 +08:00
FILE * fp = md_fp ;
/*
2015-12-24 03:54:16 +08:00
fprintf ( fp , " %s: " , controller_list [ controller_idx ] . name ) ;
fprintf ( fp , " %s \n " , controller_list [ controller_idx ] . display_list [ display_idx ] . name ) ;
2015-12-24 18:32:33 +08:00
*/
2016-06-26 03:34:58 +08:00
2015-12-24 18:32:33 +08:00
if ( is_u8g2 )
{
2016-06-26 03:34:58 +08:00
fprintf ( fp , " \n " ) ;
fprintf ( fp , " ## %s " , struppercase ( controller_list [ controller_idx ] . name ) ) ;
fprintf ( fp , " %s " , struppercase ( controller_list [ controller_idx ] . display_list [ display_idx ] . name ) ) ;
fprintf ( fp , " \n " ) ;
2015-12-24 18:32:33 +08:00
fprintf ( fp , " | Controller \" %s \" , " , controller_list [ controller_idx ] . name ) ;
fprintf ( fp , " Display \" %s \" | " , controller_list [ controller_idx ] . display_list [ display_idx ] . name ) ;
fprintf ( fp , " Descirption | \n " ) ;
2015-12-25 23:42:45 +08:00
fprintf ( fp , " |---|---| \n " ) ;
2015-12-24 18:32:33 +08:00
}
else
{
2016-06-26 03:34:58 +08:00
if ( is_u8g2 ! = 0 | | strcmp ( controller_list [ controller_idx ] . ll_hvline , U8X8_HVLINE ) = = 0 )
{
fprintf ( fp , " \n " ) ;
fprintf ( fp , " ## %s " , struppercase ( controller_list [ controller_idx ] . name ) ) ;
fprintf ( fp , " %s " , struppercase ( controller_list [ controller_idx ] . display_list [ display_idx ] . name ) ) ;
fprintf ( fp , " \n " ) ;
fprintf ( fp , " | Controller \" %s \" , " , controller_list [ controller_idx ] . name ) ;
fprintf ( fp , " Display \" %s \" | \n " , controller_list [ controller_idx ] . display_list [ display_idx ] . name ) ;
fprintf ( fp , " |---| \n " ) ;
}
2015-12-24 18:32:33 +08:00
}
2015-12-24 03:54:16 +08:00
}
2015-12-24 18:32:33 +08:00
void do_md_display_interface_buffer ( int controller_idx , int display_idx , int interface_idx , char * postfix , int size , int rows )
2015-12-24 03:54:16 +08:00
{
2015-12-24 18:32:33 +08:00
FILE * fp = md_fp ;
2015-12-24 03:54:16 +08:00
/*
fprintf ( fp , " %s: " , controller_list [ controller_idx ] . name ) ;
fprintf ( fp , " %s: " , controller_list [ controller_idx ] . display_list [ display_idx ] . name ) ;
fprintf ( fp , " %s: " , prefix ) ;
fprintf ( fp , " %s \n " , interface_list [ interface_idx ] . interface_name ) ;
*/
2015-12-24 18:32:33 +08:00
if ( is_u8g2 )
{
if ( is_arduino_cpp )
{
fprintf ( fp , " | U8G2_ " ) ;
fprintf ( fp , " %s_ " , struppercase ( controller_list [ controller_idx ] . name ) ) ;
fprintf ( fp , " %s_ " , struppercase ( controller_list [ controller_idx ] . display_list [ display_idx ] . name ) ) ;
2016-12-05 05:48:27 +08:00
fprintf ( fp , " %s " , struppercase ( postfix ) ) ;
if ( interface_list [ interface_idx ] . interface_name [ 0 ] ! = ' \0 ' )
fprintf ( fp , " _%s " , struppercase ( interface_list [ interface_idx ] . interface_name ) ) ;
2015-12-24 18:32:33 +08:00
fprintf ( fp , " (rotation, %s) " , interface_list [ interface_idx ] . pins_md_plain ) ;
if ( postfix [ 0 ] = = ' f ' )
{
fprintf ( fp , " | full framebuffer, size = %d bytes | \n " , size ) ;
}
else
{
fprintf ( fp , " | page buffer, size = %d bytes | \n " , size ) ;
}
}
else
{
2016-02-28 02:23:57 +08:00
fprintf ( fp , " | " ) ;
/*
fprintf ( fp , " u8g2_Setup_ " ) ;
2015-12-24 18:32:33 +08:00
fprintf ( fp , " %s_ " , strlowercase ( controller_list [ controller_idx ] . name ) ) ;
fprintf ( fp , " %s_ " , strlowercase ( controller_list [ controller_idx ] . display_list [ display_idx ] . name ) ) ;
fprintf ( fp , " %s " , strlowercase ( postfix ) ) ;
2016-02-28 02:23:57 +08:00
*/
fprintf ( fp , " %s " , get_setup_function_name ( controller_idx , display_idx , postfix ) ) ;
2015-12-24 18:32:33 +08:00
fprintf ( fp , " (u8g2, " ) ;
fprintf ( fp , " rotation, " ) ;
fprintf ( fp , " %s, " , interface_list [ interface_idx ] . generic_com_procedure ) ;
2016-02-10 05:50:57 +08:00
fprintf ( fp , " %s) " , " uC specific " ) ;
2015-12-24 18:32:33 +08:00
if ( postfix [ 0 ] = = ' f ' )
{
fprintf ( fp , " | full framebuffer, size = %d bytes | \n " , size ) ;
}
else
{
fprintf ( fp , " | page buffer, size = %d bytes | \n " , size ) ;
}
}
}
2015-12-24 03:54:16 +08:00
}
void do_md_display_interface ( int controller_idx , int display_idx , int interface_idx )
{
2015-12-24 18:32:33 +08:00
FILE * fp = md_fp ;
2015-12-24 03:54:16 +08:00
2015-12-24 18:32:33 +08:00
if ( ! is_u8g2 )
{
2016-06-26 03:34:58 +08:00
if ( strcmp ( controller_list [ controller_idx ] . ll_hvline , U8X8_HVLINE ) = = 0 )
2015-12-24 18:32:33 +08:00
{
2016-06-26 03:34:58 +08:00
if ( is_arduino_cpp )
{
fprintf ( fp , " | U8X8_ " ) ;
fprintf ( fp , " %s_ " , struppercase ( controller_list [ controller_idx ] . name ) ) ;
2016-12-05 05:48:27 +08:00
fprintf ( fp , " %s " , struppercase ( controller_list [ controller_idx ] . display_list [ display_idx ] . name ) ) ;
if ( interface_list [ interface_idx ] . interface_name [ 0 ] ! = ' \0 ' )
fprintf ( fp , " _%s " , struppercase ( interface_list [ interface_idx ] . interface_name ) ) ;
2016-06-26 03:34:58 +08:00
fprintf ( fp , " (%s) | \n " , interface_list [ interface_idx ] . pins_md_plain ) ;
}
else
{
fprintf ( fp , " | u8x8_Setup(u8x8_d_ " ) ;
fprintf ( fp , " %s_ " , strlowercase ( controller_list [ controller_idx ] . name ) ) ;
fprintf ( fp , " %s, " , strlowercase ( controller_list [ controller_idx ] . display_list [ display_idx ] . name ) ) ;
fprintf ( fp , " %s, " , strlowercase ( controller_list [ controller_idx ] . cad ) ) ;
fprintf ( fp , " %s, " , strlowercase ( interface_list [ interface_idx ] . generic_com_procedure ) ) ;
fprintf ( fp , " uC specific) | \n " ) ;
}
2015-12-24 18:32:33 +08:00
}
}
2015-12-24 03:54:16 +08:00
do_md_display_interface_buffer ( controller_idx , display_idx , interface_idx , " 1 " , controller_list [ controller_idx ] . tile_width * 8 , 1 ) ;
do_md_display_interface_buffer ( controller_idx , display_idx , interface_idx , " 2 " , controller_list [ controller_idx ] . tile_width * 8 * 2 , 2 ) ;
do_md_display_interface_buffer ( controller_idx , display_idx , interface_idx , " f " , controller_list [ controller_idx ] . tile_width * 8 * controller_list [ controller_idx ] . tile_height , controller_list [ controller_idx ] . tile_height ) ;
}
void do_md_controller_list ( void )
{
int controller_idx , display_idx ;
for ( controller_idx = 0 ; controller_idx < sizeof ( controller_list ) / sizeof ( * controller_list ) ; controller_idx + + )
{
display_idx = 0 ;
while ( controller_list [ controller_idx ] . display_list [ display_idx ] . name ! = NULL )
{
do_md_display ( controller_idx , display_idx ) ;
/* generate interfaces for this display */
if ( controller_list [ controller_idx ] . com & COM_4WSPI )
{
do_md_display_interface ( controller_idx , display_idx , 0 ) ; /* SW SPI */
2015-12-24 18:32:33 +08:00
if ( is_arduino_cpp )
{
do_md_display_interface ( controller_idx , display_idx , 1 ) ; /* HW SPI */
}
2015-12-24 03:54:16 +08:00
}
if ( controller_list [ controller_idx ] . com & COM_3WSPI )
{
do_md_display_interface ( controller_idx , display_idx , 4 ) ; /* 3wire SW SPI */
//do_md_display_interface(controller_idx, display_idx, 5); /* 3wire HW SPI (not implemented) */
}
if ( controller_list [ controller_idx ] . com & COM_6800 )
{
do_md_display_interface ( controller_idx , display_idx , 2 ) ; /* 6800 mode */
}
if ( controller_list [ controller_idx ] . com & COM_8080 )
{
do_md_display_interface ( controller_idx , display_idx , 3 ) ; /* 8080 mode */
}
2016-06-23 05:58:14 +08:00
if ( controller_list [ controller_idx ] . com & COM_I2C )
2015-12-24 03:54:16 +08:00
{
2016-05-15 06:05:41 +08:00
do_md_display_interface ( controller_idx , display_idx , 6 ) ; /* SW I2C */
do_md_display_interface ( controller_idx , display_idx , 7 ) ; /* HW I2C */
2016-12-30 17:55:11 +08:00
do_md_display_interface ( controller_idx , display_idx , 10 ) ; /* 2nd HW I2C */
2015-12-24 03:54:16 +08:00
}
2016-02-27 05:16:08 +08:00
if ( controller_list [ controller_idx ] . com & COM_ST7920SPI )
{
do_md_display_interface ( controller_idx , display_idx , 8 ) ; /* ST7920 SW SPI */
2016-06-24 06:58:17 +08:00
do_md_display_interface ( controller_idx , display_idx , 9 ) ; /* HW SPI (not yet implemented) */
2016-02-27 05:16:08 +08:00
}
2016-12-05 05:48:27 +08:00
if ( controller_list [ controller_idx ] . com & COM_KS0108 )
{
do_md_display_interface ( controller_idx , display_idx , 11 ) ; /* KS0108 */
}
2015-12-24 03:54:16 +08:00
display_idx + + ;
}
}
}
2015-12-21 02:31:07 +08:00
int main ( void )
{
2015-12-22 22:20:52 +08:00
buf_code_fp = fopen ( " u8g2_d_memory.c " , " w " ) ;
fprintf ( buf_code_fp , " /* u8g2_d_memory.c */ \n " ) ;
fprintf ( buf_code_fp , " /* generated code, codebuild, u8g2 project */ \n " ) ;
fprintf ( buf_code_fp , " \n " ) ;
fprintf ( buf_code_fp , " #include \" u8g2.h \" \n " ) ;
fprintf ( buf_code_fp , " \n " ) ;
2015-12-21 02:31:07 +08:00
buf_header_fp = fopen ( " u8g2_memory.h " , " w " ) ;
2015-12-23 05:23:42 +08:00
//fprintf(buf_header_fp, "/* start of generated code, codebuild, u8g2 project */\n");
2015-12-21 02:31:07 +08:00
2015-12-22 22:20:52 +08:00
setup_code_fp = fopen ( " u8g2_d_setup.c " , " w " ) ;
fprintf ( setup_code_fp , " /* u8g2_d_setup.c */ \n " ) ;
fprintf ( setup_code_fp , " /* generated code, codebuild, u8g2 project */ \n " ) ;
fprintf ( setup_code_fp , " \n " ) ;
fprintf ( setup_code_fp , " #include \" u8g2.h \" \n " ) ;
fprintf ( setup_code_fp , " \n " ) ;
setup_header_fp = fopen ( " u8g2_setup.h " , " w " ) ;
2015-12-23 05:23:42 +08:00
//fprintf(setup_header_fp, "/* start of generated code, codebuild, u8g2 project */\n");
2015-12-21 02:31:07 +08:00
2015-12-23 17:04:08 +08:00
u8g2_cpp_header_fp = fopen ( " U8g2lib.h " , " w " ) ;
fprintf ( u8g2_cpp_header_fp , " /* generated code (codebuild), u8g2 project */ \n " ) ;
2015-12-24 01:44:00 +08:00
u8x8_cpp_header_fp = fopen ( " U8x8lib.h " , " w " ) ;
fprintf ( u8x8_cpp_header_fp , " /* generated code (codebuild), u8g2 project */ \n " ) ;
2015-12-24 18:32:33 +08:00
u8x8_setup_c_md_fp = fopen ( " u8x8setupc.md " , " w " ) ;
u8x8_setup_cpp_md_fp = fopen ( " u8x8setupcpp.md " , " w " ) ;
u8g2_setup_c_md_fp = fopen ( " u8g2setupc.md " , " w " ) ;
u8g2_setup_cpp_md_fp = fopen ( " u8g2setupcpp.md " , " w " ) ;
do_controller_list ( ) ;
2015-12-24 01:44:00 +08:00
2015-12-23 17:04:08 +08:00
2015-12-24 18:32:33 +08:00
md_fp = u8g2_setup_cpp_md_fp ;
is_arduino_cpp = 1 ;
is_u8g2 = 1 ;
do_md_controller_list ( ) ;
md_fp = u8g2_setup_c_md_fp ;
is_arduino_cpp = 0 ;
is_u8g2 = 1 ;
do_md_controller_list ( ) ;
md_fp = u8x8_setup_cpp_md_fp ;
is_arduino_cpp = 1 ;
is_u8g2 = 0 ;
do_md_controller_list ( ) ;
md_fp = u8x8_setup_c_md_fp ;
is_arduino_cpp = 0 ;
is_u8g2 = 0 ;
2015-12-24 03:54:16 +08:00
do_md_controller_list ( ) ;
2015-12-21 02:31:07 +08:00
fprintf ( buf_code_fp , " /* end of generated code */ \n " ) ;
fclose ( buf_code_fp ) ;
2015-12-23 05:23:42 +08:00
//fprintf(buf_header_fp, "/* end of generated code */\n");
2015-12-21 02:31:07 +08:00
fclose ( buf_header_fp ) ;
2015-12-21 06:39:27 +08:00
fprintf ( setup_code_fp , " /* end of generated code */ \n " ) ;
fclose ( setup_code_fp ) ;
2015-12-22 22:20:52 +08:00
2015-12-23 05:23:42 +08:00
//fprintf(setup_header_fp, "/* end of generated code */\n");
2015-12-22 22:20:52 +08:00
fclose ( setup_header_fp ) ;
2015-12-23 17:04:08 +08:00
fclose ( u8g2_cpp_header_fp ) ;
2015-12-24 01:44:00 +08:00
fclose ( u8x8_cpp_header_fp ) ;
2015-12-24 18:32:33 +08:00
fclose ( u8x8_setup_c_md_fp ) ;
fclose ( u8x8_setup_cpp_md_fp ) ;
fclose ( u8g2_setup_c_md_fp ) ;
fclose ( u8g2_setup_cpp_md_fp ) ;
2015-12-23 05:23:42 +08:00
system ( " cp u8g2_d_memory.c ../../csrc/. " ) ;
2016-01-04 07:31:49 +08:00
puts ( " generate u8g2_d_memory.c " ) ;
2015-12-23 05:23:42 +08:00
system ( " cp u8g2_d_setup.c ../../csrc/. " ) ;
2016-01-04 07:31:49 +08:00
puts ( " generate u8g2_d_setup.c " ) ;
2015-12-23 05:23:42 +08:00
insert_into_file ( " ../../csrc/u8g2.h " , " u8g2_memory.h " , " /* u8g2_d_memory.c generated code start */ " , " /* u8g2_d_memory.c generated code end */ " ) ;
insert_into_file ( " ../../csrc/u8g2.h " , " u8g2_setup.h " , " /* u8g2_d_setup.c generated code start */ " , " /* u8g2_d_setup.c generated code end */ " ) ;
2015-12-23 17:04:08 +08:00
insert_into_file ( " ../../cppsrc/U8g2lib.h " , " U8g2lib.h " , " /* Arduino constructor list start */ " , " /* Arduino constructor list end */ " ) ;
2015-12-24 02:02:06 +08:00
insert_into_file ( " ../../cppsrc/U8x8lib.h " , " U8x8lib.h " , " // constructor list start " , " // constructor list end " ) ;
2015-12-23 05:23:42 +08:00
2016-02-10 05:57:47 +08:00
insert_into_file ( " ../../../u8g2.wiki/u8g2setupc.md " , " u8g2setupc.md " , " # Setup Function Reference " , " # Links " ) ;
2016-02-27 05:16:08 +08:00
insert_into_file ( " ../../../u8g2.wiki/u8g2setupcpp.md " , " u8g2setupcpp.md " , " # Constructor Reference " , " # Links " ) ;
2016-02-10 05:57:47 +08:00
insert_into_file ( " ../../../u8g2.wiki/u8x8setupc.md " , " u8x8setupc.md " , " # Setup Function Reference " , " # Links " ) ;
2016-02-27 05:16:08 +08:00
insert_into_file ( " ../../../u8g2.wiki/u8x8setupcpp.md " , " u8x8setupcpp.md " , " # Constructor Reference " , " # Links " ) ;
2015-12-24 03:54:16 +08:00
2015-12-21 02:31:07 +08:00
return 0 ;
}