busvoodoo_global.h
Go to the documentation of this file.
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#define BUSVOODOO_5VPULLUP_PORT B
#define BUSVOODOO_5VPULLUP_PIN 4
#define BUSVOODOO_OEPULLUP_PORT A
#define BUSVOODOO_OEPULLUP_PIN 15
#define BUSVOODOO_LVEN_PORT A
#define BUSVOODOO_LVEN_PIN 6
#define BUSVOODOO_HVEN_PORT A
#define BUSVOODOO_HVEN_PIN 7
#define BUSVOODOO_VOUTEN_PORT B
#define BUSVOODOO_VOUTEN_PIN 3
#define BUSVOODOO_3V3_CHANNEL 12
#define BUSVOODOO_5V_CHANNEL 9
#define BUSVOODOO_LV_CHANNEL 11
#define BUSVOODOO_HV_CHANNEL 15
#define BUSVOODOO_LVCTL_PORT A
#define BUSVOODOO_LVCTL_PIN 4
#define BUSVOODOO_LVCTL_CHANNEL CHANNEL_1
#define BUSVOODOO_LV_SET(x) ((0.8*(1+30.0/10.0)-x)*(10.0/30.0)+0.8)
#define BUSVOODOO_HVCTL_PORT A
#define BUSVOODOO_HVCTL_PIN 5
#define BUSVOODOO_HVCTL_CHANNEL CHANNEL_2
#define BUSVOODOO_HV_SET(x) ((1.25*(1+100.0/10.0)-x)*(10.0/100.0)+1.25)
#define BUSVOODOO_RS232_EN_PORT B
#define BUSVOODOO_RS232_EN_PIN 5
#define BUSVOODOO_RS232_SHDN_PORT C
#define BUSVOODOO_RS232_SHDN_PIN 15
#define BUSVOODOO_RS232_RTS_PORT A
#define BUSVOODOO_RS232_RTS_PIN 1
#define BUSVOODOO_RS232_CTS_PORT A
#define BUSVOODOO_RS232_CTS_PIN 0
#define BUSVOODOO_RS232_TX_PORT A
#define BUSVOODOO_RS232_TX_PIN 2
#define BUSVOODOO_RS232_RX_PORT A
#define BUSVOODOO_RS232_RX_PIN 3
#define BUSVOODOO_RS485_RE_PORT C
#define BUSVOODOO_RS485_RE_PIN 13
#define BUSVOODOO_RS485_DE_PORT C
#define BUSVOODOO_RS485_DE_PIN 14
#define BUSVOODOO_RS485_TX_PORT A
#define BUSVOODOO_RS485_TX_PIN 2
#define BUSVOODOO_RS485_RX_PORT A
#define BUSVOODOO_RS485_RX_PIN 3
#if BUSVOODOO_HARDWARE_VERSION!=0
#define BUSVOODOO_CAN_EN_PORT C
#define BUSVOODOO_CAN_EN_PIN 7
#define BUSVOODOO_CAN_TX_PORT B
#define BUSVOODOO_CAN_TX_PIN 9
#define BUSVOODOO_CAN_RX_PORT B
#define BUSVOODOO_CAN_RX_PIN 8
#endif
#define BUSVOODOO_HW_VERSION_PORT B
#define BUSVOODOO_HW_VERSION_PIN 0
#define BUSVOODOO_HW_VERSION_CHANNEL 8
#define BUSVOODOO_LED_PULSE 100
struct busvoodoo_mode_t {
const char* name;
const char* description;
const bool full_only;
bool (*setup)(char** prefix, const char* line);
const struct menu_command_t* commands;
const uint8_t commands_nb;
void (*exit)(void);
};
extern const char* busvoodoo_io_names[13];
extern const uint32_t busvoodoo_io_ports[13];
extern const uint32_t busvoodoo_io_pins[13];
extern const uint8_t busvoodoo_io_groups[13];
extern bool busvoodoo_full;
extern char busvoodoo_version;
extern const struct menu_command_t busvoodoo_global_commands[];
extern const uint8_t busvoodoo_global_commands_nb;
extern const struct menu_command_t busvoodoo_global_full_commands[];
extern const uint8_t busvoodoo_global_full_commands_nb;
extern const char* busvoodoo_global_pinout_io[10];
extern const char* busvoodoo_global_pinout_rscan[5];
extern char busvoodoo_global_string[64];
void busvoodoo_setup(void);
void busvoodoo_safe_state(void);
bool busvoodoo_vout_switch(bool on);
float busvoodoo_vreg_get(uint8_t channel);
float busvoodoo_lv_set(float voltage);
float busvoodoo_hv_set(float voltage);
float busvoodoo_embedded_pullup(bool on);
void busvoodoo_led_blue_on(void);
void busvoodoo_led_blue_off(void);
void busvoodoo_led_red_on(void);
void busvoodoo_led_red_off(void);
void busvoodoo_leds_off(void);
void busvoodoo_led_blue_pulse(uint32_t ms);
void busvoodoo_led_red_pulse(uint32_t ms);
void busvoodoo_leds_blink(double period, double duty);
bool busvoodoo_global_actions(char* actions, bool perform, bool (*action_handler)(const char* action, uint32_t repetition, bool perform));
busvoodoo_vout_switch
bool busvoodoo_vout_switch(bool on)
switch 3V3 and 5V power outputs on I/O connector
Definition: busvoodoo_global.c:226
busvoodoo_mode_t::commands
const struct menu_command_t * commands
list of menu commands provided by mode
Definition: busvoodoo_global.h:118
menu_command_t
command menu entry
Definition: menu.h:31
busvoodoo_mode_t::full_only
const bool full_only
if this mode is available only for BusVoodoo full flavor
Definition: busvoodoo_global.h:116
busvoodoo_leds_off
void busvoodoo_leds_off(void)
switch off blue and red LEDs
Definition: busvoodoo_global.c:447
busvoodoo_hv_set
float busvoodoo_hv_set(float voltage)
set voltage on high voltage adjustable voltage regulator
Definition: busvoodoo_global.c:343
busvoodoo_mode_t::name
const char * name
name of the mode (i.e.
Definition: busvoodoo_global.h:114
busvoodoo_mode_t::description
const char * description
human readable description of the mode (i.e.
Definition: busvoodoo_global.h:115
busvoodoo_global_full_commands_nb
const uint8_t busvoodoo_global_full_commands_nb
number supported commands for BusVoodoo full only
Definition: busvoodoo_global.c:920
busvoodoo_io_pins
const uint32_t busvoodoo_io_pins[13]
pin of individual signals
Definition: busvoodoo_global.c:67
busvoodoo_lv_set
float busvoodoo_lv_set(float voltage)
set voltage on low voltage adjustable voltage regulator
Definition: busvoodoo_global.c:315
busvoodoo_global_commands
const struct menu_command_t busvoodoo_global_commands[]
list of supported commands for base BusVoodoo
Definition: busvoodoo_global.c:880
busvoodoo_io_ports
const uint32_t busvoodoo_io_ports[13]
port of individual signals
Definition: busvoodoo_global.c:66
busvoodoo_setup
void busvoodoo_setup(void)
setup BusVoodoo board
Definition: busvoodoo_global.c:74
busvoodoo_led_red_off
void busvoodoo_led_red_off(void)
switch off red LED
Definition: busvoodoo_global.c:440
busvoodoo_led_blue_pulse
void busvoodoo_led_blue_pulse(uint32_t ms)
pulse blue LED for short duration
Definition: busvoodoo_global.c:468
busvoodoo_global_actions
bool busvoodoo_global_actions(char *actions, bool perform, bool(*action_handler)(const char *action, uint32_t repetition, bool perform))
parse and perform actions
Definition: busvoodoo_global.c:561
busvoodoo_io_groups
const uint8_t busvoodoo_io_groups[13]
which I/O pin (group) does the signal belong to
Definition: busvoodoo_global.c:68
busvoodoo_global_pinout_io
const char * busvoodoo_global_pinout_io[10]
I/O connector pinout.
Definition: busvoodoo_global.c:62
busvoodoo_vreg_get
float busvoodoo_vreg_get(uint8_t channel)
read voltage from power rail
Definition: busvoodoo_global.c:247
busvoodoo_leds_blink
void busvoodoo_leds_blink(double period, double duty)
set LED blinking pattern
Definition: busvoodoo_global.c:511
busvoodoo_io_names
const char * busvoodoo_io_names[13]
I/O individual signal names.
Definition: busvoodoo_global.c:65
busvoodoo_led_blue_on
void busvoodoo_led_blue_on(void)
switch on blue LED
Definition: busvoodoo_global.c:419
busvoodoo_mode_t::exit
void(* exit)(void)
function to exit from mode (i.e.
Definition: busvoodoo_global.h:120
busvoodoo_global_string
char busvoodoo_global_string[64]
shared string buffer, i.e.
Definition: busvoodoo_global.c:72
busvoodoo_global_commands_nb
const uint8_t busvoodoo_global_commands_nb
number supported commands for base BusVoodoo
Definition: busvoodoo_global.c:907
busvoodoo_led_red_on
void busvoodoo_led_red_on(void)
switch on red LED
Definition: busvoodoo_global.c:433
busvoodoo_mode_t::commands_nb
const uint8_t commands_nb
number of menu commands provided by mode
Definition: busvoodoo_global.h:119
busvoodoo_led_blue_off
void busvoodoo_led_blue_off(void)
switch off blue LED
Definition: busvoodoo_global.c:426
busvoodoo_global_pinout_rscan
const char * busvoodoo_global_pinout_rscan[5]
RS/CAN connector pinout.
Definition: busvoodoo_global.c:63
busvoodoo_mode_t::setup
bool(* setup)(char **prefix, const char *line)
function to setup mode (menu prefix can be used to ask parameter, and line will be the user provided ...
Definition: busvoodoo_global.h:117
busvoodoo_version
char busvoodoo_version
version of the hardware board
Definition: busvoodoo_global.c:71
busvoodoo_led_red_pulse
void busvoodoo_led_red_pulse(uint32_t ms)
pulse red LED for short duration
Definition: busvoodoo_global.c:481
busvoodoo_safe_state
void busvoodoo_safe_state(void)
set safe state by disabling all outputs
Definition: busvoodoo_global.c:171
busvoodoo_full
bool busvoodoo_full
is the BusVoodoo board fully populated (with HV voltage regulator, RS-232, RS-485, CAN transceiver on the back side)
Definition: busvoodoo_global.c:70
busvoodoo_embedded_pullup
float busvoodoo_embedded_pullup(bool on)
enable embedded pull-up resistors
Definition: busvoodoo_global.c:373
busvoodoo_mode_t
BusVoodoo mode interface.
Definition: busvoodoo_global.h:113
busvoodoo_global_full_commands
const struct menu_command_t busvoodoo_global_full_commands[]
list of supported commands for BusVoodoo full only
Definition: busvoodoo_global.c:909