Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
Loading...
Searching...
No Matches
led3_click.h
Go to the documentation of this file.
1
5/*
6 * Copyright (c) 2023, Cascoda Ltd.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of the copyright holder nor the
17 * names of its contributors may be used to endorse or promote products
18 * derived from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
32/*
33 * Example click interface driver
34*/
35
36#ifndef LED3_CLICK_H
37#define LED3_CLICK_H
38
39#include <stdint.h>
40
45#define LED3_ADD_CMD_LEN 2
46
51#define TX_BUF_RED 0
52#define TX_BUF_GREEN 1
53#define TX_BUF_BLUE 2
54
60#define RED_MIN 0x40
61#define RED_MAX 0x5F
62#define GREEN_MIN 0x60
63#define GREEN_MAX 0x7F
64#define BLUE_MIN 0x80
65#define BLUE_MAX 0x9F
66
67#define LED3_CMD_SHUT_DOWN 0x00
68
73#define LED3_COLOUR_RED 0x5F6080
74#define LED3_COLOUR_ORANGE 0x5F6280
75#define LED3_COLOUR_YELLOW 0x5F7480
76#define LED3_COLOUR_GREEN 0x407F80
77#define LED3_COLOUR_BLUE 0x40609F
78#define LED3_COLOUR_WHITE 0x5F7F9F
79#define LED3_COLOUR_PURPLE 0x58609C
80
86#define LED3_TIMER_8ms 0xE1
87#define LED3_TIMER_16ms 0xE2
88#define LED3_TIMER_32ms 0xE4
89#define LED3_TIMER_64ms 0xE8
90#define LED3_TIMER_128ms 0xE0
91
97#define LED3_INTENSITY_1 0x01
98#define LED3_INTENSITY_2 0x02
99#define LED3_INTENSITY_4 0x04
100#define LED3_INTENSITY_8 0x08
101#define LED3_INTENSITY_16 0x10
102#define LED3_INTENSITY_MAX 0x1F
103
109#define LED3_INCREMENT 0xA0
110#define LED3_DECREMENT 0xC0
111#define LED3_CONSTANT 0x20
112
122
123/* new functions */
130uint8_t MIKROSDK_LED3_set_dimming_and_intensity(uint8_t cmd);
131
140uint8_t MIKROSDK_LED3_set_rgb(uint8_t red, uint8_t green, uint8_t blue);
141
148uint8_t MIKROSDK_LED3_set_colour(uint32_t colour);
149
155uint8_t MIKROSDK_LED3_shut_down(void);
156
163uint8_t MIKROSDK_LED3_set_timer(uint8_t time);
164
170uint8_t MIKROSDK_LED3_Initialise(void);
171
172#endif // LED3_CLICK_H
led3_status
Enum (LED3 status).
Definition led3_click.h:118
@ LED3_ST_FAIL
Definition led3_click.h:120
@ LED3_ST_OK
Definition led3_click.h:119
uint8_t MIKROSDK_LED3_Initialise(void)
Function that initialises the I2C configuration of the LED3 click.
Definition led3.c:162
uint8_t MIKROSDK_LED3_set_colour(uint32_t colour)
Function that sets the LED using common colours.
Definition led3.c:126
uint8_t MIKROSDK_LED3_set_dimming_and_intensity(uint8_t cmd)
Function that sets the dimming mode (Increment, Decrement, Constant) and the light intensity.
Definition led3.c:87
uint8_t MIKROSDK_LED3_set_timer(uint8_t time)
Function that sets the time interval for the dimming function.
Definition led3.c:154
uint8_t MIKROSDK_LED3_set_rgb(uint8_t red, uint8_t green, uint8_t blue)
Function that sets the rgb value individually.
Definition led3.c:95
uint8_t MIKROSDK_LED3_shut_down(void)
Function that turns off the LED.
Definition led3.c:146