Esempio n. 1
0
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * 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.
 *
 */

#include "../../opentx.h"

extern uint16_t ppmStream[NUM_MODULES][20];
volatile uint32_t ppmStreamIndex[NUM_MODULES] = { MODULES_INIT(0) };  // Modified in interrupt routine
extern uint8_t pxxStream[NUM_MODULES][64]; // TODO not here, duplicated
extern uint8_t *pxxStreamPtr[NUM_MODULES];  // TODO not here, duplicated
extern uint8_t dsm2Stream[64];  // Likely more than we need
extern uint8_t *dsm2StreamPtr;

void module_output_active()
{
  register Pio *pioptr = PIOA ;
  pioptr->PIO_ABCDSR[0] &= ~PIO_PA17 ;            // Peripheral C
  pioptr->PIO_ABCDSR[1] |= PIO_PA17 ;             // Peripheral C
  pioptr->PIO_PDR = PIO_PA17 ;                    // Disable bit A17 Assign to peripheral
#if defined(REVX)
  pioptr->PIO_MDER = PIO_PA17 ;                   // Open Drain O/p in A17
  pioptr->PIO_PUER = PIO_PA17 ;                   // With pull up
#endif
Esempio n. 2
0
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * 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.
 *
 */

#include "../opentx.h"

#define PPM_STREAM_INIT  { 2000, 2200, 2400, 2600, 2800, 3000, 3200, 3400, 9000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
#if defined(PCBTARANIS)
  uint16_t ppmStream[NUM_MODULES+1][20]  = { PPM_STREAM_INIT, PPM_STREAM_INIT, PPM_STREAM_INIT };
#else
  uint16_t ppmStream[NUM_MODULES][20]  = { MODULES_INIT(PPM_STREAM_INIT) };
#endif

void setupPulsesPPM(unsigned int port)                   // Don't enable interrupts through here
{
  int16_t PPM_range = g_model.extendedLimits ? (512*LIMIT_EXT_PERCENT/100) * 2 : 512 * 2; //range of 0.7..1.7msec

  // Total frame length = 22.5msec
  // each pulse is 0.7..1.7ms long with a 0.3ms stop tail
  // The pulse ISR is 2mhz that's why everything is multiplied by 2

  uint32_t firstCh = g_model.moduleData[port].channelsStart;
  uint32_t lastCh = min<unsigned int>(NUM_CHNOUT, firstCh + 8 + g_model.moduleData[port].channelsCount);

#if defined(PCBSKY9X)
  // TODO move register stuff to driver