-
Notifications
You must be signed in to change notification settings - Fork 4
IoTs
- Lasergun control:
This component sits on the servo driver from the RIOT library, the following functions are available:
- int pHAL_init(void) - this needs to be called in the beginning of every session
- void set_h(int angle) and void set_v(int angle) can be used to set specific angles [-90°, 90°]
- void step_{l|r|u|d}(void) - steps one single step defined by the step size (adjustable)
- void stepn_{l|r|u|d}(void) - step n steps, each defined by the step size (adjustable)
- void laser_on(void), void laser_off(void) and void laser_toggle(void) - controll of the laser diode (transistor on GPIO port)
- allign_cntr(void) - will set both y- and x-axis servo to 0°, void allign_{h|v}_cntr(void) will do this for vertical and horizontal axis
Note: there is a dedicated main.c for testing the separate functions manually (pHAL folder), simply flash the demo onto the xPro board, make sure to call the 'init' function before each session.
Note2: upon replacing the servo with a different model, make sure to go over the pwm logic and check the range, as the values may differ!
-
Target control: This component extends the tests/driver_isl9125 application from the RIOT library for interrupts. Use isl29125_init() e.g. isl29125_init(&dev, TEST_ISL29125_I2C, TEST_ISL29125_IRQ_PIN, ISL29125_MODE_R, ISL29125_RANGE_10K, ISL29125_RESOLUTION_16, ISL29125_INTERRUPT_STATUS_RED, ISL29125_INTERRUPT_PERSIST_1, ISL29125_INTERRUPT_CONV_DIS, lower_threshold, higher_threshold) for initializing the isl29125. Using isl29125_init() there are the following options:
- Set I2C Pins
- Set external interrupt pin
- Choose operation mode:
- ISL29125_MODE_R for getting RED value
- ISL29125_MODE_G for getting GREEN value
- ISL29125_MODE_B for getting BLUE value
- ISL29125_MODE_StandBy for getting NO value
- ISL29125_Mode_RGB for getting ALL RGB values
- ISL29125_MODE_RG for getting RED and GREEN values
- ISL29125_MODE_GB for getting GREEN and BLUE values
- Set RGB data sensing range
- ISL29125_RANGE_10K for range 10,000
- ISL29125_RANGE_375 for range 375
- Set ADC resolution
- ISL29125_RESOLUTION_12 for 12 bit
- ISL29125_RESOLUTION_16 for 16 bit
- Set interrupt color
- ISL29125_INTERRUPT_STATUS_None
- ISL29125_INTERRUPT_STATUS_RED
- ISL29125_INTERRUPT_STATUS_GREEN
- ISL29125_INTERRUPT_STATUS_BLUE
- Set interrupt persist
- ISL29125_INTERRUPT_PERSIST_1
- ISL29125_INTERRUPT_PERSIST_2
- ISL29125_INTERRUPT_PERSIST_4
- ISL29125_INTERRUPT_PERSIST_8
- Choose RGB conversion done to interrupt control
- ISL29125_INTERRUPT_CONV_EN for conversion enabled
- ISL29125_INTERRUPT_CONV_EN for conversion disabled
- Set lower interrupt threshold
- Set higher interrupt threshold
Use the Callback function cb() for code to be executed by interrupt.
For further information see isl29125 data sheet.