IceCube display
LED display to show IceCube event data
frame_timer.h
Go to the documentation of this file.
1 #ifndef FRAME_TIMER_H
2 #define FRAME_TIMER_H
3 
31 #include <stdint.h>
32 #include <stdbool.h>
33 
45 #define MS_PER_FRAME (1000/DEVICE_FPS)
47 
50 
52 void new_sof_received(const uint16_t usb_frame_counter);
53 
67 };
68 
74 
78 bool correct_display_frame_counter(const int16_t frame_diff);
79 
86 void correct_display_frame_phase(const int8_t ms_shift);
87 
89 
90 
93 
95 void init_frame_timer();
96 
98 bool should_draw_frame();
99 
101 void clear_draw_frame();
102 
105 
106 #endif //FRAME_TIMER_H
bool should_draw_frame()
Whether a new frame should be displayed or if the device is allowed to idle.
void correct_display_frame_phase(const int8_t ms_shift)
Shift the frame display phase with respect to the USB frame counter.
uint16_t display_frame_counter
Counter that is incremented once per frame draw, i.e. nominally every 40ms.
Definition: frame_timer.h:63
void clear_draw_frame()
Acknowledge that a frame has been drawn.
bool correct_display_frame_counter(const int16_t frame_diff)
Correct the display frame counter.
void new_sof_received(const uint16_t usb_frame_counter)
Function to be called upon receival of a USB SOF token with the new USB frame counter value...
void init_frame_timer()
Initialise the frame timer.
bool get_display_frame_usb_phase(struct display_frame_usb_phase_t *usb_phase)
Latest display frame counter phase.
Display frame counter and USB frame counter values at frame draw time.
Definition: frame_timer.h:61
uint16_t usb_frame_counter
Value of the USB frame counter when the frame is drawn, providing a common ms time base for all USB d...
Definition: frame_timer.h:66