dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pios_servo.c
Go to the documentation of this file.
1 
15 /*
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation; either version 3 of the License, or
19  * (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful, but
22  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24  * for more details.
25  *
26  * You should have received a copy of the GNU General Public License along
27  * with this program; if not, see <http://www.gnu.org/licenses/>
28  */
29 
30 /* Project Includes */
31 #include "pios.h"
32 
33 #if defined(PIOS_INCLUDE_SERVO)
34 
35 /* Private Function Prototypes */
36 
37 static const struct pios_servo_callbacks *servo_cbs;
38 
39 void PIOS_Servo_SetCallbacks(const struct pios_servo_callbacks *cb) {
41  servo_cbs = cb;
43 }
44 
45 
49 void PIOS_Servo_Init(void)
50 {
51 }
52 
61 int PIOS_Servo_SetMode(const uint16_t *out_rate, const int banks, const uint16_t *channel_max, const uint16_t *channel_min)
62 {
63  if (servo_cbs && servo_cbs->set_mode) {
64  return servo_cbs->set_mode(out_rate, banks, channel_max, channel_min);
65  }
66 
67  return -200; /* No impl */
68 }
69 
75 void PIOS_Servo_Set(uint8_t servo, float position)
76 {
77  if (servo_cbs && servo_cbs->set) {
78  servo_cbs->set(servo, position);
79  }
80 }
81 
85 void PIOS_Servo_Update(void)
86 {
87  if (servo_cbs && servo_cbs->update) {
88  servo_cbs->update();
89  }
90 }
91 
93 }
94 
95 bool PIOS_Servo_IsDshot(uint8_t servo) {
96  (void) servo;
97 
98  return false;
99 }
100 
101 #endif
int32_t PIOS_IRQ_Enable(void)
Definition: pios_irq.c:53
Main PiOS header to include all the compiled in PiOS options.
bool PIOS_Servo_IsDshot(uint8_t servo)
Definition: pios_servo.c:605
void PIOS_Servo_Set(uint8_t servo, float position)
Definition: pios_servo.c:624
int(* set_mode)(const uint16_t *out_rate, const int banks, const uint16_t *channel_max, const uint16_t *channel_min)
Definition: pios_servo.h:48
void PIOS_Servo_PrepareForReset()
Determines the APB clock used by a given timer.
Definition: pios_servo.c:948
void PIOS_Servo_SetCallbacks(const struct pios_servo_callbacks *cb)
int PIOS_Servo_SetMode(const uint16_t *out_rate, const int banks, const uint16_t *channel_max, const uint16_t *channel_min)
PIOS_Servo_SetMode Sets the PWM output frequency and resolution. An output rate of 0 indicates Synchr...
Definition: pios_servo.c:304
int32_t PIOS_Servo_Init(const struct pios_servo_cfg *cfg)
Definition: pios_servo.c:109
int32_t PIOS_IRQ_Disable(void)
Definition: pios_irq.c:40
uint16_t servo[8]
Definition: msp_messages.h:96
void PIOS_Servo_Update(void)
Definition: pios_servo.c:865
void(* set)(uint8_t servo, float position)
Definition: pios_servo.h:51