1 // *********************************************************************
    2 //                     IQRF OS basic include file                      *
    3 // *********************************************************************
    4 //
    5 // Online IQRF OS Reference Guide: http://www.iqrf.org/IQRF-OS-Reference-guide/
    6 //
    7 // Copyright (c) MICRORISC s.r.o.
    8 //
    9 // Intended for:
   10 //   HW: TR-72D, TR-76D, TR-77D, TR-78D, TR-75D, TR-72G, TR-76G
   11 //   OS: 4.05D, 4.05G
   12 //
   13 // File:    IQRF.h
   14 // Version: v1.00                                   Revision: 10/06/2021
   15 //
   16 // Revision history:
   17 //   v1.00: 10/06/2021  First release for OS 4.05D and 4.05G.
   18 //
   19 // *********************************************************************
   20 
   21 #if IQRFOS != 405
   22     #error Invalid IQRF OS version, v4.05D or v4.05G is expected. Make sure matching header files and project IQRF OS version setting are used.
   23 #endif
   24 
   25 #if __CC5X__ < 3701
   26     #warning Insufficient CC5X compiler version, V3.7A or higher is recommended.
   27 #endif
   28 
   29 #define OS_VERSION 0x45
   30 
   31 #if defined TR72D
   32     #message Compilation for TR-72D modules (PIC16LF1938) and IQRF OS 4.05D.
   33     #define TR7xD
   34 #elif defined TR76D
   35     #message Compilation for TR-76D modules (PIC16LF1938) and IQRF OS 4.05D.
   36     #define TR7xD
   37 #elif defined TR77D
   38     #message Compilation for TR-77D modules (PIC16LF1938) and IQRF OS 4.05D.
   39     #define TR7xD
   40 #elif defined TR78D
   41     #message Compilation for TR-78D modules (PIC16LF1938) and IQRF OS 4.05D.
   42     #define TR7xD
   43 #elif defined TR75D
   44     #message Compilation for TR-75D modules (PIC16LF1938) and IQRF OS 4.05D.
   45     #define TR7xD
   46 #elif defined TR72G
   47     #message Compilation for TR-72G modules (PIC16LF18877) and IQRF OS 4.05G.
   48     #define TR7xG
   49 #elif defined TR76G
   50     #message Compilation for TR-76G modules (PIC16LF18877) and IQRF OS 4.05G.
   51     #define TR7xG
   52 #else
   53     #error Unsupported TR module type.
   54 #endif
   55 
   56 // TR-7xD
   57 #if defined TR7xD
   58     #pragma chip      PIC16F1938
   59     #define MCU_ID    4
   60 
   61     #define _ACKDT    ACKDT
   62     #define _ACKEN    ACKEN
   63     #define _ACKSTAT  ACKSTAT
   64     #define _BAUDCON  BAUDCON
   65     #define _EEADRH   EEADRH
   66     #define _EEADRL   EEADRL
   67     #define _EECON1   EECON1
   68     #define _EECON2   EECON2
   69     #define _EEDATH   EEDATH
   70     #define _EEDATL   EEDATL
   71     #define _PEN      PEN
   72     #define _PR6      PR6
   73     #define _RCEN     RCEN
   74     #define _RCREG    RCREG
   75     #define _RCSTA    RCSTA
   76     #define _RW_      RW_
   77     #define _SEN      SEN
   78     #define _SMP      SMP
   79     #define _SPBRGH   SPBRGH
   80     #define _SPBRGL   SPBRGL
   81     #define _SSPADD   SSPADD
   82     #define _SSPBUF   SSPBUF
   83     #define _SSPCON1  SSPCON1
   84     #define _SSPCON2  SSPCON2
   85     #define _SSPEN    SSPEN
   86     #define _SSPSTAT  SSPSTAT
   87     #define _SWDTEN   SWDTEN
   88     #define _T1SYNC_  T1SYNC_
   89     #define _TMR1ON   TMR1ON
   90     #define _TMR6     TMR6
   91     #define _TMR6ON   TMR6ON
   92     #define _TXREG    TXREG
   93     #define _TXSTA    TXSTA
   94     #define _WDTCON   WDTCON
   95 
   96 // TR-7xG
   97 #else
   98     #pragma chip      PIC16F18877
   99     #define MCU_ID    5
  100 
  101     #define _ACKDT    SSP1CON2.5
  102     #define _ACKEN    SSP1CON2.4
  103     #define _ACKSTAT  SSP1CON2.6
  104     #define _BAUDCON  BAUD1CON
  105     #define _EEADRH   NVMADRH
  106     #define _EEADRL   NVMADRL
  107     #define _EECON1   NVMCON1
  108     #define _EECON2   NVMCON2
  109     #define _EEDATH   NVMDATH
  110     #define _EEDATL   NVMDATL
  111     #define _PEN      SSP1CON2.2
  112     #define _PR6      T6PR
  113     #define _RCEN     SSP1CON2.3
  114     #define _RCREG    RC1REG
  115     #define _RCSTA    RC1STA
  116     #define _RW_      SSP1STAT.2
  117     #define _SEN      SSP1CON2.0
  118     #define _SMP      SSP1STAT.7
  119     #define _SPBRGH   SP1BRGH
  120     #define _SPBRGL   SP1BRGL
  121     #define _SSPADD   SSP1ADD
  122     #define _SSPBUF   SSP1BUF
  123     #define _SSPCON1  SSP1CON1
  124     #define _SSPCON2  SSP1CON2
  125     #define _SSPEN    SSP1CON1.5
  126     #define _SSPSTAT  SSP1STAT
  127     #define _SWDTEN   WDTCON0.0
  128     #define _T1SYNC_  T1CON.2
  129     #define _TMR1ON   T1CON.0
  130     #define _TMR6     T6TMR
  131     #define _TMR6ON   T6CON.7
  132     #define _TXREG    TX1REG
  133     #define _TXSTA    TX1STA
  134     #define _WDTCON   WDTCON0
  135 #endif
  136 
  137 #pragma origin 0x100
  138 #pragma update_RP 0
  139 
  140 void APPLICATION();
  141 
  142 void main()                                 // Skipped during Upload
  143 {
  144     APPLICATION();
  145 }
  146 
  147 #include "IQRF-memory.h"                    // Memory definitions
  148 #include "IQRF-functions.h"                 // Functions definitions
  149 #include "IQRF-macros.h"
  150 
  151 // *********************************************************************
  152