# can_bicolor_leds

CANbus bicolor LED library

Author | William Welch and Eur van Andel Copyright © 2010, all rights reserved.
Adapted-by |
Compiler | 2.4m

Description

    implements LED blinks compatible with CANopen spec.

Sources

    Cia Draft Recommendation 303, Part 3, Indicator specification

Dependencies

No dependency found

## Summary

### Global variables/contants

- `var byte can_led_green_func = CANLED_OFF`
- `const CANLED_OFF = 0`
- `var byte can_led_green_opcode = CANLED_OFF`
- `var byte can_led_red_opcode = CANLED_OFF`
- `var byte can_led_state = 0`
- `const CANLED_1FLASH = 0x18`
- `var byte can_led_red_func = CANLED_OFF`
- `const CANLED_2FLASH = 0x28`
- `const CANLED_FLASH = 8`
- `const CANLED_RED_ON = 2`
- `const CANLED_3FLASH = 0x38`
- `const CANLED_GREEN_ON = 1`
- `const CANLED_4FLASH = 0x48`
- `const CANLED_BLINK = 4`

### Procedures

- `can_red_2flash()`
- `can_set_leds(byte in x)`
- `can_green_on()`
- `can_led_delay100ms(word in n)`
- `can_led_poll()`
- `can_red_4flash()`
- `can_red_off()`
- `can_red_1flash()`
- `can_green_3flash()`
- `can_green_1flash()`
- `can_green_2flash()`
- `can_green_blink()`
- `can_red_on()`
- `can_red_blink()`
- `can_green_off()`
- `can_red_3flash()`

### Functions

## API details

### Global variables/contants

- `var byte can_led_green_func = CANLED_OFF`

  No documentation found

- `const CANLED_OFF = 0`

  No documentation found

- `var byte can_led_green_opcode = CANLED_OFF`

  No documentation found

- `var byte can_led_red_opcode = CANLED_OFF`

  No documentation found

- `var byte can_led_state = 0`

  No documentation found

- `const CANLED_1FLASH = 0x18`

  No documentation found

- `var byte can_led_red_func = CANLED_OFF`

  No documentation found

- `const CANLED_2FLASH = 0x28`

  No documentation found

- `const CANLED_FLASH = 8`

  No documentation found

- `const CANLED_RED_ON = 2`

  No documentation found

- `const CANLED_3FLASH = 0x38`

  No documentation found

- `const CANLED_GREEN_ON = 1`

  No documentation found

- `const CANLED_4FLASH = 0x48`

  No documentation found

- `const CANLED_BLINK = 4`

  No documentation found

### Procedures

- `can_red_2flash()`

      red led: 2 200ms flashes

- `can_set_leds(byte in x)`

      Internal routine to control the bicolor led I/O pin.
      four leds, all connected in series between +5V and GND.
      PIC pin is tied to the middle, via 150 Ohm resistor.
      at 1.7V Vf, they will not light up (both are off)
      so HIGH will light both lower green LEDs
      LOW will light both higher RED leds
      pin_direction = input will light no LEDs.

- `can_green_on()`

      green led: on steady

- `can_led_delay100ms(word in n)`

      Delays for n * 100 mSec, while maintaining CAN leds

- `can_led_poll()`

      implements blinking of CAN leds. call this routine somewhere in your main loop.
      can led blink states are typically 200ms each, so try to call more often than 200ms.

- `can_red_4flash()`

      red led: 4 200ms flashes

- `can_red_off()`

      red led: off

- `can_red_1flash()`

      red led: 1 200ms flash

- `can_green_3flash()`

      green led: 3 200ms flashes

- `can_green_1flash()`

      green led: 1 200ms flash

- `can_green_2flash()`

      green led: 2 200ms flashes

- `can_green_blink()`

      green led: blink 200ms off, 200ms on

- `can_red_on()`

      red led: on steady

- `can_red_blink()`

      red led: blink 200ms on, 200ms off

- `can_green_off()`

      green led: off

- `can_red_3flash()`

      red led: 3 200ms flashes

### Functions

## Related samples

Here are the list of samples which use this library:

18f4585 | 18f4585_canopen_blink.jal