8.2.1. How to Implement a New Measurement IC Driver¶
This section gives a guideline how add a new measurement IC to the project.
8.2.1.1. The Example¶
The measurement IC is from the manufacturer called Super BMS ICs (SB-IC) and the the IC is named Vulpes G 2000 (VG2000) from the IC family VG.
8.2.1.2. Basic Directory Structure¶
- Adapt - conf/bms/schema/bms.schema.jsonto recognize the new manufacturer and the IC.
- Add the SB-IC manufacturer directory - sb-ic:- src/app/driver/mic/sb-ic.
- Add the API directory - apifor SB-IC manufacturer:- src/app/driver/mic/sb-ic/api.
- Add the IC - vg2directory:- src/app/driver/mic/sb-ic/vg2000.
- Add the - apidirectory:- src/app/driver/mic/sb-ic/vg2000/api.
- Add the - configdirectory:- src/app/driver/mic/sb-ic/vg2000/config.
- If there is special code code from the IC vendor for that IC: Add the - vendordirectory- src/app/driver/mic/sb-ic/vg2000/vendor. The vendor code should be placed here verbatim without any changes to the source code or to the source code organization.
- If there is shared code between all ICs or family of ICs from that manufacturer, add the - commondirectory:- src/app/driver/mic/sb-ic/common.
- If there is common shared code from the IC vendor: Add the - vendordirectory- src/app/driver/mic/sb-ic/common/vendor. The vendor code should be placed here verbatim without any changes to the source code or to the source code organization.
- If there needs to be common shared code developed for the family: Add the - vgdirectory- src/app/driver/mic/sb-ic/common/vg.
After that the directories are setup correctly.
Example: If there is
- common code from the vendor, 
- common code for the family from the vendor, 
- special code for the IC from the vendor, 
- common code developed, 
- common code for the family developed and 
- special code for the IC developed 
then the directory structure is as follows:
src
└── app
    └── src
        └── driver
            └── mic
                └── sb-ic
                    ├── api
                    ├── common
                    │   ├── vendor  # vendor: common shared vendor code without modification
                    │   ├── vg      # developed: family common shared code
                    │   └── .       # developed: manufacturer common shared code
                    └── vg2000
                        ├── api     # api files go here
                        ├── config  # configuration files go here
                        ├── vendor  # vendor: special code for the IC vendor goes here
                        └── .       # developed: driver code developed
8.2.1.3. Required Files¶
The files listed here are the required minimum to keep the different manufacturer driver consistent.
8.2.1.3.1. Driver¶
- sb-ic_vg2000.c
- sb-ic_vg2000.h
- sb-ic_vg2000.json
- wscript
- Additional files MAY be added as needed. 
8.2.1.3.2. API Files¶
- api/sb-ic_vg2000_mic.h
- api/sb-ic_vg2000_mic.c
- api/sb-ic_vg2000_mic_dma.c
- api/sb-ic_vg2000_mic_dma.h
- There SHOULD be no additional files. 
8.2.1.3.3. Configuration Files¶
- sb-ic_vg2000_cfg.c
- sb-ic_vg2000_cfg.h
- sb-ic_vg2000_mic_dma_cfg.c
- sb-ic_vg2000_mic_dma_cfg.h
- There SHOULD be no additional files. 
The file structure should look like this (for the sake of simplicity no common shared code and no vendor code):
src
└── app
    └── src
        └── driver
            └── mic
                └── sb-ic
                    └── vg2000
                        ├── api
                        │   ├──sb-ic_vg2000_mic.h
                        │   ├──sb-ic_vg2000_mic.c
                        │   ├──sb-ic_vg2000_mic_dma.c
                        │   └──sb-ic_vg2000_mic_dma.h
                        ├── config
                        │   ├──sb-ic_vg2000_cfg.c
                        │   ├──sb-ic_vg2000_cfg.h
                        │   ├──sb-ic_vg2000_mic_dma_cfg.c
                        │   └──sb-ic_vg2000_mic_dma_cfg.h
                        ├── sb-ic_vg2000.c
                        ├── sb-ic_vg2000.h
                        ├── sb-ic_vg2000.json
                        └── wscript
