/*
 * File: Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_private.h
 *
 * Real-Time Workshop code generated for Simulink model Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct.
 *
 * Model version                        : 1.809
 * Real-Time Workshop file version      : 7.3  (R2009a)  15-Jan-2009
 * Real-Time Workshop file generated on : Tue Apr 13 23:03:43 2010
 * TLC version                          : 7.3 (Jan 18 2009)
 * C source code generated on           : Tue Apr 13 23:03:44 2010
 *--------------------------------------------------------------
 *   Embedded Coder for Microchip dsPIC family.                 |
 *   Generate .c and .h files from your Matlab/simulink model   |
 *   and compile the diagram to .hex and .coff file that can be |
 *   downloaded directly into the microcontroller               |
 *                                                              |
 * Licence Accorded to Ing. Robert Grepl, Ph.D.                 |
 *                     Technical University Brno                |
 *                                                              |
 *   Written by Lubin KERHUEL -  http://www.kerhuel.eu          |
 *  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
 *   Version 3.1                               26-Nov-2009      |
 *   For Matlab 7.8             R2009a                          |
 *--------------------------------------------------------------
 */

#ifndef RTW_HEADER_Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_private_h_
#define RTW_HEADER_Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_private_h_
#include "rtwtypes.h"

/* dsPIC library */
#include "p33fxxxx.h"
#include "timer.h"
#define fcy                            20000000

//initialization Block: <Root>/Output Compare HW
#include <outcompare.h>

/*initialization Block: <S7>/PWM Motor Output*/
#include "pwm12.h"
#define CALL_EVENT                     (MAX_uint8_T)
#ifndef UCHAR_MAX
#include <limits.h>
#endif

#if ( UCHAR_MAX != (0xFFU) ) || ( SCHAR_MAX != (0x7F) )
#error "Code was generated for compiler with different sized uchar/char. Consider adjusting Emulation Hardware word size settings on the Hardware Implementation pane to match your compiler word sizes as defined in the compiler's limits.h header file. Alternatively, you can select 'None' for Emulation Hardware and select the 'Enable portable word sizes' option for ERT based targets, which will disable the preprocessor word size checks."
#endif

#if ( USHRT_MAX != (0xFFFFU) ) || ( SHRT_MAX != (0x7FFF) )
#error "Code was generated for compiler with different sized ushort/short. Consider adjusting Emulation Hardware word size settings on the Hardware Implementation pane to match your compiler word sizes as defined in the compilers limits.h header file. Alternatively, you can select 'None' for Emulation Hardware and select the 'Enable portable word sizes' option for ERT based targets, this will disable the preprocessor word size checks."
#endif

#if ( UINT_MAX != (0xFFFFU) ) || ( INT_MAX != (0x7FFF) )
#error "Code was generated for compiler with different sized uint/int. Consider adjusting Emulation Hardware word size settings on the Hardware Implementation pane to match your compiler word sizes as defined in the compilers limits.h header file. Alternatively, you can select 'None' for Emulation Hardware and select the 'Enable portable word sizes' option for ERT based targets, this will disable the preprocessor word size checks."
#endif

#if ( ULONG_MAX != (0xFFFFFFFFUL) ) || ( LONG_MAX != (0x7FFFFFFFL) )
#error "Code was generated for compiler with different sized ulong/long. Consider adjusting Emulation Hardware word size settings on the Hardware Implementation pane to match your compiler word sizes as defined in the compilers limits.h header file. Alternatively, you can select 'None' for Emulation Hardware and select the 'Enable portable word sizes' option for ERT based targets, this will disable the preprocessor word size checks."
#endif

#define Tx_BUFF_SIZE_Uart1             32
#define Rx_BUFF_SIZE_Uart1             32
#ifndef __RTWTYPES_H__
#error This file requires rtwtypes.h to be included
#else
#ifdef TMWTYPES_PREVIOUSLY_INCLUDED
#error This file requires rtwtypes.h to be included before tmwtypes.h
#else

/* Check for inclusion of an incorrect version of rtwtypes.h */
#ifndef RTWTYPES_ID_C08S16I16L32N16F1
#error This code was generated with a different "rtwtypes.h" than the file included
#endif                                 /* RTWTYPES_ID_C08S16I16L32N16F1 */
#endif                                 /* TMWTYPES_PREVIOUSLY_INCLUDED */
#endif                                 /* __RTWTYPES_H__ */

#define _SPI1EN                        (SPI1STATbits.SPIEN)
#define _SPI2EN                        (SPI2STATbits.SPIEN)

extern volatile uint8_T TxPtrHaut_Uart1 ;
extern volatile uint8_T TxPtrBas_Uart1 ;
extern volatile uint8_T TxTab_Uart1[Tx_BUFF_SIZE_Uart1];
extern volatile uint8_T RxPtrHaut_Uart1 ;
extern volatile uint8_T RxPtrBas_Uart1 ;
extern volatile uint8_T RxTab_Uart1[Rx_BUFF_SIZE_Uart1];
extern volatile uint16_T ADCBuffChannelDMA[(2)] __attribute__((space(dma),
  aligned(256)));
extern uint8_T send232Buff_Uart1 (int16_T valeur, uint8_T cannal);
extern uint16_T GetQEI1();
extern uint16_T GetQEI2();
extern void ecan1_receive_matlab(uint32_T* y1);
extern void ecan1_transmit_matlab(uint16_T* u1);
extern void ecan1_init(uint16_T* u1);
extern void QEIInit();
void Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_step0(void);
void Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_step1(void);
void Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_step2(void);

#endif                                 /* RTW_HEADER_Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_private_h_ */

/* File trailer for Real-Time Workshop generated code.
 *
 * [EOF]
 */
