X hits on this document

PDF document

A Prototype Optical Tracking System Investigation and Development - page 65 / 170

440 views

0 shares

0 downloads

0 comments

65 / 170

4.4 Class Design

51

ROI

Strip 1 Strip 2 Strip 3

ROI

Strip 19 Strip 20

Figure 4.13 The Black Spot double buffering scheme involves copying image frame in parts to two buffers using a Direct Memory Access (DMA) peripheral. One buffer is accessed by the DMA while the other is accessed by the firmware.

ROI

Buffer 1 Buffer 2

Image Sensor Frame

Image strips copied by DMA controller

4.4.2

Notes on coding conventions

The firmware is written to incorporate OO principles whenever possible.

coding con-

vention was developed to imitate classes in OO languages. Structures are used to represent classes and function pointers used to represent class methods. Object references are point-

ers to these structures.

The implementation is event driven. Events are implemented using function pointers. While this is not a true event, as only one consumer can subscribe to the event, it is suffi- cient for this implementation.

In the implementation of the firmware there is not any dynamic memory allocation. This was an implementation decision to improve the robustness of the code. voiding using dynamic memory allows the memory requirements of the firmware to be almost entirely determined at compile time. This avoids the situation of algorithms failing due to memory

allocations failing.

There is one case where memory is still dynamically allocated and this is for the stack. When a function is called a stack frame is created that holds the previous DSP state be- fore the function call. If too many nested functions are called this could result in a stack overflow. There are not any recursive function calls so this should not be an issue.

Document info
Document views440
Page views440
Page last viewedSat Dec 10 17:35:18 UTC 2016
Pages170
Paragraphs6307
Words54996

Comments