File tree Expand file tree Collapse file tree
Lib/FancyLayers-RENAME/NeoPixel Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323#include "dma.h"
2424#include "fdcan.h"
2525#include "gpio.h"
26+ #include "gr_neopixel.h"
2627#include "i2c.h"
2728#include "spi.h"
2829#include "tim.h"
2930#include "usart.h"
3031
31- #include "gr_neopixel.h"
32-
3332/* Private includes ----------------------------------------------------------*/
3433/* USER CODE BEGIN Includes */
3534
@@ -121,8 +120,8 @@ int main(void)
121120 HAL_Delay (1000 );
122121
123122 /* USER CODE BEGIN 3 */
124- Neopixel_update ();
125- }
123+ Neopixel_update ();
124+ }
126125}
127126
128127/**
Original file line number Diff line number Diff line change 66#include <stdint.h>
77
88typedef enum {
9- COLOR_GREEN = (uint32_t )0xFF0000 ,
10- COLOR_RED = (uint32_t )0x03FC00 ,
11- COLOR_BLUE = (uint32_t )0x0000FF ,
9+ COLOR_GREEN = (uint32_t )0xFF0000 ,
10+ COLOR_RED = (uint32_t )0x03FC00 ,
11+ COLOR_BLUE = (uint32_t )0x0000FF ,
1212} Color ;
1313
1414typedef union {
15- struct {
16- Color TS_Active ;
17- Color RTD ;
18- };
15+ struct {
16+ Color TS_Active ;
17+ Color RTD ;
18+ };
1919
20- uint32_t rawData [2 ];
20+ uint32_t rawData [2 ];
2121} NeoPixelData ;
2222
2323void Neopixel_update ();
Original file line number Diff line number Diff line change 11#include "gr_neopixel.h"
2- #include "main.h"
3- #include "spi.h"
2+
43#include <stdbool.h>
54#include <stdint.h>
65
7- void Neopixel_update () {
6+ #include "main.h"
7+ #include "spi.h"
8+
9+ void Neopixel_update ()
10+ {
811
9- NeoPixelData globalNeoPixelData = {0 };
12+ NeoPixelData globalNeoPixelData = {0 };
1013
11- // temp color set
12- globalNeoPixelData .RTD = COLOR_BLUE ;
13- globalNeoPixelData .TS_Active = COLOR_BLUE ;
14+ // temp color set
15+ globalNeoPixelData .RTD = COLOR_BLUE ;
16+ globalNeoPixelData .TS_Active = COLOR_BLUE ;
1417
15- uint8_t neopixelTransmission [48 ];
16- for (int i = 0 ; i < 2 ; i ++ ) {
17- for (int j = 23 ; j >= 0 ; j -- ) {
18- neopixelTransmission [i * 24 + 23 - j ] = 0x4 + ((globalNeoPixelData .rawData [i ] >> j ) & 0x1 << 1 ); // 0x06 is high, 0x04 is low
19- }
20- }
18+ uint8_t neopixelTransmission [48 ];
19+ for (int i = 0 ; i < 2 ; i ++ ) {
20+ for (int j = 23 ; j >= 0 ; j -- ) {
21+ neopixelTransmission [i * 24 + 23 - j ] = 0x4 + ((globalNeoPixelData .rawData [i ] >> j ) & 0x1 << 1 ); // 0x06 is high, 0x04 is low
22+ }
23+ }
2124
22- // might need to iterate through array and send each bit individually
23- LL_SPI_TransmitData8 (SPI1 , neopixelTransmission );
25+ // might need to iterate through array and send each bit individually
26+ LL_SPI_TransmitData8 (SPI1 , neopixelTransmission );
2427}
You can’t perform that action at this time.
0 commit comments