busvoodoo_global.h File Reference

BusVoodoo global definitions and methods (API) More...

Go to the source code of this file.

## Data Structures

struct | busvoodoo_mode_t
| BusVoodoo mode interface. More...

## Macros

#define | BUSVOODOO_5VPULLUP_PORT B
| 5V pull-up enable pin (active low)
#define | BUSVOODOO_5VPULLUP_PIN 4
| 5V pull-up enable pin (active low)
#define | BUSVOODOO_OEPULLUP_PORT A
| bus switch output enable pin to enable embedded pull-ups (active low)
#define | BUSVOODOO_OEPULLUP_PIN 15
| bus switch output enable pin to enable embedded pull-ups (active low)
#define | BUSVOODOO_LVEN_PORT A
| low voltage (LV) enable pin (active high)
#define | BUSVOODOO_LVEN_PIN 6
| low voltage (LV) enable pin (active high)
#define | BUSVOODOO_HVEN_PORT A
| high voltage (HV) enable pin (active low)
#define | BUSVOODOO_HVEN_PIN 7
| high voltage (HV) enable pin (active low)
#define | BUSVOODOO_VOUTEN_PORT B
| voltage output (5V and 3.3V) enable pin (active low)
#define | BUSVOODOO_VOUTEN_PIN 3
| voltage output (5V and 3.3V) enable pin (active low)
#define | BUSVOODOO_3V3_CHANNEL 12
| ADC channel to measure 5V rail.
#define | BUSVOODOO_5V_CHANNEL 9
| ADC channel to measure 3.3V rail.
#define | BUSVOODOO_LV_CHANNEL 11
| ADC channel to measure LV rail.
#define | BUSVOODOO_HV_CHANNEL 15
| ADC channel to measure HV rail.
#define | BUSVOODOO_LVCTL_PORT A
| pin to control LV output voltage
#define | BUSVOODOO_LVCTL_PIN 4
| pin to control LV output voltage
#define | BUSVOODOO_LVCTL_CHANNEL CHANNEL_1
| DAC channel to control LV output voltage.
#define | BUSVOODOO_LV_SET(x) ((0.8*(1+30.0/10.0)-x)*(10.0/30.0)+0.8)
| voltage to output for the DAC to set the desired LV output voltage (based on resistor values on the LV adjust pins and LV voltage reference)
#define | BUSVOODOO_HVCTL_PORT A
| pin to control HV output voltage
#define | BUSVOODOO_HVCTL_PIN 5
| pin to control HV output voltage
#define | BUSVOODOO_HVCTL_CHANNEL CHANNEL_2
| DAC channel to control HV output voltage.
#define | BUSVOODOO_HV_SET(x) ((1.25*(1+100.0/10.0)-x)*(10.0/100.0)+1.25)
| voltage to output for the DAC to set the desired HV output voltage (based on resistor values on the HV adjust pins and HV voltage reference)
#define | BUSVOODOO_RS232_EN_PORT B
| RS-232 pin to enable receiver (active low, pulled up)
#define | BUSVOODOO_RS232_EN_PIN 5
| RS-232 pin to enable receiver (active low, pulled up)
#define | BUSVOODOO_RS232_SHDN_PORT C
| RS-232 pin to enable transmitter (active high, pulled low)
#define | BUSVOODOO_RS232_SHDN_PIN 15
| RS-232 pin to enable transmitter (active high, pulled low)
#define | BUSVOODOO_RS232_RTS_PORT A
| RS-232 Request-To-Send output pin.
#define | BUSVOODOO_RS232_RTS_PIN 1
| RS-232 Request-To-Send output pin.
#define | BUSVOODOO_RS232_CTS_PORT A
| RS-232 Clear-To-Send input pin.
#define | BUSVOODOO_RS232_CTS_PIN 0
| RS-232 Clear-To-Send input pin.
#define | BUSVOODOO_RS232_TX_PORT A
| RS-232 Transmit output pin.
#define | BUSVOODOO_RS232_TX_PIN 2
| RS-232 Transmit output pin.
#define | BUSVOODOO_RS232_RX_PORT A
| RS-232 Receive input pin.
#define | BUSVOODOO_RS232_RX_PIN 3
| RS-232 Receive input pin.
#define | BUSVOODOO_RS485_RE_PORT C
| RS-485 pin to enable receiver (active low, pulled up)
#define | BUSVOODOO_RS485_RE_PIN 13
| RS-485 pin to enable receiver (active low, pulled up)
#define | BUSVOODOO_RS485_DE_PORT C
| RS-485 pin to enable transmitter (active high, pulled low)
#define | BUSVOODOO_RS485_DE_PIN 14
| RS-485 pin to enable transmitter (active high, pulled low)
#define | BUSVOODOO_RS485_TX_PORT A
| RS-485 Transmit output pin.
#define | BUSVOODOO_RS485_TX_PIN 2
| RS-485 Transmit output pin.
#define | BUSVOODOO_RS485_RX_PORT A
| RS-485 Receive input pin.
#define | BUSVOODOO_RS485_RX_PIN 3
| RS-485 Receive input pin.
#define | BUSVOODOO_HW_VERSION_PORT B
| pin to identify hardware version
#define | BUSVOODOO_HW_VERSION_PIN 0
| pin to identify hardware version
#define | BUSVOODOO_HW_VERSION_CHANNEL 8
| ADC to identify hardware version.
#define | BUSVOODOO_LED_PULSE 100
| recommended duration in ms for pulsing LEDs to show activity

## Functions

