Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
led3_click.h File Reference

mikrosdk interface More...

#include <stdint.h>
Include dependency graph for led3_click.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LED3_ADD_CMD_LEN   2
 Maximum length[bytes] for I2C led3 slave address + memory address (command). More...
 
#define TX_BUF_RED   0
 Defines for tx_buf array used in set_rgb and set_colour functions. More...
 
#define TX_BUF_GREEN   1
 
#define TX_BUF_BLUE   2
 
#define RED_MIN   0x40
 Minimum and maximum values allowed for each colour. More...
 
#define RED_MAX   0x5F
 
#define GREEN_MIN   0x60
 
#define GREEN_MAX   0x7F
 
#define BLUE_MIN   0x80
 
#define BLUE_MAX   0x9F
 
#define LED3_CMD_SHUT_DOWN   0x00
 
#define LED3_COLOUR_RED   0x5F6080
 Defines for commonly used colours. More...
 
#define LED3_COLOUR_ORANGE   0x5F6280
 
#define LED3_COLOUR_YELLOW   0x5F7480
 
#define LED3_COLOUR_GREEN   0x407F80
 
#define LED3_COLOUR_BLUE   0x40609F
 
#define LED3_COLOUR_WHITE   0x5F7F9F
 
#define LED3_COLOUR_PURPLE   0x58609C
 
#define LED3_TIMER_8ms   0xE1
 Time intervals for dimming function (31 total combinations available). More...
 
#define LED3_TIMER_16ms   0xE2
 
#define LED3_TIMER_32ms   0xE4
 
#define LED3_TIMER_64ms   0xE8
 
#define LED3_TIMER_128ms   0xE0
 
#define LED3_INTENSITY_1   0x01
 Defines for setting the light intensity of the LED (MIN = 1, MAX = 31). More...
 
#define LED3_INTENSITY_2   0x02
 
#define LED3_INTENSITY_4   0x04
 
#define LED3_INTENSITY_8   0x08
 
#define LED3_INTENSITY_16   0x10
 
#define LED3_INTENSITY_MAX   0x1F
 
#define LED3_INCREMENT   0xA0
 Defines for the dimming function. More...
 
#define LED3_DECREMENT   0xC0
 
#define LED3_CONSTANT   0x20
 

Enumerations

enum  led3_status { LED3_ST_OK = 0 , LED3_ST_FAIL = 1 }
 Enum (LED3 status). More...
 

Functions

uint8_t MIKROSDK_LED3_set_dimming_and_intensity (uint8_t cmd)
 Function that sets the dimming mode (Increment, Decrement, Constant) and the light intensity. More...
 
uint8_t MIKROSDK_LED3_set_rgb (uint8_t red, uint8_t green, uint8_t blue)
 Function that sets the rgb value individually. More...
 
uint8_t MIKROSDK_LED3_set_colour (uint32_t colour)
 Function that sets the LED using common colours. More...
 
uint8_t MIKROSDK_LED3_shut_down (void)
 Function that turns off the LED. More...
 
uint8_t MIKROSDK_LED3_set_timer (uint8_t time)
 Function that sets the time interval for the dimming function. More...
 
uint8_t MIKROSDK_LED3_Initialise (void)
 Function that initialises the I2C configuration of the LED3 click. More...
 

Detailed Description

mikrosdk interface

Macro Definition Documentation

◆ BLUE_MAX

#define BLUE_MAX   0x9F

◆ BLUE_MIN

#define BLUE_MIN   0x80

◆ GREEN_MAX

#define GREEN_MAX   0x7F

◆ GREEN_MIN

#define GREEN_MIN   0x60

◆ LED3_ADD_CMD_LEN

#define LED3_ADD_CMD_LEN   2

Maximum length[bytes] for I2C led3 slave address + memory address (command).

◆ LED3_CMD_SHUT_DOWN

#define LED3_CMD_SHUT_DOWN   0x00

◆ LED3_COLOUR_BLUE

#define LED3_COLOUR_BLUE   0x40609F

◆ LED3_COLOUR_GREEN

#define LED3_COLOUR_GREEN   0x407F80

◆ LED3_COLOUR_ORANGE

#define LED3_COLOUR_ORANGE   0x5F6280

◆ LED3_COLOUR_PURPLE

#define LED3_COLOUR_PURPLE   0x58609C

◆ LED3_COLOUR_RED

#define LED3_COLOUR_RED   0x5F6080

Defines for commonly used colours.

◆ LED3_COLOUR_WHITE

#define LED3_COLOUR_WHITE   0x5F7F9F

◆ LED3_COLOUR_YELLOW

#define LED3_COLOUR_YELLOW   0x5F7480

