hi Everybody, i copy and paste a line of code bellow as an example:
"#define USB (( USB_TypeDef *) USB_BASE)"
( suppose #define USB_BASE 0x0C000 )
i don't understand the "(( USB_TypeDef *) USB_BASE)"? why the *, the pointer operator, is placed with type inside parenthesis?
thanks, Ras
so, what is the difference between
(( USB_TypeDef *) USB_BASE)
and
USB_TypeDef *USB_BASE
?
The first is a type cast - telling the compiler to treat an integer as a pointer to a sepcific data type.
The second is a variable declaration. Telling the compiler to allocate the memory for a single variable USB_BASE that is of type "Pointer to USB_TypeDef".
So as I did write in my previous post - consider taking some steps back and spend some time with a good tutorial. You really do need to understand basic C concepts before you can manage any big wonders in the embedded world.
Another thing - it's easier to learn to program in C on a PC. And there are good and free tools to use - complete IDE with editor, compiler and debugger. Debugging a PC program means the debugger have an almost infinite bandwidth to display variable and memory content while debugging. The same isn't true when trying to debug an embedded chip where all dumped data from the chip needs to be sent out over some serial link of some type. The PC can also manage a basically infinite number of breakpoints when debugging - the microcontrollers can only do a few hardware breakpoints and then requires reprogramming of the flash memory to set more breakpoints.
You don't start driving MC on a 1300cc Hyabusa - you start with a light MC or probably before that a pedal bike. Why jump in at the deep end before you can swim?