void | busvoodoo_setup (void)
| setup BusVoodoo board
void | busvoodoo_safe_state (void)
| set safe state by disabling all outputs
bool | busvoodoo_vout_switch (bool on)
| switch 3V3 and 5V power outputs on I/O connector More...
float | busvoodoo_vreg_get (uint8_t channel)
| read voltage from power rail More...
float | busvoodoo_lv_set (float voltage)
| set voltage on low voltage adjustable voltage regulator More...
float | busvoodoo_hv_set (float voltage)
| set voltage on high voltage adjustable voltage regulator More...
float | busvoodoo_embedded_pullup (bool on)
| enable embedded pull-up resistors More...
void | busvoodoo_led_blue_pulse (uint16_t ms)
| pulse blue LED for short duration More...
void | busvoodoo_led_red_pulse (uint16_t ms)
| pulse red LED for short duration More...
bool | busvoodoo_global_actions (char *actions, bool perform, bool(*action_handler)(const char *action, uint32_t repetition, bool perform))
| parse and perform actions More...

## Variables

const char * | busvoodoo_io_names [13]
| I/O individual signal names.
const uint32_t | busvoodoo_io_ports [13]
| port of individual signals
const uint32_t | busvoodoo_io_pins [13]
| pin of individual signals
const uint8_t | busvoodoo_io_groups [13]
| which I/O pin (group) does the signal belong to
bool | busvoodoo_full
| is the BusVoodoo board fully populated (with HV voltage regulator, RS-232, RS-485, CAN transceiver on the back side)
char | busvoodoo_version
| version of the hardware board
const struct menu_command_t | busvoodoo_global_commands []
| list of supported commands
const uint8_t | busvoodoo_global_commands_nb
| number supported commands
const char * | busvoodoo_global_pinout_io [10]
| I/O connector pinout.
const char * | busvoodoo_global_pinout_rscan [5]
| RS/CAN connector pinout.
char | busvoodoo_global_string [64]
| shared string buffer, i.e. More...

## Detailed Description

BusVoodoo global definitions and methods (API)

Author
  King Kévin kingk.nosp@m.evin.nosp@m.@cuvo.nosp@m.odoo.nosp@m..info

Date
  2018

Note
  peripherals used: time timer used to blink LED

Definition in file busvoodoo_global.h.

## Function Documentation

## busvoodoo_embedded_pullup()

float busvoodoo_embedded_pullup | ( | bool | on | ) |

enable embedded pull-up resistors

Note
  the embedded pull-up resistor use the voltage on the LV power rail (set or externally provided)

Parameters

  [in] | on | enable (true) or disable (false) embedded pull-up resistors

Returns
  voltage applied on pull-up resistors, or NaN if channel is invalid (or error happened)

Definition at line 342 of file busvoodoo_global.c.

## busvoodoo_global_actions()

bool busvoodoo_global_actions | ( | char * | actions,
|  | bool | perform,
|  | bool(*)(const char *action, uint32_t repetition, bool perform) | action_handler
| ) |  |

parse and perform actions

Note
  performing action is a common command in mode and this function helps parsing them

Parameters

  [in] | actions | actions to perform
  [in] | perform | the action (true) or just check it (false)
  [in] | action_handler | function handling the individual actions

Returns
  true if the actions have been performed, false if any of them is malformed

Note
  while parsing the actions the string will be modified

Definition at line 404 of file busvoodoo_global.c.

## busvoodoo_hv_set()

float busvoodoo_hv_set | ( | float | voltage | ) |

set voltage on high voltage adjustable voltage regulator

Parameters

  [in] | voltage | voltage to set on adjustable voltage regulator (0, 3.3-24V)

Returns
  voltage output, or NaN if error happened

Definition at line 312 of file busvoodoo_global.c.

## busvoodoo_led_blue_pulse()

void busvoodoo_led_blue_pulse | ( | uint16_t | ms | ) |

pulse blue LED for short duration

Parameters

  [in] | ms | duration in ms (0-32768)

Definition at line 366 of file busvoodoo_global.c.

## busvoodoo_led_red_pulse()

void busvoodoo_led_red_pulse | ( | uint16_t | ms | ) |

pulse red LED for short duration

Parameters

  [in] | ms | duration in ms (0-32768)

Definition at line 385 of file busvoodoo_global.c.

## busvoodoo_lv_set()

float busvoodoo_lv_set | ( | float | voltage | ) |

set voltage on low voltage adjustable voltage regulator

Note
  for voltages above 4.85V it will use the 5.0V from USB

Parameters

  [in] | voltage | voltage to set on adjustable voltage regulator (0, 0.3-4.8, 5V)

Returns
  voltage output, or NaN if error happened

Definition at line 284 of file busvoodoo_global.c.

## busvoodoo_vout_switch()

bool busvoodoo_vout_switch | ( | bool | on | ) |

switch 3V3 and 5V power outputs on I/O connector

Parameters

  [in] | on | switch on (true) or off (false) power output

Returns
  if switching succeeded. else it means there is a probably a short on one of the outputs

Definition at line 201 of file busvoodoo_global.c.

## busvoodoo_vreg_get()

float busvoodoo_vreg_get | ( | uint8_t | channel | ) |

read voltage from power rail

Parameters

  [in] | channel | which power rail to read voltage from ADC inputs to measure voltages from voltage regulators

Returns
  voltage, or NaN if channel is invalid (or error happened)

Definition at line 222 of file busvoodoo_global.c.

## Variable Documentation

## busvoodoo_global_string

char busvoodoo_global_string[64]

shared string buffer, i.e.

used when configuring modes

Definition at line 66 of file busvoodoo_global.c.