Increase number of LEDs to 12

Caution: Disables SWD, makes flashing under reset necessary.
This commit is contained in:
fruchti 2019-12-22 19:42:18 +01:00
parent 8891670bb7
commit dc3ce3a777
4 changed files with 21 additions and 7 deletions

View file

@ -1 +1 @@
82
84

View file

@ -5,19 +5,22 @@
| (1 << PIN_LED_B_0) | (1 << PIN_LED_R_1) \
| (1 << PIN_LED_G_1) | (1 << PIN_LED_B_1) \
| (1 << PIN_LED_R_2) | (1 << PIN_LED_G_2) \
| (1 << PIN_LED_B_2))
| (1 << PIN_LED_B_2) | (1 << PIN_LED_R_3) \
| (1 << PIN_LED_G_3) | (1 << PIN_LED_B_3))
#define LED_MODER_MASK ((3 << PIN_LED_R_0 * 2) | (3 << PIN_LED_G_0 * 2) \
| (3 << PIN_LED_B_0 * 2) | (3 << PIN_LED_R_1 * 2) \
| (3 << PIN_LED_G_1 * 2) | (3 << PIN_LED_B_1 * 2) \
| (3 << PIN_LED_R_2 * 2) | (3 << PIN_LED_G_2 * 2) \
| (3 << PIN_LED_B_2 * 2))
| (3 << PIN_LED_B_2 * 2) | (3 << PIN_LED_R_3 * 2) \
| (3 << PIN_LED_G_3 * 2) | (3 << PIN_LED_B_3 * 2))
#define LED_MODER ((1 << PIN_LED_R_0 * 2) | (1 << PIN_LED_G_0 * 2) \
| (1 << PIN_LED_B_0 * 2) | (1 << PIN_LED_R_1 * 2) \
| (1 << PIN_LED_G_1 * 2) | (1 << PIN_LED_B_1 * 2) \
| (1 << PIN_LED_R_2 * 2) | (1 << PIN_LED_G_2 * 2) \
| (1 << PIN_LED_B_2 * 2))
| (1 << PIN_LED_B_2 * 2) | (1 << PIN_LED_R_3 * 2) \
| (1 << PIN_LED_G_3 * 2) | (1 << PIN_LED_B_3 * 2))
uint8_t LED_Data[LED_COUNT] = {0, 63, 200, 255};
@ -29,6 +32,14 @@ static const uint16_t LED_BitLengths[LED_BITS - 4] =
16, 32, 64, 128, 256, 512, 1024, 2048
};
static const int LED_Pins[LED_COUNT] =
{
PIN_LED_R_0, PIN_LED_G_0, PIN_LED_B_0,
PIN_LED_R_1, PIN_LED_G_1, PIN_LED_B_1,
PIN_LED_R_2, PIN_LED_G_2, PIN_LED_B_2,
PIN_LED_R_3, PIN_LED_G_3, PIN_LED_B_3
};
static uint16_t LED_DMABuffer[LED_BITS + 1];
static void LED_RefreshDMABuffer(void)
@ -42,11 +53,11 @@ static void LED_RefreshDMABuffer(void)
{
if(gamma_corrected & (1 << j))
{
LED_DMABuffer[j] &= ~(1 << i);
LED_DMABuffer[j] &= ~(1 << LED_Pins[i]);
}
else
{
LED_DMABuffer[j] |= 1 << i;
LED_DMABuffer[j] |= 1 << LED_Pins[i];
}
}
}

View file

@ -4,7 +4,7 @@
#include "pinning.h"
#define LED_BITS 12
#define LED_COUNT 9
#define LED_COUNT 12
void LED_Init(void);

View file

@ -10,3 +10,6 @@
#define PIN_LED_R_2 6
#define PIN_LED_G_2 7
#define PIN_LED_B_2 9
#define PIN_LED_R_3 10
#define PIN_LED_G_3 13
#define PIN_LED_B_3 14