CHDK camera_info structure - General Help and Assistance on using CHDK stable releases - CHDK Forum supplierdeeply

CHDK camera_info structure

  • 2 Replies
  • 1927 Views
CHDK camera_info structure
« on: 25 / March / 2020, 11:27:17 »
Advertisements
With a little downtime I decided to try to go a bit deeper into how CHDK works.

Structures are normally defined in a header file and subsequently a function
fills-in the fields.

For some reason, camera_info structure is different. It is defined in camera_info.h as a structure of type _cam_info and that is defined immediately proceeding.

No function fills-in the fields, instead camera_info.c effectively does this
and is added to the compilation.

Why is it done this way and how is it made visible to the rest of the code ?

I have been trying to understand the complex arrangement of makefiles, which
ones are applied to folder 'core' ?

Re: CHDK camera_info structure
« Reply #1 on: 25 / March / 2020, 13:08:50 »
Structures are normally defined in a header file and subsequently a function fills-in the fields.
You missed a step.  A structure is just a definition of how data is arranged in a section of memory.  A map if you like.  Something needs to allocate storage space and then the code can save & retrieve information formatted per the structure definition.

Quote
For some reason, camera_info structure is different. It is defined in camera_info.h as a structure of type _cam_info and that is defined immediately proceeding.
That just tells you that the memory starting at location camera_info is organized according to the definition (map) described by _cam_info.  The actual memory is allocated (create) and initialzied in the camera_info.c file 

Code: [Select]
~line 118 :  _cam_info camera_info=
Quote
No function fills-in the fields, instead camera_info.c effectively does this and is added to the compilation.
Look at the function  void camera_info_init()
Ported :   A1200    SD940   G10    Powershot N    G16

Re: CHDK camera_info structure
« Reply #2 on: 26 / March / 2020, 04:03:25 »
That just tells you that the memory starting at location camera_info is organized according to the definition (map) described by _cam_info.

Hadn't realised that.

Thanks.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal