Serial Wombat 4A and 4B Firmware
Macros | Enumerations | Functions | Variables
serialWombat.h File Reference
#include <stdint.h>
#include <stdbool.h>
#include "pinModes.h"
#include "deviceSpecific.h"
#include "pinRegisters.h"
#include "protocol.h"
#include "queue.h"
#include "serialWombatErrors.h"

Go to the source code of this file.

Macros

#define RXBUFFER_LENGTH   8
 
#define TXBUFFER_LENGTH   8
 
#define CLOCK_STRETCHING_MAX   10
 
#define DIGITAL_LOW   0
 
#define DIGITAL_HIGH   1
 
#define DIGITAL_INPUT   2
 

Enumerations

enum  SW_DATA_SOURCE_t {
  SW_DATA_SOURCE_PIN_0 = 0, SW_DATA_SOURCE_PIN_1 = 1, SW_DATA_SOURCE_PIN_2 = 2, SW_DATA_SOURCE_PIN_3 = 3,
  SW_DATA_SOURCE_PIN_4 = 4, SW_DATA_SOURCE_PIN_5 = 5, SW_DATA_SOURCE_PIN_6 = 6, SW_DATA_SOURCE_PIN_7 = 7,
  SW_DATA_SOURCE_PIN_8 = 8, SW_DATA_SOURCE_PIN_9 = 9, SW_DATA_SOURCE_PIN_10 = 10, SW_DATA_SOURCE_PIN_11 = 11,
  SW_DATA_SOURCE_PIN_12 = 12, SW_DATA_SOURCE_PIN_13 = 13, SW_DATA_SOURCE_PIN_14 = 14, SW_DATA_SOURCE_PIN_15 = 15,
  SW_DATA_SOURCE_PIN_16 = 16, SW_DATA_SOURCE_PIN_17 = 17, SW_DATA_SOURCE_PIN_18 = 18, SW_DATA_SOURCE_PIN_19 = 19,
  SW_DATA_SOURCE_INCREMENTING_NUMBER = 65, SW_DATA_SOURCE_1024mvCounts = 66, SW_DATA_SOURCE_FRAMES_RUN_LSW = 67, SW_DATA_SOURCE_FRAMES_RUN_MSW = 68,
  SW_DATA_SOURCE_OVERRUN_FRAMES = 69, SW_DATA_SOURCE_TEMPERATURE = 70, SW_DATA_SOURCE_PACKETS_RECEIVED = 71, SW_DATA_SOURCE_ERRORS = 72,
  SW_DATA_SOURCE_FRAMES_DROPPED = 73, SW_DATA_SOURCE_SYSTEM_UTILIZATION = 74, SW_DATA_SOURCE_VCC_mVOLTS = 75, SW_DATA_SOURCE_VBG_COUNTS_VS_VREF = 76,
  SW_DATA_SOURCE_RESET_REGISTER = 77, SW_DATA_SOURCE_LFSR = 78, SW_DATA_SOURCE_PIN_0_MV = 100, SW_DATA_SOURCE_PIN_1_MV = 101,
  SW_DATA_SOURCE_PIN_2_MV = 102, SW_DATA_SOURCE_PIN_3_MV = 103, SW_DATA_SOURCE_PIN_4_MV = 104, SW_DATA_SOURCE_PIN_16_MV = 116,
  SW_DATA_SOURCE_PIN_17_MV = 117, SW_DATA_SOURCE_PIN_18_MV = 118, SW_DATA_SOURCE_PIN_19_MV = 119, SW_DATA_SOURCE_2HZ_SQUARE = 164,
  SW_DATA_SOURCE_2HZ_SAW = 165, SW_DATA_SOURCE_1HZ_SQUARE = 167, SW_DATA_SOURCE_1HZ_SAW = 168, SW_DATA_SOURCE_2SEC_SQUARE = 170,
  SW_DATA_SOURCE_2SEC_SAW = 171, SW_DATA_SOURCE_8SEC_SQUARE = 173, SW_DATA_SOURCE_8SEC_SAW = 174, SW_DATA_SOURCE_65SEC_SQUARE = 176,
  SW_DATA_SOURCE_65SEC_SAW = 177
}
 

Functions

uint8_t CurrentPinPort (void)
 
uint16_t CurrentPinBitmap (void)
 
bool CurrentPinRead (void)
 
bool ReadPin (uint8_t pin)
 
void ConfigurePinAnalog (uint8_t pin, bool makeAnalog)
 
void CurrentPinAnalog (void)
 
void CurrentPinNotAnalog (void)
 
void CurrentPinPullUp (void)
 
void CurrentPinNoPullUp (void)
 
void PinInput (uint8_t pin)
 
void PinOutput (uint8_t pin)
 
void PinHigh (uint8_t pin)
 
void PinLow (uint8_t pin)
 
void SetPin (uint8_t pin, uint8_t pinState)
 
void CurrentPinInput (void)
 
void CurrentPinOutput (void)
 
void CurrentPinHigh (void)
 
void CurrentPinLow (void)
 
void SetCurrentPin (uint8_t pinState)
 
void CurrentPinPullup (void)
 
void CurrentPinNoPullup (void)
 
void PinPullUp (uint8_t pin)
 
void PinNoPullUp (uint8_t pin)
 
void CurrentPinOpenDrain (void)
 
void CurrentPinNotOpenDrain (void)
 
void ProcessRx (void)
 
void ProcessPins (void)
 
void reset (void)
 
void error (SW_ERROR_t errorCode)
 

Variables

uint8_t CurrentPin
 
pinRegister_t PinUpdateRegisters [NUMBER_OF_TOTAL_PINS]
 
bool RunForeground
 
uint8_t Rxbuffer [RXBUFFER_LENGTH]
 A buffer for incoming commands from the host. More...
 
uint8_t Txbuffer [TXBUFFER_LENGTH]
 A buffer for outgoing commands to the host. More...
 
uint32_t FramesRun
 

Macro Definition Documentation

◆ CLOCK_STRETCHING_MAX

#define CLOCK_STRETCHING_MAX   10

◆ DIGITAL_HIGH

#define DIGITAL_HIGH   1

◆ DIGITAL_INPUT

#define DIGITAL_INPUT   2

◆ DIGITAL_LOW

#define DIGITAL_LOW   0

◆ RXBUFFER_LENGTH

#define RXBUFFER_LENGTH   8

◆ TXBUFFER_LENGTH

#define TXBUFFER_LENGTH   8

Enumeration Type Documentation

◆ SW_DATA_SOURCE_t

Enumerator
SW_DATA_SOURCE_PIN_0 
SW_DATA_SOURCE_PIN_1 
SW_DATA_SOURCE_PIN_2 
SW_DATA_SOURCE_PIN_3 
SW_DATA_SOURCE_PIN_4 
SW_DATA_SOURCE_PIN_5 
SW_DATA_SOURCE_PIN_6 
SW_DATA_SOURCE_PIN_7 
SW_DATA_SOURCE_PIN_8 
SW_DATA_SOURCE_PIN_9 
SW_DATA_SOURCE_PIN_10 
SW_DATA_SOURCE_PIN_11 
SW_DATA_SOURCE_PIN_12 
SW_DATA_SOURCE_PIN_13 
SW_DATA_SOURCE_PIN_14 
SW_DATA_SOURCE_PIN_15 
SW_DATA_SOURCE_PIN_16 
SW_DATA_SOURCE_PIN_17 
SW_DATA_SOURCE_PIN_18 
SW_DATA_SOURCE_PIN_19 
SW_DATA_SOURCE_INCREMENTING_NUMBER 

An number that increments each time it is accessed.

SW_DATA_SOURCE_1024mvCounts 

The number of ADC counts that result from a 1.024V reading.

SW_DATA_SOURCE_FRAMES_RUN_LSW 

The number of frames run since reset, least significant 16 bits.

SW_DATA_SOURCE_FRAMES_RUN_MSW 

The number of frames run since reset, most significant 16 bits.

SW_DATA_SOURCE_OVERRUN_FRAMES 

The number of frames that ran more than 1mS.

SW_DATA_SOURCE_TEMPERATURE 

The internal core temperature expressed in 100ths deg C.

SW_DATA_SOURCE_PACKETS_RECEIVED 

The nubmer of incoming command packets that have been processed since reset (rolls over at 65535)

SW_DATA_SOURCE_ERRORS 

The number of incoming packets that have caused errors since reset (rolls over at 65535)

SW_DATA_SOURCE_FRAMES_DROPPED 

The number of times since reset that a frame ran so far behind that it crossed two subsequent 1ms boundaries, causing a permanent lost frame.

SW_DATA_SOURCE_SYSTEM_UTILIZATION 

A number between 0 and 65535 that scales to the average length of pin processing frames between 0 and 1000mS.

SW_DATA_SOURCE_VCC_mVOLTS 

The system source voltage in mV.

SW_DATA_SOURCE_VBG_COUNTS_VS_VREF 

A/D conversion of VBG against VRef . Used for mfg calibration.

SW_DATA_SOURCE_RESET_REGISTER 

Hardware dependent reset reason register contents.

SW_DATA_SOURCE_LFSR 

A Linear FeedBack Shift register (32,7,5,3,2,1) based pseudo-random number generator.

SW_DATA_SOURCE_PIN_0_MV 

The public data of Pin 0 expressed as mV. Only applicable to Analog Input mode.

SW_DATA_SOURCE_PIN_1_MV 

The public data of Pin 1 expressed as mV. Only applicable to Analog Input mode.

SW_DATA_SOURCE_PIN_2_MV 

The public data of Pin 2 expressed as mV. Only applicable to Analog Input mode.

SW_DATA_SOURCE_PIN_3_MV 

The public data of Pin 3 expressed as mV. Only applicable to Analog Input mode.

SW_DATA_SOURCE_PIN_4_MV 

The public data of Pin 4 expressed as mV. Only applicable to Analog Input mode.

SW_DATA_SOURCE_PIN_16_MV 

