bldc/applications/app.h

90 lines
2.9 KiB
C
Raw Normal View History

2014-04-13 22:10:01 -07:00
/*
2016-11-04 07:18:34 -07:00
Copyright 2016 Benjamin Vedder benjamin@vedder.se
2014-04-13 22:10:01 -07:00
2016-11-04 07:18:34 -07:00
This file is part of the VESC firmware.
The VESC firmware is free software: you can redistribute it and/or modify
2014-04-13 22:10:01 -07:00
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.
2016-11-04 07:18:34 -07:00
The VESC firmware is distributed in the hope that it will be useful,
2014-04-13 22:10:01 -07:00
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/>.
*/
#ifndef APP_H_
#define APP_H_
2014-04-13 22:10:01 -07:00
2014-04-14 14:02:45 -07:00
#include "conf_general.h"
2014-04-13 22:10:01 -07:00
// Functions
const app_configuration* app_get_configuration(void);
void app_set_configuration(app_configuration *conf);
2019-02-18 10:30:19 -08:00
void app_disable_output(int time_ms);
bool app_is_output_disabled(void);
unsigned app_calc_crc(app_configuration* conf);
// Standard apps
void app_ppm_start(void);
2016-11-04 07:18:34 -07:00
void app_ppm_stop(void);
float app_ppm_get_decoded_level(void);
void app_ppm_configure(ppm_config *conf);
2016-11-04 07:18:34 -07:00
void app_adc_start(bool use_rx_tx);
2016-11-04 07:18:34 -07:00
void app_adc_stop(void);
void app_adc_configure(adc_config *conf);
float app_adc_get_decoded_level(void);
float app_adc_get_voltage(void);
2016-02-02 07:28:55 -08:00
float app_adc_get_decoded_level2(void);
float app_adc_get_voltage2(void);
2016-11-04 07:18:34 -07:00
2021-01-13 12:51:55 -08:00
typedef enum {
UART_PORT_COMM_HEADER = 0,
UART_PORT_BUILTIN,
UART_PORT_EXTRA_HEADER
} UART_PORT;
2021-01-05 09:39:45 -08:00
void app_uartcomm_initialize(void);
2021-01-13 12:51:55 -08:00
void app_uartcomm_start(UART_PORT port_number);
void app_uartcomm_stop(UART_PORT port_number);
void app_uartcomm_configure(uint32_t baudrate, bool permanent_enabled, UART_PORT port_number);
void app_uartcomm_send_packet(unsigned char *data, unsigned int len, UART_PORT port_number);
2016-11-04 07:18:34 -07:00
void app_nunchuk_start(void);
2016-11-04 07:18:34 -07:00
void app_nunchuk_stop(void);
void app_nunchuk_configure(chuk_config *conf);
float app_nunchuk_get_decoded_chuk(void);
2015-04-11 01:07:36 -07:00
void app_nunchuk_update_output(chuck_data *data);
2014-04-13 22:10:01 -07:00
2019-07-27 21:25:56 -07:00
void app_balance_start(void);
void app_balance_stop(void);
void app_balance_configure(balance_config *conf, imu_config *conf2);
2019-07-29 00:31:48 -07:00
float app_balance_get_pid_output(void);
2019-09-21 01:07:31 -07:00
float app_balance_get_pitch_angle(void);
float app_balance_get_roll_angle(void);
2019-08-07 00:22:51 -07:00
uint32_t app_balance_get_diff_time(void);
2019-07-29 00:31:48 -07:00
float app_balance_get_motor_current(void);
2019-07-30 00:27:23 -07:00
float app_balance_get_motor_position(void);
2019-08-09 20:55:58 -07:00
uint16_t app_balance_get_state(void);
2020-02-23 13:34:51 -08:00
uint16_t app_balance_get_switch_state(void);
float app_balance_get_adc1(void);
float app_balance_get_adc2(void);
2019-07-27 21:25:56 -07:00
void app_pas_start(bool is_primary_output);
void app_pas_stop(void);
bool app_pas_is_running(void);
void app_pas_configure(pas_config *conf);
float app_pas_get_current_target_rel(void);
// Custom apps
void app_custom_start(void);
void app_custom_stop(void);
void app_custom_configure(app_configuration *conf);
#endif /* APP_H_ */