Serial Wombat 18AB Firmware
Classes | Macros | Typedefs | Functions
hfServo.c File Reference
#include <stdint.h>
#include "serialWombat.h"
#include "outputScale.h"

Classes

struct  hfServo_n
 

Macros

#define servo   ((hfServo_t*) CurrentPinRegister)
 
#define DUTY_CYCLE   ((((uint32_t)CurrentPinRegister->generic.buffer * servo->variablePeriod) + (((uint32_t)servo->fixedPeriod) <<16)) / (servo->period))
 

Typedefs

typedef struct hfServo_n hfServo_t
 

Functions

void initHfServo (void)
 
void updateHfServo ()
 

Macro Definition Documentation

◆ DUTY_CYCLE

#define DUTY_CYCLE   ((((uint32_t)CurrentPinRegister->generic.buffer * servo->variablePeriod) + (((uint32_t)servo->fixedPeriod) <<16)) / (servo->period))

◆ servo

#define servo   ((hfServo_t*) CurrentPinRegister)

Typedef Documentation

◆ hfServo_t

typedef struct hfServo_n hfServo_t

Function Documentation

◆ initHfServo()

void initHfServo ( void  )
\brief Initialization routine for Servo.

CONFIGURE_CHANNEL_MODE_0:

Initialize Servo. This command causes the pulse width to default to 500uS to 2500uS.

BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4 BYTE 5 BYTE 6 BYTE 7
0xC0 Pin To Set 0x1A (hf servo mode) Pin To Set (Required for compatability with SW19) Position Value Low Byte Position Value High Byte 0x00 or 0x01 (Normal or Reverse) 0x55*

*0x55 is recommended, but any byte is acceptable

Response:

Command is echoed back.

Examples:

Set pin 2 to Servo, Position 0x4080, no reverse

0xC0 0x02 0x16 0x02 0x80 0x40 0x00 0x55


CONFIGURE_CHANNEL_MODE_1:

Set Pulse widths. This command must come after a servo CONFIGURE_CHANNEL_MODE_0 command for the same pin. Units are microseconds

BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4 BYTE 5 BYTE 6 BYTE 7
0xC1 Pin To Set 0x1A (hf servo mode) Fixed pulse time low byte Fixed pulse time high byte Variable pulse time low byte variable pulse time high byte 0x55*

*0x55 is recommended, but any byte is acceptable

Response:

Command is echoed back.

Examples:

Set pin 2 Servo Pulse width to range between 750 and 1750 uS.
Fixed period is 750 = 0x02EE, variable period is (1750 - 750) = 1000 = 0x03E8

0xC1 0x02 0x16 0xEE 0x02 0xE8 0x03 0x55

◆ updateHfServo()

void updateHfServo ( )