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
/*===========================================*/
2015-12-23 16:04:24 +08:00
# define COM_4WSPI 0x0001
# define COM_3WSPI 0x0002
# define COM_6800 0x0004
# define COM_8080 0x0008
# define COM_SSDI2C 0x0010
2016-02-28 02:23:57 +08:00
# define COM_ST7920SPI 0x0020 /* mostly identical to COM_4WSPI, but does not use DC */
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 ;
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 [ ] =
{
{
2016-02-29 05:32:14 +08:00
" ssd1306 " , 16 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_3WSPI | COM_6800 | COM_8080 | COM_8080 ,
{
{ " 128x64_noname " } ,
{ NULL }
}
} ,
{
2016-03-01 01:04:34 +08:00
" ssd1306 " , 16 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_ssd13xx_i2c " , " i2c " , COM_SSDI2C ,
2015-12-21 02:31:07 +08:00
{
{ " 128x64_noname " } ,
{ 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 ,
{
{ " 128x64_noname " } ,
{ NULL }
}
} ,
{
" sh1106 " , 16 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_ssd13xx_i2c " , " i2c " , COM_SSDI2C ,
{
{ " 128x64_noname " } ,
{ NULL }
}
} ,
{
" ssd1306 " , 16 , 4 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_3WSPI | COM_6800 | COM_8080 | COM_8080 ,
{
{ " 128x32_univision " } ,
{ NULL }
}
} ,
{
" ssd1306 " , 16 , 4 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_ssd13xx_i2c " , " i2c " , COM_SSDI2C ,
{
{ " 128x32_univision " } ,
{ NULL }
}
2016-05-26 16:33:09 +08:00
} ,
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-01-04 07:31:49 +08:00
{
{ " 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 ,
{
{ " 192x32 " } ,
{ NULL }
}
} ,
{
" st7920 " , 16 , 8 , " u8g2_ll_hvline_horizontal_right_lsb " , " u8x8_cad_001 " , " p " , COM_8080 ,
{
{ " 128x64 " } ,
{ NULL }
}
} ,
{
" st7920 " , 16 , 8 , " u8g2_ll_hvline_horizontal_right_lsb " , " u8x8_cad_st7920_spi " , " s " , COM_ST7920SPI ,
{
{ " 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-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 ,
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
} ,
{
" st7565 " , 16 , 8 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_3WSPI | COM_6800 | COM_8080 ,
{
2016-05-26 16:33:09 +08:00
{ " ea_dogm128 " } ,
{ NULL }
} ,
} ,
{
" st7565 " , 16 , 4 , " u8g2_ll_hvline_vertical_top_lsb " , " u8x8_cad_001 " , " " , COM_4WSPI | COM_3WSPI | COM_6800 | COM_8080 ,
{
{ " nhd_c12832 " } ,
2016-05-26 14:31:29 +08:00
{ NULL }
}
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 " ,
" u8x8_byte_8bit_8080mode " ,
" 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 " ,
" u8x8_SetPin_SSD13xx_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-05-15 06:05:41 +08:00
" u8x8_SetPin_SSD13xx_HW_I2C " ,
" u8x8_byte_arduino_hw_i2c " ,
" u8x8_gpio_and_delay_arduino " ,
2015-12-23 17:44:20 +08:00
" uint8_t reset = U8X8_PIN_NONE " ,
2015-12-24 03:54:16 +08:00
" reset " ,
" [reset] " ,
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 */
" u8x8_byte_4wire_sw_spi " , /* "u8x8_byte_st7920_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-02-27 04:58:40 +08:00
" " ,
" " ,
" " ,
" uint8_t cs, uint8_t reset = U8X8_PIN_NONE " ,
" cs, reset " ,
" cs [, reset] " ,
" uC specific "
} ,
2015-12-23 17:44:20 +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 ) ) ;
fprintf ( fp , " %s_ " , struppercase ( controller_list [ controller_idx ] . display_list [ display_idx ] . name ) ) ;
fprintf ( fp , " %s " , struppercase ( interface_list [ interface_idx ] . interface_name ) ) ;
fprintf ( fp , " : public U8X8 { \n " ) ;
fprintf ( fp , " public: " ) ;
fprintf ( fp , " U8X8_ " ) ;
fprintf ( fp , " %s_ " , struppercase ( controller_list [ controller_idx ] . name ) ) ;
fprintf ( fp , " %s_ " , struppercase ( controller_list [ controller_idx ] . display_list [ display_idx ] . name ) ) ;
fprintf ( fp , " %s " , struppercase ( interface_list [ interface_idx ] . interface_name ) ) ;
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 ) ) ;
fprintf ( fp , " %s_ " , struppercase ( postfix ) ) ;
fprintf ( fp , " %s " , struppercase ( interface_list [ interface_idx ] . interface_name ) ) ;
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 ) ) ;
fprintf ( fp , " %s_ " , struppercase ( postfix ) ) ;
fprintf ( fp , " %s " , struppercase ( interface_list [ interface_idx ] . interface_name ) ) ;
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
}
if ( controller_list [ controller_idx ] . com & COM_SSDI2C )
{
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 */
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-02-27 04:58:40 +08:00
//do_display_interface(controller_idx, display_idx, postfix, 9); /* HW SPI (not yet implemented) */
}
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
*/
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 " ) ;
if ( is_u8g2 )
{
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
{
fprintf ( fp , " | Controller \" %s \" , " , controller_list [ controller_idx ] . name ) ;
fprintf ( fp , " Display \" %s \" | \n " , controller_list [ controller_idx ] . display_list [ display_idx ] . name ) ;
2015-12-25 23:42:45 +08:00
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 ) ) ;
fprintf ( fp , " %s_ " , struppercase ( postfix ) ) ;
fprintf ( fp , " %s " , struppercase ( interface_list [ interface_idx ] . interface_name ) ) ;
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 )
{
if ( is_arduino_cpp )
{
fprintf ( fp , " | U8X8_ " ) ;
fprintf ( fp , " %s_ " , struppercase ( controller_list [ controller_idx ] . name ) ) ;
fprintf ( fp , " %s_ " , struppercase ( controller_list [ controller_idx ] . display_list [ display_idx ] . name ) ) ;
fprintf ( fp , " %s " , struppercase ( interface_list [ interface_idx ] . interface_name ) ) ;
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 ) ) ;
2016-02-10 05:50:57 +08:00
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 */
}
if ( controller_list [ controller_idx ] . com & COM_SSDI2C )
{
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 */
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 */
//do_md_display_interface(controller_idx, display_idx, 9); /* HW SPI (not yet implemented) */
}
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 ;
}