OLE Developer Guide  Latest Git
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
spi_rgb.h
Go to the documentation of this file.
1 /*
2  * This library is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU Lesser General Public
4  * License as published by the Free Software Foundation; either
5  * version 2.1 of the License, or (at your option) any later version.
6  *
7  * This library is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10  * Lesser General Public License for more details.
11  *
12  * You should have received a copy of the GNU Lesser General Public
13  * License along with this library; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15  *
16  * spi_rgb.h
17  * Copyright (C) 2015 Simon Newton
18  */
19 
34 #ifndef FIRMWARE_SRC_SPI_RGB_H_
35 #define FIRMWARE_SRC_SPI_RGB_H_
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 #include "system_config.h"
42 #include "peripheral/spi/plib_spi.h"
43 
47 typedef enum {
48  RED = 0,
49  GREEN = 1,
50  BLUE = 2
51 } RGB_Color;
52 
56 typedef struct {
58  uint32_t baud_rate;
59 
68 
73 void SPIRGB_Init(const SPIRGBConfiguration *config);
74 
80 void SPIRGB_BeginUpdate();
81 
88 void SPIRGB_SetPixel(uint16_t index, RGB_Color color, uint8_t value);
89 
97 
103 void SPIRGB_Tasks();
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
113 #endif // FIRMWARE_SRC_SPI_RGB_H_
void SPIRGB_Tasks()
Perform the periodic SPI RGB tasks.
#define SPI_MODULE_ID
The SPI module to use for output.
Definition: app_settings.h:162
void SPIRGB_Init(const SPIRGBConfiguration *config)
Initialize the SPI RGB module.
uint32_t baud_rate
The Baud rate.
Definition: spi_rgb.h:58
void SPIRGB_SetPixel(uint16_t index, RGB_Color color, uint8_t value)
Set the value of a pixel.
SPI RGB Module configuration.
Definition: spi_rgb.h:56
RGB_Color
RGB color values.
Definition: spi_rgb.h:47
SPI_MODULE_ID module_id
The SPI module to use.
Definition: spi_rgb.h:57
void SPIRGB_CompleteUpdate()
Complete a frame update.
void SPIRGB_BeginUpdate()
Begin a frame update.
bool use_enhanced_buffering
Use enhanced buffer mode, not all chips support this.
Definition: spi_rgb.h:66