Commit 725a727a authored by CLICdp user's avatar CLICdp user
Browse files

CLICpix2: fix last casts for latches

parent 142a4b29
Pipeline #585916 passed with stages
in 4 minutes and 43 seconds
......@@ -21,7 +21,7 @@ namespace caribou {
// set a dedicated bit of the latch
void setLatches(bool bit, uint8_t idx) {
if(bit) {
m_latches |= static_cast<uint16_t>(1 << idx);
m_latches = static_cast<uint16_t>(m_latches | (1 << idx));
} else {
m_latches &= static_cast<uint16_t>(~(1 << idx));
}
......@@ -86,7 +86,7 @@ namespace caribou {
/* Individual threshold adjustment (4bit)
*/
void SetThreshold(uint8_t thr_adjust) {
m_latches = static_cast<uint16_t>(m_latches & 0xf0ff) | static_cast<uint16_t>((thr_adjust & 0x0f) << 8);
m_latches = static_cast<uint16_t>((m_latches & 0xf0ff) | static_cast<uint16_t>((thr_adjust & 0x0f) << 8));
}
uint8_t GetThreshold() const { return (m_latches >> 8) & 0x0f; }
......@@ -155,9 +155,7 @@ namespace caribou {
bool GetFlag() const { return (m_latches >> 13) & 0x1; }
// TOT setting of the pixel (5bit)
void SetTOT(uint8_t tot) {
m_latches = static_cast<uint16_t>(m_latches & 0xe0ff) | static_cast<uint16_t>((tot & 0x1f) << 8);
}
void SetTOT(uint8_t tot) { m_latches = static_cast<uint16_t>((m_latches & 0xe0ff) | (tot & 0x1f) << 8); }
uint8_t GetTOT() const {
if(longflag)
throw DataException("LongCnt set, no TOT available.");
......@@ -167,12 +165,12 @@ namespace caribou {
// TOA setting of the pixel (13bit)
void SetTOA(uint16_t toa) {
m_latches = static_cast<uint16_t>(m_latches & 0xe000) | static_cast<uint16_t>(toa & 0x1fff);
m_latches = static_cast<uint16_t>((m_latches & 0xe000) | (toa & 0x1fff));
longflag = true;
}
// TOA setting of the pixel (8bit)
void SetTOA(uint8_t toa) {
m_latches = static_cast<uint16_t>(m_latches & 0xff00) | static_cast<uint16_t>(toa & 0x00ff);
m_latches = static_cast<uint16_t>((m_latches & 0xff00) | (toa & 0x00ff));
longflag = false;
}
uint16_t GetTOA() const {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment