Skip to content

Commit 5286c27

Browse files
Restrict HyperX DRAM to 4 slots
1 parent 9345682 commit 5286c27

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

Controllers/HyperXDRAMController/HyperXDRAMController.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ HyperXDRAMController::HyperXDRAMController(i2c_smbus_interface* bus, hyperx_dev_
2020

2121
led_count = 0;
2222

23-
for(int i = 0; i < 8; i++)
23+
for(unsigned int slot = 0; slot < 4; slot++)
2424
{
25-
if((slots_valid & (1 << i)) != 0)
25+
if(((slots_valid & ( 0x01 << slot)) != 0)
26+
||((slots_valid & ( 0x10 << slot)) != 0))
2627
{
2728
led_count += 5;
2829
}
@@ -62,7 +63,8 @@ unsigned int HyperXDRAMController::GetSlotCount()
6263

6364
for(int slot = 0; slot < 4; slot++)
6465
{
65-
if((slots_valid & (1 << slot)) != 0)
66+
if(((slots_valid & ( 0x01 << slot)) != 0)
67+
||((slots_valid & ( 0x10 << slot)) != 0))
6668
{
6769
slot_count++;
6870
}
@@ -107,7 +109,8 @@ void HyperXDRAMController::SetAllColors(unsigned char red, unsigned char green,
107109
{
108110
unsigned char slot = slot_map[slot_idx];
109111

110-
if((slots_valid & (1 << slot)) != 0)
112+
if(((slots_valid & ( 0x01 << slot)) != 0)
113+
||((slots_valid & ( 0x10 << slot)) != 0))
111114
{
112115
unsigned char base = slot_base[slot];
113116
unsigned char red_base = base + 0x00;
@@ -156,7 +159,8 @@ void HyperXDRAMController::SetLEDColor(unsigned int led, unsigned char red, unsi
156159
{
157160
slot = slot_map[slot_idx];
158161

159-
if((slots_valid & ( 1 << slot)) != 0)
162+
if(((slots_valid & ( 0x01 << slot)) != 0)
163+
||((slots_valid & ( 0x10 << slot)) != 0))
160164
{
161165
slot_id++;
162166
}

0 commit comments

Comments
 (0)