4 #include <ReadWriteBits.h>
6 #include "S13131_faked.h"
28 #define MAX_NUM_PIXELS 512
31 inline uint8_t
MSB(uint16_t msb_lsb)
38 inline uint8_t
LSB(uint16_t msb_lsb)
43 return msb_lsb & 0xFF;
46 typedef uint8_t
volatile *
const s13131_ptr;
47 typedef uint8_t
const s13131_pin;
48 typedef uint8_t
const s13131_bit;
54 extern s13131_ptr S13131_ddr;
55 extern s13131_ptr S13131_port;
56 extern s13131_ptr S13131_pin;
57 extern s13131_ptr S13131_TCCR0A;
58 extern s13131_ptr S13131_TCCR0B;
59 extern s13131_ptr S13131_TIFR0;
60 extern s13131_ptr S13131_OCR0A;
61 extern s13131_ptr S13131_OCR0B;
64 extern s13131_pin S13131_Clk;
65 extern s13131_pin S13131_St;
66 extern s13131_pin S13131_Eos;
69 extern s13131_bit S13131_WGM00;
70 extern s13131_bit S13131_WGM01;
71 extern s13131_bit S13131_WGM02;
72 extern s13131_bit S13131_CS00;
73 extern s13131_bit S13131_CS01;
74 extern s13131_bit S13131_CS02;
75 extern s13131_bit S13131_COM0B0;
76 extern s13131_bit S13131_COM0B1;
77 extern s13131_bit S13131_OCF0A;
78 extern s13131_bit S13131_OCF0B;
81 inline void S13131PinSetup(
void)
84 SetBit(S13131_ddr, S13131_Clk);
86 ClearBit(S13131_port, S13131_Clk);
89 SetBit(S13131_ddr, S13131_St);
91 ClearBit(S13131_port, S13131_St);
94 ClearBit(S13131_ddr, S13131_Eos);
96 ClearBit(S13131_port, S13131_Eos);
99 inline void S13131StartClocking(
void)
105 SetBit(S13131_TCCR0A, S13131_WGM00);
110 SetBit(S13131_TCCR0A, S13131_WGM01);
116 SetBit(S13131_TCCR0B, S13131_WGM02);
122 SetBit(S13131_TCCR0B, S13131_CS00);
127 ClearBit(S13131_TCCR0B, S13131_CS01);
132 ClearBit(S13131_TCCR0B, S13131_CS02);
153 ClearBit(S13131_TCCR0A, S13131_COM0B0);
157 SetBit(S13131_TCCR0A, S13131_COM0B1);
163 inline void WaitForS13131ClkLow(
void)
167 SetBit(S13131_TIFR0, S13131_OCF0B);
171 while(BitIsClear(S13131_TIFR0, S13131_OCF0B));
177 inline void WaitForS13131ClkHigh(
void)
181 SetBit(S13131_TIFR0, S13131_OCF0A);
185 while(BitIsClear(S13131_TIFR0, S13131_OCF0A));
292 WaitForS13131ClkLow();
293 SetBit(S13131_port, S13131_St);
298 WaitForS13131ClkHigh();
315 WaitForS13131ClkLow();
316 ClearBit(S13131_port, S13131_St);
320 WaitForS13131ClkHigh();
324 for(uint16_t f_count = 0; f_count < (14-1); f_count++)
327 WaitForS13131ClkLow();
uint8_t MSB(uint16_t msb_lsb)
uint16_t exposure_ticks
S13131 exposure time.
uint8_t LSB(uint16_t msb_lsb)