The public data of Pin 16 expressed as mV. Only applicable to Analog Input mode.

SW_DATA_SOURCE_PIN_17_MV 

The public data of Pin 17 expressed as mV. Only applicable to Analog Input mode.

SW_DATA_SOURCE_PIN_18_MV 

The public data of Pin 18 expressed as mV. Only applicable to Analog Input mode.

SW_DATA_SOURCE_PIN_19_MV 

The public data of Pin 19 expressed as mV. Only applicable to Analog Input mode.

SW_DATA_SOURCE_2HZ_SQUARE 

Square wave that alternates between 0 and 65535 every 256 frames.

SW_DATA_SOURCE_2HZ_SAW 

Sawtooth wave that goes from 0 to 65535 to 0 every 512 frames.

SW_DATA_SOURCE_1HZ_SQUARE 

Square wave that alternates between 0 and 65535 every 512 frames.

SW_DATA_SOURCE_1HZ_SAW 

Sawtooth wave that goes from 0 to 65535 to 0 every 1024 frames.

SW_DATA_SOURCE_2SEC_SQUARE 

Square wave that alternates between 0 and 65535 every 1024 frames.

SW_DATA_SOURCE_2SEC_SAW 

Sawtooth wave that goes from 0 to 65535 to 0 every 2048 frames.

SW_DATA_SOURCE_8SEC_SQUARE 

Square wave that alternates between 0 and 65535 every 4096 frames.

SW_DATA_SOURCE_8SEC_SAW 

Sawtooth wave that goes from 0 to 65535 to 0 every 8192 frames.

SW_DATA_SOURCE_65SEC_SQUARE 

Square wave that alternates between 0 and 65535 every 32768 frames.

SW_DATA_SOURCE_65SEC_SAW 

Sawtooth wave that goes from 0 to 65535 to 0 every 65536 frames.

Function Documentation

◆ ConfigurePinAnalog()

void ConfigurePinAnalog ( uint8_t  pin,
bool  makeAnalog 
)

◆ CurrentPinAnalog()

void CurrentPinAnalog ( void  )

◆ CurrentPinBitmap()

uint16_t CurrentPinBitmap ( void  )

◆ CurrentPinHigh()

void CurrentPinHigh ( void  )

◆ CurrentPinInput()

void CurrentPinInput ( void  )

◆ CurrentPinLow()

void CurrentPinLow ( void  )

◆ CurrentPinNoPullUp()

void CurrentPinNoPullUp ( void  )

◆ CurrentPinNoPullup()

void CurrentPinNoPullup ( void  )

◆ CurrentPinNotAnalog()

void CurrentPinNotAnalog ( void  )

◆ CurrentPinNotOpenDrain()

void CurrentPinNotOpenDrain ( void  )

◆ CurrentPinOpenDrain()

void CurrentPinOpenDrain ( void  )

◆ CurrentPinOutput()

void CurrentPinOutput ( void  )

◆ CurrentPinPort()

uint8_t CurrentPinPort ( void  )

◆ CurrentPinPullUp()

void CurrentPinPullUp ( void  )

◆ CurrentPinPullup()

void CurrentPinPullup ( void  )

◆ CurrentPinRead()

bool CurrentPinRead ( void  )

◆ error()

void error ( SW_ERROR_t  errorCode)

◆ PinHigh()

void PinHigh ( uint8_t  pin)

◆ PinInput()

void PinInput ( uint8_t  pin)

◆ PinLow()

void PinLow ( uint8_t  pin)

◆ PinNoPullUp()

void PinNoPullUp ( uint8_t  pin)

◆ PinOutput()

void PinOutput ( uint8_t  pin)

◆ PinPullUp()

void PinPullUp ( uint8_t  pin)

◆ ProcessPins()

void ProcessPins ( void  )

◆ ProcessRx()

void ProcessRx ( void  )

◆ ReadPin()

bool ReadPin ( uint8_t  pin)

◆ reset()

void reset ( void  )

◆ SetCurrentPin()

void SetCurrentPin ( uint8_t  pinState)

◆ SetPin()

void SetPin ( uint8_t  pin,
uint8_t  pinState 
)

Variable Documentation

◆ CurrentPin

uint8_t CurrentPin

◆ FramesRun

uint32_t FramesRun

◆ PinUpdateRegisters

pinRegister_t PinUpdateRegisters[NUMBER_OF_TOTAL_PINS]

◆ RunForeground

bool RunForeground

Generated Main Source File

Company: Microchip Technology Inc.

File Name: main.c

Summary: This is the main file generated using PIC10 / PIC12 / PIC16 / PIC18 MCUs

Description: This header file provides implementations for driver APIs for all modules selected in the GUI. Generation Information : Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.81.6 Device : PIC16F15214 Driver Version : 2.00

◆ Rxbuffer

uint8_t Rxbuffer[RXBUFFER_LENGTH]

A buffer for incoming commands from the host.

◆ Txbuffer

uint8_t Txbuffer[TXBUFFER_LENGTH]

A buffer for outgoing commands to the host.