DIY Auto-Correlator 1.0
Auto-Correlator Card implementation using Teensy 4.x microcontrollers.
utilities.hpp
Go to the documentation of this file.
1#pragma once
2#include <imxrt.h>
3
4
5
6#define PRREG(x) Serial.print(#x" 0x"); Serial.println(x,HEX)
7
8
9
10
14 void xbar_connect(unsigned int input, unsigned int output)
15 {
16 if (input >= 88) return;
17 if (output >= 132) return;
18 volatile uint16_t *xbar = &XBARA1_SEL0 + (output / 2);
19 uint16_t val = *xbar;
20 if (!(output & 1)) {
21 val = (val & 0xFF00) | input;
22 } else {
23 val = (val & 0x00FF) | (input << 8);
24 }
25 *xbar = val;
26 }
27
28
29//#define F_CPU_TICK ARM_DWT_CYCCNT
30uint32_t F_CPU_tick_count() //__attribute__((always_inline))
31{
32 return ARM_DWT_CYCCNT;
33}
34
35
36float get_CPU_temp() //__attribute__((always_inline))
37{
38 return tempmonGetTemp();
39}
40
41
42
44// bool has_DMA_error()
45// {
46// return DMAx_ES != 0; //x is the channel number.
47// }
float get_CPU_temp()
Definition: utilities.hpp:36
uint32_t F_CPU_tick_count()
Definition: utilities.hpp:30
void xbar_connect(unsigned int input, unsigned int output)
Establishes connection over XBAR1-A, given the input and output xbar pins \reference - https://github...
Definition: utilities.hpp:14