Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
632772d4b7 |
@ -12,3 +12,7 @@ Board to run [colorchord2](https://github.com/cnlohr/colorchord) on a string of
|
|||||||
* Workaround: Flip 180 degrees and solder shifted onto the right pads, then use magnet wire to connect the remaining two pads.
|
* Workaround: Flip 180 degrees and solder shifted onto the right pads, then use magnet wire to connect the remaining two pads.
|
||||||
* Serial boot loader non-functional (uses incompatible UART I/Os).
|
* Serial boot loader non-functional (uses incompatible UART I/Os).
|
||||||
* Workaround: Program via JTAG / SWD.
|
* Workaround: Program via JTAG / SWD.
|
||||||
|
* Missing level shifters for WS2812B LEDs (RX)
|
||||||
|
* Workaround: Don't use WS2812B RX inputs on the board
|
||||||
|
* Missing level shifters for WS2812B LEDs (TX)
|
||||||
|
* Workaround: The first LED will kinda sorta do the level shifting for you, but sometimes fail to display correctly. Just ignore its erratic blinking.
|
||||||
|
@ -166,45 +166,6 @@ void ConfigureUART()
|
|||||||
NVIC_Init(&NVIC_InitStruct);*/
|
NVIC_Init(&NVIC_InitStruct);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureDMX()
|
|
||||||
{
|
|
||||||
GPIO_InitTypeDef GPIO_InitStruct;
|
|
||||||
USART_InitTypeDef USART_InitStruct;
|
|
||||||
|
|
||||||
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
|
|
||||||
|
|
||||||
// Set up UART GPIOs
|
|
||||||
GPIO_PinAFConfig(GPIOA, GPIO_PinSource2, GPIO_AF_USART2);
|
|
||||||
GPIO_PinAFConfig(GPIOA, GPIO_PinSource3, GPIO_AF_USART2);
|
|
||||||
|
|
||||||
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_3;
|
|
||||||
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF;
|
|
||||||
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;
|
|
||||||
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP;
|
|
||||||
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_100MHz;
|
|
||||||
GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
||||||
|
|
||||||
// Set up control GPIOs
|
|
||||||
GPIO_StructInit(&GPIO_InitStruct);
|
|
||||||
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1;
|
|
||||||
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;
|
|
||||||
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;
|
|
||||||
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_100MHz;
|
|
||||||
GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
||||||
|
|
||||||
// Set up UART
|
|
||||||
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
|
|
||||||
|
|
||||||
USART_InitStruct.USART_BaudRate = 250000;
|
|
||||||
USART_InitStruct.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
|
|
||||||
USART_InitStruct.USART_Mode = USART_Mode_Tx | USART_Mode_Rx;
|
|
||||||
USART_InitStruct.USART_Parity = USART_Parity_No;
|
|
||||||
USART_InitStruct.USART_StopBits = USART_StopBits_2;
|
|
||||||
USART_InitStruct.USART_WordLength = USART_WordLength_8b;
|
|
||||||
USART_Init(USART2, &USART_InitStruct);
|
|
||||||
USART_Cmd(USART2, ENABLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfigureLED()
|
void ConfigureLED()
|
||||||
{
|
{
|
||||||
ConfigureGPIO(LED_RED, INOUT_OUT);
|
ConfigureGPIO(LED_RED, INOUT_OUT);
|
||||||
|
@ -57,13 +57,7 @@ void ConfigureGPIO( gpio gpio, int parameters );
|
|||||||
#define LED_BLUE (LEDPIN+1)
|
#define LED_BLUE (LEDPIN+1)
|
||||||
#define LED_RED (LEDPIN+2)
|
#define LED_RED (LEDPIN+2)
|
||||||
|
|
||||||
#define DMX_TX_EN GPIOOn(1)
|
|
||||||
#define DMX_TX_DIS GPIOOff(1)
|
|
||||||
#define DMX_RX_EN GPIOOff(0)
|
|
||||||
#define DMX_RX_DIS GPIOOn(0)
|
|
||||||
|
|
||||||
void ConfigureUART();
|
void ConfigureUART();
|
||||||
void ConfigureDMX();
|
|
||||||
void ConfigureLED();
|
void ConfigureLED();
|
||||||
|
|
||||||
void JumpToBootloader(void);
|
void JumpToBootloader(void);
|
||||||
|
@ -111,24 +111,6 @@ void EXTI0_IRQHandler(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void test()
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
char str[] = "AAAATest\r\n";
|
|
||||||
char *buf;
|
|
||||||
|
|
||||||
DMX_TX_EN;
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
buf = str;
|
|
||||||
for (i=strlen(buf); i > 0; --i) {
|
|
||||||
while (!(USART2->SR & USART_SR_TXE));
|
|
||||||
USART2->DR = (uint16_t)(*((char*) buf) & 0x01FF);
|
|
||||||
buf++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
@ -143,7 +125,6 @@ int main(void)
|
|||||||
float fv = RCC_Clocks.HCLK_Frequency / 1000000.0f;
|
float fv = RCC_Clocks.HCLK_Frequency / 1000000.0f;
|
||||||
|
|
||||||
ConfigureUART();
|
ConfigureUART();
|
||||||
ConfigureDMX();
|
|
||||||
InitColorChord();
|
InitColorChord();
|
||||||
Configure_PA0();
|
Configure_PA0();
|
||||||
InitSPI2812();
|
InitSPI2812();
|
||||||
@ -157,7 +138,6 @@ int main(void)
|
|||||||
|
|
||||||
int c = 1;
|
int c = 1;
|
||||||
LED_ON(LED_RED);
|
LED_ON(LED_RED);
|
||||||
test();
|
|
||||||
while (1) {
|
while (1) {
|
||||||
for (int a=0; a < NUM_LIN_LEDS; a++) {
|
for (int a=0; a < NUM_LIN_LEDS; a++) {
|
||||||
ledOut[a*3 + 0] = c/2;
|
ledOut[a*3 + 0] = c/2;
|
||||||
|
Loading…
Reference in New Issue
Block a user