CuVoodoo STM32F1 firmware template
busvoodoo_global.h
Go to the documentation of this file.
1 /* This program is free software: you can redistribute it and/or modify
2  * it under the terms of the GNU General Public License as published by
3  * the Free Software Foundation, either version 3 of the License, or
4  * (at your option) any later version.
5  *
6  * This program is distributed in the hope that it will be useful,
7  * but WITHOUT ANY WARRANTY; without even the implied warranty of
8  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  * GNU General Public License for more details.
10  *
11  * You should have received a copy of the GNU General Public License
12  * along with this program. If not, see <http://www.gnu.org/licenses/>.
13  *
14  */
25 #define BUSVOODOO_5VPULLUP_PORT B
26 #define BUSVOODOO_5VPULLUP_PIN 4
27 #define BUSVOODOO_OEPULLUP_PORT A
28 #define BUSVOODOO_OEPULLUP_PIN 15
29 #define BUSVOODOO_LVEN_PORT A
30 #define BUSVOODOO_LVEN_PIN 6
31 #define BUSVOODOO_HVEN_PORT A
32 #define BUSVOODOO_HVEN_PIN 7
33 #define BUSVOODOO_VOUTEN_PORT B
34 #define BUSVOODOO_VOUTEN_PIN 3
40 #define BUSVOODOO_3V3_CHANNEL 12
41 #define BUSVOODOO_5V_CHANNEL 9
42 #define BUSVOODOO_LV_CHANNEL 11
43 #define BUSVOODOO_HV_CHANNEL 15
49 #define BUSVOODOO_LVCTL_PORT A
50 #define BUSVOODOO_LVCTL_PIN 4
51 #define BUSVOODOO_LVCTL_CHANNEL CHANNEL_1
52 #define BUSVOODOO_LV_SET(x) ((0.8*(1+30.0/10.0)-x)*(10.0/30.0)+0.8)
53 #define BUSVOODOO_HVCTL_PORT A
54 #define BUSVOODOO_HVCTL_PIN 5
55 #define BUSVOODOO_HVCTL_CHANNEL CHANNEL_2
56 #define BUSVOODOO_HV_SET(x) ((1.25*(1+100.0/10.0)-x)*(10.0/100.0)+1.25)
62 #define BUSVOODOO_RS232_EN_PORT B
63 #define BUSVOODOO_RS232_EN_PIN 5
64 #define BUSVOODOO_RS232_SHDN_PORT C
65 #define BUSVOODOO_RS232_SHDN_PIN 15
66 #define BUSVOODOO_RS232_RTS_PORT A
67 #define BUSVOODOO_RS232_RTS_PIN 1
68 #define BUSVOODOO_RS232_CTS_PORT A
69 #define BUSVOODOO_RS232_CTS_PIN 0
70 #define BUSVOODOO_RS232_TX_PORT A
71 #define BUSVOODOO_RS232_TX_PIN 2
72 #define BUSVOODOO_RS232_RX_PORT A
73 #define BUSVOODOO_RS232_RX_PIN 3
79 #define BUSVOODOO_RS485_RE_PORT C
80 #define BUSVOODOO_RS485_RE_PIN 13
81 #define BUSVOODOO_RS485_DE_PORT C
82 #define BUSVOODOO_RS485_DE_PIN 14
83 #define BUSVOODOO_RS485_TX_PORT A
84 #define BUSVOODOO_RS485_TX_PIN 2
85 #define BUSVOODOO_RS485_RX_PORT A
86 #define BUSVOODOO_RS485_RX_PIN 3
89 #if BUSVOODOO_HARDWARE_VERSION!=0
90 
93 #define BUSVOODOO_CAN_EN_PORT C
94 #define BUSVOODOO_CAN_EN_PIN 7
95 #define BUSVOODOO_CAN_TX_PORT B
96 #define BUSVOODOO_CAN_TX_PIN 9
97 #define BUSVOODOO_CAN_RX_PORT B
98 #define BUSVOODOO_CAN_RX_PIN 8
100 #endif
101 
104 #define BUSVOODOO_HW_VERSION_PORT B
105 #define BUSVOODOO_HW_VERSION_PIN 0
106 #define BUSVOODOO_HW_VERSION_CHANNEL 8
110 #define BUSVOODOO_LED_PULSE 100
111 
114  const char* name;
115  const char* description;
116  const bool full_only;
117  bool (*setup)(char** prefix, const char* line);
118  const struct menu_command_t* commands;
119  const uint8_t commands_nb;
120  void (*exit)(void);
121 };
122 
126 extern const char* busvoodoo_io_names[13];
127 extern const uint32_t busvoodoo_io_ports[13];
128 extern const uint32_t busvoodoo_io_pins[13];
129 extern const uint8_t busvoodoo_io_groups[13];
133 extern bool busvoodoo_full;
135 extern char busvoodoo_version;
137 extern const struct menu_command_t busvoodoo_global_commands[];
139 extern const uint8_t busvoodoo_global_commands_nb;
141 extern const struct menu_command_t busvoodoo_global_full_commands[];
143 extern const uint8_t busvoodoo_global_full_commands_nb;
144 
146 extern const char* busvoodoo_global_pinout_io[10];
148 extern const char* busvoodoo_global_pinout_rscan[5];
149 
151 extern char busvoodoo_global_string[64];
152 
154 void busvoodoo_setup(void);
156 void busvoodoo_safe_state(void);
161 bool busvoodoo_vout_switch(bool on);
166 float busvoodoo_vreg_get(uint8_t channel);
172 float busvoodoo_lv_set(float voltage);
177 float busvoodoo_hv_set(float voltage);
183 float busvoodoo_embedded_pullup(bool on);
188 void busvoodoo_led_blue_on(void);
193 void busvoodoo_led_blue_off(void);
198 void busvoodoo_led_red_on(void);
203 void busvoodoo_led_red_off(void);
207 void busvoodoo_leds_off(void);
213 void busvoodoo_led_blue_pulse(uint32_t ms);
219 void busvoodoo_led_red_pulse(uint32_t ms);
225 void busvoodoo_leds_blink(double period, double duty);
234 bool busvoodoo_global_actions(char* actions, bool perform, bool (*action_handler)(const char* action, uint32_t repetition, bool perform));
bool busvoodoo_vout_switch(bool on)
switch 3V3 and 5V power outputs on I/O connector
const struct menu_command_t * commands
list of menu commands provided by mode
command menu entry
Definition: menu.h:31
const bool full_only
if this mode is available only for BusVoodoo full flavor
void busvoodoo_leds_off(void)
switch off blue and red LEDs
float busvoodoo_hv_set(float voltage)
set voltage on high voltage adjustable voltage regulator
const char * name
name of the mode (i.e.
const char * description
human readable description of the mode (i.e.
const uint8_t busvoodoo_global_full_commands_nb
number supported commands for BusVoodoo full only
const uint32_t busvoodoo_io_pins[13]
pin of individual signals
float busvoodoo_lv_set(float voltage)
set voltage on low voltage adjustable voltage regulator
const struct menu_command_t busvoodoo_global_commands[]
list of supported commands for base BusVoodoo
const uint32_t busvoodoo_io_ports[13]
port of individual signals
void busvoodoo_setup(void)
setup BusVoodoo board
void busvoodoo_led_red_off(void)
switch off red LED
void busvoodoo_led_blue_pulse(uint32_t ms)
pulse blue LED for short duration
bool busvoodoo_global_actions(char *actions, bool perform, bool(*action_handler)(const char *action, uint32_t repetition, bool perform))
parse and perform actions
const uint8_t busvoodoo_io_groups[13]
which I/O pin (group) does the signal belong to
const char * busvoodoo_global_pinout_io[10]
I/O connector pinout.
float busvoodoo_vreg_get(uint8_t channel)
read voltage from power rail
void busvoodoo_leds_blink(double period, double duty)
set LED blinking pattern
const char * busvoodoo_io_names[13]
I/O individual signal names.
void busvoodoo_led_blue_on(void)
switch on blue LED
void(* exit)(void)
function to exit from mode (i.e.
char busvoodoo_global_string[64]
shared string buffer, i.e.
const uint8_t busvoodoo_global_commands_nb
number supported commands for base BusVoodoo
void busvoodoo_led_red_on(void)
switch on red LED
const uint8_t commands_nb
number of menu commands provided by mode
void busvoodoo_led_blue_off(void)
switch off blue LED
const char * busvoodoo_global_pinout_rscan[5]
RS/CAN connector pinout.
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 ...
char busvoodoo_version
version of the hardware board
void busvoodoo_led_red_pulse(uint32_t ms)
pulse red LED for short duration
void busvoodoo_safe_state(void)
set safe state by disabling all outputs
bool busvoodoo_full
is the BusVoodoo board fully populated (with HV voltage regulator, RS-232, RS-485, CAN transceiver on the back side)
float busvoodoo_embedded_pullup(bool on)
enable embedded pull-up resistors
BusVoodoo mode interface.
const struct menu_command_t busvoodoo_global_full_commands[]
list of supported commands for BusVoodoo full only