-
eye2See - Preprocessor Magic
08/07/2023 at 18:22 • 0 commentseye2see - C/C++ Preprocessor Magic
The C/C++ preprocessor is a very powerful tool, and a couple of its features are used by eye2see to perform "magic" - namely obtaining key debugging information at run-time: file name, line number, variable size, value and memory location.
These are preprocessor features used (the last 2 are actually native C/C++ features):
__FILE__ //makes file name available to C/C++ macros __LINE__ //makes file line number available #varName //makes variable name available as a string sizeof(varName) //makes byte size of variable available &varName //makes memory location of variable available
By coding the eye2see user functions as macros, and using these features, we can access runtime values and pass them over I2C to the eye2see Probe and then on to the PC GUI via USB for display.
#define e2clog(v,b) E2Clog(__NAME__,#v,b,sizeof(v),v,&v, __LINE__)
Another eye2see macro called __NAME__ takes the file name returned by __FILE__ and strips off the PATH to reduce the display line length.
-
eye2see - the Probe
08/07/2023 at 17:51 • 0 commentseye2see Probe Hardware
The first dedicated eye2see Probe hardware is shown below.
This uses a simple 2 layer PCB (fabricated here by OSHPark, I also use PCBWay and both give excellent service and quality). The PCB forms the bottom of the enclosure. The Seeed Xiao RP2040 is soldered to the PCB, along with the FPC connector for the 132x32 LCD, Qwiic/StemmaQT connector and 3pin 0.1" male header (both connectors carry ground, SDA and SCL for attaching to the target). Captive nuts fit in 4 holes in the corners of the PCB.
The enclosure "chassis" was designed using OpenSCAD and is FDM 3D printed in PLA (on my Monoprice MiniDelta II), holds the LCD securely, and provides clearance for the FPC cable, connectors and components on the PCB.
Finally, the enclosure top is laser cut from 1mm black acrylic, and bolts through the chassis to the captive nuts in the PCB.
This stack makes a rugged, compact and inexpensive enclosure.