The title statement is from the Atmel PDCA_Example1. In all the Atmel examples, the entire example is mostly a single file. I, like most programmers , would prefer to have my program in multiple files. So I have been working to break PDCA_Example1 into multiple files. In the PDCA_Example1, there are two ascii files - ascii_anim1.h and ascii_anim2.h These files are referenced in the main file, outside of any function by:
const char ascii_anim1[] = # include "ascii_anim1.h" ; const char ascii_anim2[] = # include "ascii_anim2.h" ;
Here is a snippet of one of the ascii files
" \r\n" /* * Support and FAQ: visit <a href="https://www.microchip.com/support/">Microchip Support</a> */ " / \r\n" " / \r\n" " <<O O \r\n" " | UC3/|> \r\n" " /| | \r\n" " / | | \r\n" "AVR ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\x0C" " \r\n"
In the program, as part of the PDCA interrupt, the following statements is made:
if (animation_high_section) { pdca_reload_channel(PDCA_CHANNEL_USART_EXAMPLE, (void *)ascii_anim2, sizeof(ascii_anim2)); } else { pdca_reload_channel(PDCA_CHANNEL_USART_EXAMPLE, (void *)ascii_anim1, sizeof(ascii_anim1)); }
This is where I am having problems. I have renamed ascii_anim1.h as ascii_anim1.c and added
const char ascii_anim1[] = {
in front of the ascii file and }; at the end of the ascii file. In addition I added
extern const char ascii_anim1[];
in an h file that is included in every c file.
When I compile the program the
(void *)ascii_anim1, sizeof(ascii_anim1));
gives an error of
" invalid application of 'sizeof' to incomplete type 'const unsigned char[]' "
So my question is how do I setup the ascii_anim1 file so the program will compile correctly?