#include <stdint.h>
#include "ReadWriteBits.h"
#include "LisConfig.h"
Go to the source code of this file.
|
typedef uint8_t volatile *const | lis_ptr |
|
typedef uint8_t const | lis_pin |
|
typedef uint8_t const | lis_bit |
|
|
lis_ptr | Lis_ddr1 |
|
lis_ptr | Lis_port1 |
|
lis_ptr | Lis_pin1 |
|
lis_ptr | Lis_ddr2 |
|
lis_ptr | Lis_port2 |
|
lis_ptr | Lis_TCCR0A |
|
lis_ptr | Lis_TCCR0B |
|
lis_ptr | Lis_TIFR0 |
|
lis_ptr | Lis_OCR0A |
|
lis_ptr | Lis_OCR0B |
|
lis_pin | Lis_PixSelect |
|
lis_pin | Lis_Clk |
|
lis_pin | Lis_Rst |
|
lis_pin | Lis_Sync |
|
lis_bit | Lis_WGM00 |
|
lis_bit | Lis_WGM01 |
|
lis_bit | Lis_WGM02 |
|
lis_bit | Lis_CS00 |
|
lis_bit | Lis_CS01 |
|
lis_bit | Lis_CS02 |
|
lis_bit | Lis_COM0B0 |
|
lis_bit | Lis_COM0B1 |
|
lis_bit | Lis_OCF0A |
|
lis_bit | Lis_OCF0B |
|
uint16_t | exposure_ticks |
| LIS-770i exposure time. More...
|
|
API
void LisInit(void);
Definition in file Lis.h.
◆ MAX_NUM_PIXELS
#define MAX_NUM_PIXELS 784 |
LIS-770i maximum number of pixels.
- with binning off there are at most 784 pixels
- this includes the 13 optically dark and one dummy pixel
- with binning on there are at most 392 pixels
Definition at line 400 of file Lis.h.
◆ _ConfigAs28bits()
void _ConfigAs28bits |
( |
uint8_t * |
config | ) |
|
|
inline |
ConfigAs28bits behavior:
- writes config as little endian ie binning is config byte0 bit0
- sets config byte0 bit0 if BINNING ON
- clears config byte0 bit0 if BINNING OFF
- byte0 bit1 clear and bit2 clear if GAIN 1X
- byte0 bit1 clear and bit2 set if GAIN 2X5
- byte0 bit1 set and bit2 clear if GAIN 4X
- byte0 bit1 set and bit2 set if GAIN 5X
- bit3 to bit27 set if ALL ROWS ACTIVE
- b3b8b13b18b23 set if ROW 1 ACTIVE
- b4b9b14b19b24 set if ROW 2 ACTIVE
- b5b10b15b20b25 set if ROW 3 ACTIVE
- b6b11b16b21b26 set if ROW 4 ACTIVE
- b7b12b17b22b27 set if ROW 5 ACTIVE
Definition at line 155 of file Lis.h.
◆ _EnterLisProgrammingMode()
void _EnterLisProgrammingMode |
( |
void |
| ) |
|
|
inline |
EnterLisProgrammingMode behavior:
- waits for LisClk LOW
- asserts LisPixSelect to program Lis
Definition at line 283 of file Lis.h.
◆ _ExitLisProgrammingMode()
void _ExitLisProgrammingMode |
( |
void |
| ) |
|
|
inline |
ExitLisProgrammingMode behavior:
- outputs LOW on pin LisRst
- outputs LOW on pin LisPixSelect
Definition at line 304 of file Lis.h.
◆ _WaitForLisClkHigh()
void _WaitForLisClkHigh |
( |
void |
| ) |
|
|
inline |
WaitForLisClkHigh behavior:
- clears flag PwmTimerMatchesOCF0A
- waits until flag PwmTimerMatchesOCF0A is set
Definition at line 268 of file Lis.h.
◆ _WaitForLisClkLow()
void _WaitForLisClkLow |
( |
void |
| ) |
|
|
inline |
WaitForLisClkLow behavior:
- clears flag PwmTimerMatchesOCF0B
- waits until flag PwmTimerMatchesOCF0B is set
Definition at line 257 of file Lis.h.
◆ _Write28bitLisConfig()
void _Write28bitLisConfig |
( |
uint8_t const * |
config | ) |
|
|
inline |
Write28bitLisConfig behavior:
- writes 28bits starting at byte0 bit0 and ending at byte3 bit3
Definition at line 360 of file Lis.h.
◆ _WriteLisConfigBit()
void _WriteLisConfigBit |
( |
uint8_t const * |
config, |
|
|
uint8_t |
bit_index |
|
) |
| |
|
inline |
WriteLisConfigBit writes one bit of the LIS 28-bit programming sequence.
To write one bit:
- output bit value on pin
Lis_Rst
- clock the LIS
Input parameters:
config
points to one of the four config bytes
bit_index
is the bit to write (bit7:0) from the config
byte
WriteLisConfigBit behavior:
- outputs bit on LisRst
- waits for LisClk HIGH
- waits for LisClk LOW
Definition at line 324 of file Lis.h.
◆ LisClkFreq50kHz()
void LisClkFreq50kHz |
( |
void |
| ) |
|
|
inline |
Pin LisClk outputs a 50kHz square wave.
Definition at line 117 of file Lis.h.
◆ LisClkOn()
Pin LisClk goes HIGH when Counter0 is 0.
Pin LisClk goes LOW when Counter0 matches OCR0B.
Definition at line 137 of file Lis.h.
◆ LisConfigIsValid()
bool LisConfigIsValid |
( |
uint8_t |
binning, |
|
|
uint8_t |
gain, |
|
|
uint8_t |
active_rows |
|
) |
| |
|
inline |
LisConfigIsValid behavior:
- returns false if binning is invalid
- returns false if gain is invalid
- returns false if active rows is invalid
- returns true if config is valid
Definition at line 441 of file Lis.h.
◆ LisExpose()
LisExpose behavior:
- waits for the falling edge of Lis_Clk
- starts exposure by driving Lis_Rst HIGH
- counts falling edges of Lis_Clk until count equals exposure_ticks
- stops exposure by driving Lis_Rst LOW
Definition at line 498 of file Lis.h.
◆ LisInit()
LisInit behavior:
- sets PixSelect as an output
- idles PixSelect low
- sets Rst as an output
- idles Rst low
- sets Sync as an input
- sets Clk as an output
- resets PWM timer at top
- PWM timer top is OCR0A
- PWM timer is clocked by CPU with no prescaling
- sets PWM frequency at 50kHz
- sets PWM duty cycle to 50 percent
- outputs the PWM clock on pin Clk
Definition at line 416 of file Lis.h.
◆ LisWriteConfig()
void LisWriteConfig |
( |
void |
| ) |
|
|
inline |
LisWriteConfig behavior:
- converts config to 28bit sequence
- enters LIS programming mode
- writes 28bits to LIS setup register
- exits LIS programming mode
Definition at line 475 of file Lis.h.
◆ LSB()
uint8_t LSB |
( |
uint16_t |
msb_lsb | ) |
|
|
inline |
LSB behavior:
- returns least significant bit of 16bit input
Definition at line 408 of file Lis.h.
◆ MSB()
uint8_t MSB |
( |
uint16_t |
msb_lsb | ) |
|
|
inline |
MSB behavior:
- returns most significant bit of 16bit input
Definition at line 401 of file Lis.h.
◆ exposure_ticks
LIS-770i exposure time.
- exposure is a 16-bit word
- exposure is in units of clock ticks
- multiply exposure by 20e-6 seconds to get exposure time in seconds
- one clock tick is 20e-6 seconds because the LIS-770i is clocked at 50kHz
Definition at line 32 of file Lis.c.