◆ LED3_CONSTANT

#define LED3_CONSTANT   0x20

◆ LED3_DECREMENT

#define LED3_DECREMENT   0xC0

◆ LED3_INCREMENT

#define LED3_INCREMENT   0xA0

Defines for the dimming function.

LED3_INCREMENT and LED3_DECREMENT will increase/decrease the light intensity until the specified intensity value. LED3_CONSTANT will keep the light intensity at a constant value.

◆ LED3_INTENSITY_1

#define LED3_INTENSITY_1   0x01

Defines for setting the light intensity of the LED (MIN = 1, MAX = 31).

The intensity could be added by using bitwise OR. E.g, for an intensity of 12, use (LED3_INTENSITY_4 | LED3_INTENSITY_8).

◆ LED3_INTENSITY_16

#define LED3_INTENSITY_16   0x10

◆ LED3_INTENSITY_2

#define LED3_INTENSITY_2   0x02

◆ LED3_INTENSITY_4

#define LED3_INTENSITY_4   0x04

◆ LED3_INTENSITY_8

#define LED3_INTENSITY_8   0x08

◆ LED3_INTENSITY_MAX

#define LED3_INTENSITY_MAX   0x1F

◆ LED3_TIMER_128ms

#define LED3_TIMER_128ms   0xE0

◆ LED3_TIMER_16ms

#define LED3_TIMER_16ms   0xE2

◆ LED3_TIMER_32ms

#define LED3_TIMER_32ms   0xE4

◆ LED3_TIMER_64ms

#define LED3_TIMER_64ms   0xE8

◆ LED3_TIMER_8ms

#define LED3_TIMER_8ms   0xE1

Time intervals for dimming function (31 total combinations available).

The time interval could be added by using bitwise OR. E.g, for a time interval of 24ms, use (LED3_TIMER_8ms | LED3_TIMER_16ms).

◆ RED_MAX

#define RED_MAX   0x5F

◆ RED_MIN

#define RED_MIN   0x40

Minimum and maximum values allowed for each colour.

Each colour (r,g,b) is controlled by a 5-bit PWM signal, hence a total of 32768 colours is available.

◆ TX_BUF_BLUE

#define TX_BUF_BLUE   2

◆ TX_BUF_GREEN

#define TX_BUF_GREEN   1

◆ TX_BUF_RED

#define TX_BUF_RED   0

Defines for tx_buf array used in set_rgb and set_colour functions.

Enumeration Type Documentation

◆ led3_status

Enum (LED3 status).

Enumerator
LED3_ST_OK 
LED3_ST_FAIL 

Function Documentation

◆ MIKROSDK_LED3_Initialise()

uint8_t MIKROSDK_LED3_Initialise ( void  )

Function that initialises the I2C configuration of the LED3 click.

Returns
uint8_t

◆ MIKROSDK_LED3_set_colour()

uint8_t MIKROSDK_LED3_set_colour ( uint32_t  colour)

Function that sets the LED using common colours.

Parameters
colourDefined commonly used colours. E.g, LED3_COLOUR_PURPLE.
Returns
uint8_t

◆ MIKROSDK_LED3_set_dimming_and_intensity()

uint8_t MIKROSDK_LED3_set_dimming_and_intensity ( uint8_t  cmd)

Function that sets the dimming mode (Increment, Decrement, Constant) and the light intensity.

Parameters
cmdBitwise OR of dimming mode and light intensity. E.g, to use constant brightness with max intensity, use (LED3_CONSTANT | LED3_INTENSITY_MAX).
Returns
uint8_t

◆ MIKROSDK_LED3_set_rgb()

uint8_t MIKROSDK_LED3_set_rgb ( uint8_t  red,
uint8_t  green,
uint8_t  blue 
)

Function that sets the rgb value individually.

Parameters
redRed colour value (MIN = 0x40, MAX = 0x5F).
greenGreen colour value (MIN = 0x60, MAX = 0x7F).
blueBlue colour value (MIN = 0x80, MAX = 0x9F).
Returns
uint8_t

◆ MIKROSDK_LED3_set_timer()

uint8_t MIKROSDK_LED3_set_timer ( uint8_t  time)

Function that sets the time interval for the dimming function.

Parameters
timeTime interval for dimming. If set to 32ms, the LED will dim to the specified intensity at 32ms per intensity step. E.g, current intensity = 5, new intensity = 15, the total dimming sequence will take 320ms.
Returns
uint8_t

◆ MIKROSDK_LED3_shut_down()

uint8_t MIKROSDK_LED3_shut_down ( void  )

Function that turns off the LED.

Returns
uint8_t