Choco OS  V.0.16.9.0
Join to the chocolate world
oc_led.h
Go to the documentation of this file.
1 
28 #ifndef SYSTEM_CORE_INC_DRIVERS_LED_OC_LED_H_
29 #define SYSTEM_CORE_INC_DRIVERS_LED_OC_LED_H_
30 
31 #define DRIVER_HEADER
32 #define DRIVER_NAME LED
33 
34 #include <oc_driver.h>
35 #include <oc_gpio.h>
36 #include <oc_color.h>
37 
43 #define _________________________________________TYPES_SECTION______________________________________________________________________________
44 
45 typedef enum
46 {
47  oC_LED_Index_Red = 0 ,
48  oC_LED_Index_Single = 0 ,
49  oC_LED_Index_Green = 1 ,
50  oC_LED_Index_Blue = 2 ,
51  oC_LED_Index_NumberOfElements
52 } oC_LED_Index_t;
53 
54 typedef enum
55 {
56  oC_LED_Mode_Red = (1<<oC_LED_Index_Red),
57  oC_LED_Mode_Green = (1<<oC_LED_Index_Green),
58  oC_LED_Mode_Blue = (1<<oC_LED_Index_Blue),
59  oC_LED_Mode_UsePWM = (1<<3),
60  oC_LED_Mode_RedActiveLow = (1<<4),
61  oC_LED_Mode_GreenActiveLow = (1<<5),
62  oC_LED_Mode_BlueActiveLow = (1<<6),
63  oC_LED_Mode_Single = oC_LED_Mode_Red,
64  oC_LED_Mode_SingleActiveLow = oC_LED_Mode_RedActiveLow,
65  oC_LED_Mode_RGB = oC_LED_Mode_Red | oC_LED_Mode_Green | oC_LED_Mode_Blue ,
66  oC_LED_Mode_RG = oC_LED_Mode_Red | oC_LED_Mode_Green ,
67  oC_LED_Mode_RB = oC_LED_Mode_Red | oC_LED_Mode_Blue ,
68  oC_LED_Mode_BG = oC_LED_Mode_Blue | oC_LED_Mode_Green ,
69 } oC_LED_Mode_t;
70 
71 //==========================================================================================================================================
80 //==========================================================================================================================================
81 typedef struct
82 {
83  oC_Pins_t Pins[oC_LED_Index_NumberOfElements];
84  oC_LED_Mode_t Mode;
86 
87 //==========================================================================================================================================
96 //==========================================================================================================================================
97 typedef struct Context_t * oC_LED_Context_t;
98 
99 #undef _________________________________________TYPES_SECTION______________________________________________________________________________
100 
106 #define _________________________________________PROTOTYPES_SECTION_________________________________________________________________________
107 
108 extern oC_ErrorCode_t oC_LED_Configure ( const oC_LED_Config_t * Config , oC_LED_Context_t * outContext );
109 extern oC_ErrorCode_t oC_LED_Unconfigure ( const oC_LED_Config_t * Config , oC_LED_Context_t * outContext );
110 extern oC_ErrorCode_t oC_LED_Write ( oC_LED_Context_t Context , const char * Buffer , uint32_t * Size , oC_Time_t Timeout );
111 extern oC_ErrorCode_t oC_LED_Ioctl ( oC_LED_Context_t Context , oC_Ioctl_Command_t Command , void * Data );
112 extern oC_ErrorCode_t oC_LED_SetColor ( oC_LED_Context_t Context , oC_Color_t Color );
113 extern oC_ErrorCode_t oC_LED_SetLight ( oC_LED_Context_t Context , oC_LED_Index_t LedIndex , uint8_t Light );
114 
115 #undef _________________________________________PROTOTYPES_SECTION_________________________________________________________________________
116 
117 
118 #endif /* SYSTEM_CORE_INC_DRIVERS_LED_OC_LED_H_ */
oC_ErrorCode_t oC_LED_Configure(const oC_LED_Config_t *Config, oC_LED_Context_t *outContext)
configures LED pins to work
Definition: oc_led.c:126
The file with interface for the GPIO driver.
oC_ErrorCode_t oC_LED_Unconfigure(const oC_LED_Config_t *Config, oC_LED_Context_t *outContext)
Restores default state on pins.
Definition: oc_led.c:172
The file with interface for the color library.
The file with interface for driver creating.
struct Context_t * oC_LED_Context_t
The LED context structure.
Definition: oc_led.h:97
LED driver configuration structure.
Definition: oc_led.h:81
stores ETH context
Definition: oc_eth.c:97