Serial Wombat 18AB Firmware
Classes | Macros | Typedefs | Enumerations | Functions | Variables
pulseOnChange.c File Reference
#include "serialWombat.h"
#include <stdint.h>
#include <stdbool.h>

Classes

struct  changeRec_n
 
struct  pulseOnChange_n
 

Macros

#define NUM_CHANGE_REC   4
 

Typedefs

typedef struct changeRec_n changeReq_t
 
typedef struct pulseOnChange_n pulseOnChange_t
 

Enumerations

enum  PULSE_ON_CHANGE_STATE_t { STATE_WAITING_FOR_PULSE, STATE_PULSING_ACTIVE, STATE_PULSING_INACTIVE }
 
enum  PULSE_ON_CHANGE_MODE_t {
  PULSE_ON_CHANGE = 0, PULSE_ON_INCREASE = 1, PULSE_ON_DECREASE = 2, PULSE_EQUAL_VALUE = 3,
  PULSE_BELOW_VALUE = 4, PULSE_ABOVE_VALUE = 5, PULSE_NOT_EQUAL_VALUE = 6, PULSE_EQUAL_PIN = 7,
  PULSE_ABOVE_PIN = 8, PULSE_BELOW_PIN = 9, PULSE_NOT_EQUAL_PIN = 10, PULSE_CROSS_VALUE = 11,
  PULSE_CROSS_VALUE_ASCENDING = 12, PULSE_CROSS_VALUE_DESCENDING = 13, PULSE_WITHIN_RANGE = 14, PULSE_OUTSIDE_RANGE = 15,
  PULSE_NUM_MODES
}
 

Functions

void initPulseOnChange (void)
 
void updatePulseOnChange ()
 

Variables

pulseOnChange_tdebugPulseOnChange
 

Macro Definition Documentation

◆ NUM_CHANGE_REC

#define NUM_CHANGE_REC   4

Typedef Documentation

◆ changeReq_t

typedef struct changeRec_n changeReq_t

◆ pulseOnChange_t

Enumeration Type Documentation

◆ PULSE_ON_CHANGE_MODE_t

Enumerator
PULSE_ON_CHANGE 
PULSE_ON_INCREASE 
PULSE_ON_DECREASE 
PULSE_EQUAL_VALUE 
PULSE_BELOW_VALUE 
PULSE_ABOVE_VALUE 
PULSE_NOT_EQUAL_VALUE 
PULSE_EQUAL_PIN 
PULSE_ABOVE_PIN 
PULSE_BELOW_PIN 
PULSE_NOT_EQUAL_PIN 
PULSE_CROSS_VALUE 
PULSE_CROSS_VALUE_ASCENDING 
PULSE_CROSS_VALUE_DESCENDING 
PULSE_WITHIN_RANGE 
PULSE_OUTSIDE_RANGE 
PULSE_NUM_MODES 

◆ PULSE_ON_CHANGE_STATE_t

Enumerator
STATE_WAITING_FOR_PULSE 
STATE_PULSING_ACTIVE 
STATE_PULSING_INACTIVE 

Function Documentation

◆ initPulseOnChange()

void initPulseOnChange ( void  )
\brief Initialization routine for WS2812B driver 

CONFIGURE_CHANNEL_MODE_0:

Initialize WS2812 Output

BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4 BYTE 5 BYTE 6 BYTE 7
0xC0 Pin To Set 0x0C userBufferIndex LSB userBufferIndex MSB Number of LEDS Unused 0x55* Unused 0x55*

*0x55 is recommended, but any byte is acceptable

Response:

Command is echoed back.

Examples:

Set pin 19 to WS2812, user buffer index of 0x180, 16 LEDS

0xC0 0x13 0x0B 0x80 0x01 0x10 0x55 0x55


CONFIGURE_CHANNEL_MODE_1:

Set an LED RGB Value. Index 0 also sets off mode for Bargraph, Index 1 also sets on Mode for bargraph.

BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4 BYTE 5 BYTE 6 BYTE 7
0xC1 Pin To Set 0x0B LED index (0 to (Num LEDs - 1)) Blue (0-255) Green(0-255) Red (0-255) Unused 0x55*

*0x55 is recommended, but any byte is acceptable

Response:

Command is echoed back.

Examples:

Set Pin 16, LED 7 to RGB value 0x002532BF

0xC1 0x13 0x0B 0x07 0xBF 0x32 0x25 0x55


CONFIGURE_CHANNEL_MODE_2:

Respond with number of bytes needed in User Buffer to store a support a specified number of LEDS

BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4 BYTE 5 BYTE 6 BYTE 7
0xC2 Pin To Set 0x0B Number of LEDS Unused/0x55* Unused/0x55* Unused/0x55* Unused/0x55*

*0x55 is recommended, but any byte is acceptable

Response:

BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4 BYTE 5 BYTE 6 BYTE 7
0xC2 Pin To Set 0x0B Number of Bytes MSB Number of Bytes LSB Unused/0x55* Unused/0x55* Unused/0x55*

Examples:

Set Pin 16, Request byte count for 15 LEDS

0xC2 0x13 0x0B 0x0F 0x55 0x55 0x55 0x55

Response (assume answer is 725 bytes (0x2D5):

0xC2 0x13 0x0B 0xD5 0x02 0x55 0x55 0x55

CONFIGURE_CHANNEL_MODE_3:

Set an LED RGB Value in an animation frame. This command cannot be called until the Animation buffer index is set with command 0xC4

BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4 BYTE 5 BYTE 6 BYTE 7
0xC3 Pin To Set 0x0B Frame Index LED index (0 to (Num LEDs - 1)) Blue (0-255) Green(0-255) Red (0-255)

Response:

Command is echoed back.

Examples:

Set Pin 16, Frame 3 LED 7 to RGB value 0x002532BF

0xC1 0x13 0x0B 0x03 0x07 0xBF 0x32 0x25

CONFIGURE_CHANNEL_MODE_4:

Set the index of the animation frames area and the number of frames. The animation frames area is separate from the buffer defined in command 0xC0 and cannot overlap. The length of this area is (2 + 3 * NumLeds)* NumFrames.

BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4 BYTE 5 BYTE 6 BYTE 7
0xC4 Pin To Set 0x0B Animation Buffer Index LSB Animation Buffer Index MSB Number of Animation Frames Unused 0x55* Unused 0x55*

*0x55 is recommended, but any byte is acceptable

Response:

Command is echoed back.

Examples:

Set the animation buffer index to 0x0440 and the number of frames to 10

0xC0 0x13 0x0B 0x40 0x04 0x0A 0x55 0x05

CONFIGURE_CHANNEL_MODE_5:

Set the delay for an animation frame in mS. This command must not be called before the animation buffer index is set with command 0xC4.

BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4 BYTE 5 BYTE 6 BYTE 7
0xC5 Pin To Set 0x0B Frame Index delay LSB delay MSB Unused/0x55* Unused/0x55*

*0x55 is recommended, but any byte is acceptable

Response:

Command is echoed back.

Examples:

Set pin 19 Animation frame 2 to a delay of 8000 ms (0x1F40)

0xC5 0x13 0x0B 0x02 0x40 0x1F 0x55 0x55

CONFIGURE_CHANNEL_MODE_7:

Set the bargraph mode min and max values

BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4 BYTE 5 BYTE 6 BYTE 7
0xC6 Pin To Set 0x0B bargraph min lsb bargraph min msb bargraph max lsb bargraph max msb Unused/0x55*

*0x55 is recommended, but any byte is acceptable

Response:

Command is echoed back.

Examples:

Set pin 19 bargraph min 1000, max 64000

`0xC7 0x13 0x0B 0x0E8 0x03 0x00 0xFA 0x55

◆ updatePulseOnChange()

void updatePulseOnChange ( )

Variable Documentation

◆ debugPulseOnChange

pulseOnChange_t* debugPulseOnChange