Tape write functions

#include "write.h"

Typedefs

typedef PulseConfig const *const PCP

Constant pulse config pointer.

Functions

void writeGap(FILE *const output, uint32_t *const size, int const n, PCP pulseConfig)

Write a gap of n short pulses.

Parameters:
  • output[out] Output file.

  • size[inout] Size of output.

  • n[in] Number of pulses.

  • pulseConfig[in] Pulse config.

void writeTapeMark(FILE *const output, uint32_t *const size, int const n, PCP pulseConfig)

Write a tape mark of n long pulses, n short pulses and one long pulse.

Parameters:
  • output[out] Output file.

  • size[inout] Size of output.

  • n[in] Number of pulses.

  • pulseConfig[in] Pulse config.

uint16_t writeByte(FILE *const output, uint32_t *const size, uint8_t const data, PCP pulseConfig)

Write a byte and count the number of ones for the checksum.

Parameters:
  • output[out] Output file.

  • size[inout] Size of output.

  • data[in] Data.

  • pulseConfig[in] Pulse config.

Returns:

Number of ones in data.

void writeChecksum(FILE *const output, uint32_t *const size, uint16_t const checksum, PCP pulseConfig)

Write a checksum.

Parameters:
  • output[out] Output file.

  • size[inout] Size of output.

  • checksum[in] Checksum.

  • pulseConfig[in] Pulse config.

struct Pulse

Public Members

uint16_t high

Pulse high count.

uint16_t low

Pulse low count.

struct PulseConfig

Public Members

Pulse longPulse

Long pulse.

Pulse shortPulse

Short pulse.

bool invert

Invert polarity.