PinguinoIDE / pinguino-libraries

Pinguino librairies, keywords and other useful files.
24 stars 27 forks source link

IR LIBRARY ERROR: 369: Undefined identifier 'T3_RUN_FROM_OSC' #15

Closed fcwpinguino closed 8 years ago

fcwpinguino commented 8 years ago

Regis, i have found an issue with the ir library. i am getting this error when compiling ERROR: 369: Undefined identifier 'T3_RUN_FROM_OSC'. this pde worked before i have tried on my other debian machine same error. i am using the irdimming.pde in the example folder , i am using pinguino ide 11

[DEBUG] Ending 'compile' [DEBUG] Time spent for 'verify': 0.29 s [DEBUG] Ending 'verify' [OUT] ERROR: 369: Undefined identifier 'T3_RUN_FROM_OSC' [OUT]

/dvpt/pinguino/git-copy/pinguino-compilers/sources/sdcc/src/pic16/main.c:701 setting interrupt vector addresses 0xc00 /usr/share/pinguino-11/p8/include/pinguino/libraries/IRremote.c:369: error 20: Undefined identifier 'T3_RUN_FROM_OSC' /usr/share/pinguino-11/p8/include/pinguino/libraries/IRremote.c:1021: warning 116: right shifting more than size of object changed to zero /usr/share/pinguino-11/p8/include/pinguino/libraries/IRremote.c:1135: warning 212: support for large long long literals is incomplete /usr/share/pinguino-11/p8/include/pinguino/libraries/IRremote.c:1135: warning 212: support for large long long literals is incomplete Processor: 18f4550 sdcc: Calling preprocessor... sdcc: sdcpp -nostdinc -Wall -DPINGUINO4550 -Dboot4 -DBOARD=\"PINGUINO4550\" -DPROC=\"18f4550\" -DBOOT_VER=4 -I/usr/share/pinguino-11/p8/include/pinguino/core -I/usr/share/pinguino-11/p8/include/pinguino/libraries -I/home/fred/.pinguino/examples/06.Sensors/IR_remote -D18f4550 -DSDCC_PIC18F4550 -DSTACK_MODEL_SMALL -obj-ext=.o -DSDCC_USE_NON_FREE -DSDCC_ALL_CALLEE_SAVES -DSDCC=3_5_0 -DSDCC_REVISION=9248 -DSDCC_pic16 -DSTDC_NO_COMPLEX -DSTDC_NO_THREADS -DSTDC_NO_ATOMICS -DSTDC_NO_VLA -isystem /usr/bin/../share/sdcc/include/pic16 -isystem /dvpt/pinguino/git-copy/pinguino-compilers/linux64/p8/share/sdcc/include/pic16 -isystem /usr/bin/../share/sdcc/include -isystem /dvpt/pinguino/git-copy/pinguino-compilers/linux64/p8/share/sdcc/include -isystem /usr/bin/../share/sdcc/non-free/include/pic16 -isystem /dvpt/pinguino/git-copy/pinguino-compilers/linux64/p8/share/sdcc/non-free/include/pic16 -isystem /usr/bin/../share/sdcc/non-free/include -isystem /dvpt/pinguino/git-copy/pinguino-compilers/linux64/p8/share/sdcc/non-free/include /home/fred/.pinguino/source/main.c sdcc: Generating code...

fcwpinguino commented 8 years ago

main.c /* ------------------------------------------------------------------------- FILE: main.c PROJECT: pinguino PURPOSE: application main function PROGRAMER: Jean-pierre Mandon - Régis Blanchot FIRST RELEASE: 19 Sep 2008 LAST RELEASE: 31 Jul 2013

CHANGELOG :
Originally based on a file by (c) 2006 Pierre Gaufillet pierre.gaufillet@magic.fr
19 Sep 2008 - Jean-pierre Mandon - adapted to Pinguino  
21 Apr 2012 - Régis Blanchot - added bootloader v4.x support
20 Jun 2012 - Régis Blanchot - added io.c support (remapping)
05 Feb 2013 - Régis Blanchot - added interrupt init
11 Feb 2013 - Régis Blanchot - removed call to crt0iPinguino.c
                               added reset_isr() instead
28 Feb 2013 - Régis Blanchot - added stack pointer initialization
----------------------------------------------------------------------------
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-------------------------------------------------------------------------*/

include

//#include //#include //#include

ifdef noboot

#define SPEED   1
#define CRYSTAL 20
// runtime start code with variable initialisation
//#include "crt0.c"
//#include "crt0i.c"
#include "config.h"

endif

ifdef boot4

// runtime start code
//#include "crt0.c"     // minimal  init.
//#include "crt0i.c"    // variable init.
#include "crt0iz.c"     // variable init. + clear variable

endif

////////////////////////////////////////////////////////////////////////

include "define.h"

////////////////////////////////////////////////////////////////////////

include // needs define.h to be included first

include // needs define.h to be included first

////////////////////////////////////////////////////////////////////////

include "user.c" // user's .pde file translated to C

////////////////////////////////////////////////////////////////////////

ifdef boot2

#if !defined(__18f2455) && !defined(__18f4455) && \
    !defined(__18f2550) && !defined(__18f4550)
    #error "********************************"
    #error "*** Wrong Bootloader Version ***"
    #error "***  Press F9 to change it.  ***"
    #error "********************************"

#endif

// 2013-07-31 - A. Gentric - fix usb.c
//#include <common_types.h>
//#include <boot_iface.h>

// only for compatibility with application_iface.o
#ifndef __USB__
    void epap_in()      { return; }
    void epap_out()     { return; }
    void epapin_init()  { return; }
    void epapout_init() { return; }
#endif

// Application entry point called from bootloader v2.12
void pinguino_main(void)

elif defined (noboot) || defined(boot4)

// Application entry point called from bootloader v4.x
void main(void)

endif

{

if defined(18f25k50) || defined(18f45k50) || \

    defined(__18f26j50) || defined(__18f46j50) || \
    defined(__18f26j53) || defined(__18f46j53) || \
    defined(__18f27j53) || defined(__18f47j53)
    u16 pll_startup_counter = 600;

#endif

/// ----------------------------------------------------------------
/// If we start from a Power-on reset, set NOT_POR bit to 1
/// ----------------------------------------------------------------

if (RCONbits.NOT_POR == 0)
{
    RCON |= 0b10010011;     // set all reset flag
                            // enable priority levels on interrupts
}

/// ----------------------------------------------------------------
/// Disables all interrupt
/// ----------------------------------------------------------------

//INTCONbits.GIEH     = 0;        // Disables all HP interrupts
//INTCONbits.GIEL     = 0;        // Disables all LP interrupts

/// ----------------------------------------------------------------
/// Perform a loop for some processors until their frequency is stable
/// ----------------------------------------------------------------

#if defined(__18f2455) || defined(__18f4455) || \
    defined(__18f2550) || defined(__18f4550)

    // If Internal Oscillator is used
    if (OSCCONbits.SCS > 0x01)
        // wait INTOSC frequency is stable (IOFS=1) 
        while (!OSCCONbits.IOFS);

    // PLL is enabled by Config. Bits

#elif defined(__18f25k50) || defined(__18f45k50)

    // If Internal Oscillator is used
    if (OSCCONbits.SCS > 0x01)
        // wait HFINTOSC frequency is stable (HFIOFS=1) 
        while (!OSCCONbits.HFIOFS);

    // Enable the PLL and wait 2+ms until the PLL locks
    OSCCON2bits.PLLEN = 1;
    OSCTUNEbits.SPLLMULT = 1;   // 1=3xPLL, 0=4xPLL
    while (pll_startup_counter--);

#elif defined(__18f26j50) || defined(__18f46j50)

    // If Internal Oscillator is used
    // if (OSCCONbits.SCS > 0x02)
    // Seems there is no time to wait

    // Enable the PLL and wait 2+ms until the PLL locks
    OSCTUNEbits.PLLEN = 1;
    while (pll_startup_counter--);

#elif defined(__18f26j53) || defined(__18f46j53) || \
      defined(__18f27j53) || defined(__18f47j53)

    // If Internal Oscillator is used
    if (OSCCONbits.SCS > 0x02)
        // wait INTOSC frequency is stable (FLTS=1) 
        while(!OSCCONbits.FLTS);

    // Enable the PLL and wait 2+ms until the PLL locks
    OSCTUNEbits.PLLEN = 1;
    while (pll_startup_counter--);

#endif

/// ----------------------------------------------------------------
/// I/O init 
/// ----------------------------------------------------------------

IO_init();
IO_digital();

#if defined(__18f26j50) || defined(__18f46j50) || \
    defined(__18f26j53) || defined(__18f46j53) || \
    defined(__18f27j53) || defined(__18f47j53)

IO_remap();

#endif

/// ----------------------------------------------------------------
/// Various Init.
/// ----------------------------------------------------------------

#ifdef __USB__
usb_init();
#endif

#ifdef __USBCDC
CDC_init();
#endif    

#ifdef __USBBULK
bulk_init();
#endif

#if defined(ANALOGREFERENCE) || defined(ANALOGREAD)
analog_init();
#endif

#ifdef ANALOGWRITE
analogwrite_init();
#endif

#ifdef __MILLIS__           // Use Timer 0
millis_init();
#endif

#ifdef __SPI__
spi_init();
#endif

#ifdef SERVOSLIBRARY        // Use Timer 1
servos_init();
#endif

#ifdef __PS2KEYB__
keyboard_init();
#endif

//////////////////////////////////////////////////////////////////////// setup(); ////////////////////////////////////////////////////////////////////////

#if defined(TMR0INT) || defined(TMR1INT) || \
    defined(TMR2INT) || defined(TMR3INT) || \
    defined(TMR4INT) || defined(TMR5INT) || \
    defined(TMR6INT) || defined(TMR8INT) 

IntTimerStart();        // Enable all defined timers interrupts
                        // at the same time
#endif

#ifdef ON_EVENT         // defined if interrupt.c is used

//IntInit();
INTCONbits.GIEH = 1;    // Enable global HP interrupts
INTCONbits.GIEL = 1;    // Enable global LP interrupts

#endif

while (1)
{

//////////////////////////////////////////////////////////////////////// loop(); //////////////////////////////////////////////////////////////////////// } }

if defined(USBCDC) || defined(USBBULK) || defined(USB) || \

 defined(USERINT)       || defined(INT0INT)     || defined(I2CINT)      || \
 defined(**SERIAL**)    || defined(ON_EVENT)    || defined(**MILLIS**)  || \
 defined(SERVOSLIBRARY) || defined(**PS2KEYB**) || defined(**DCF77**)   || \
 defined(**IRREMOTE**)  || defined(**AUDIO**)   || defined(**STEPPER**) || \
 defined(**CTMU**)      || defined(RTCCALARMINTENABLE)
 // || defined(**MICROSTEPPING**)

/* ---------------------------------------------------------------------------- High Interrupt Vector --------------------------------------------------------------------------*/

ifdef boot2

pragma code high_priority_isr 0x2020

endif

// boot4 : ENTRY + 0x08 // noboot: 0x08 void high_priority_isr(void) interrupt 1 { asm MOVFF _TBLPTRL, POSTDEC1 MOVFF _TBLPTRH, POSTDEC1 MOVFF _TBLPTRU, POSTDEC1 MOVFF _TABLAT, POSTDEC1 __endasm;

#ifdef __USBCDC
CDC_interrupt();
#endif

#if defined(__USBBULK)
bulk_interrupt();
#endif

#ifdef __USB__
usb_interrupt();
#endif

#ifdef __SERIAL__
serial_interrupt();
#endif

#ifdef __MILLIS__
millis_interrupt();
#endif

#ifdef I2CINT
I2C_interrupt();
#endif

#ifdef SERVOSLIBRARY
servos_interrupt();
#endif

#ifdef INT0INT
userhighinterrupt();
#endif

#ifdef __PS2KEYB__
keyboard_interrupt();
#endif

#ifdef __DCF77__
dcf77_interrupt();
#endif

#ifdef __IRREMOTE__
irremote_interrupt();
#endif

//#ifdef __MICROSTEPPING__
#ifdef __STEPPER__
stepper_interrupt();
#endif

#ifdef RTCCALARMINTENABLE
rtcc_interrupt();
#endif

#ifdef __AUDIO__
pwm_interrupt();
#endif

#ifdef __CTMU__
ctmu_interrupt();
#endif

__asm 
    MOVFF   PREINC1, _TABLAT
    MOVFF   PREINC1, _TBLPTRU
    MOVFF   PREINC1, _TBLPTRH
    MOVFF   PREINC1, _TBLPTRL
__endasm;

}

/* ---------------------------------------------------------------------------- Low Interrupt Vector --------------------------------------------------------------------------*/

ifdef boot2

pragma code low_priority_isr 0x4000

endif

// boot4 : ENTRY + 0x18 // noboot: 0x18 void low_priority_isr(void) __interrupt 2 {

__asm
    MOVFF   _TBLPTRL, POSTDEC1
    MOVFF   _TBLPTRH, POSTDEC1
    MOVFF   _TBLPTRU, POSTDEC1
    MOVFF   _TABLAT,  POSTDEC1
__endasm;

#ifdef USERINT
userinterrupt();
#endif

#ifdef ON_EVENT
userlowinterrupt();
#endif

__asm 
    MOVFF   PREINC1, _TABLAT
    MOVFF   PREINC1, _TBLPTRU
    MOVFF   PREINC1, _TBLPTRH
    MOVFF   PREINC1, _TBLPTRL
__endasm;

}

endif /* all interrupt */

/* ---------------------------------------------------------------------------- Reset Interrupt Vector --------------------------------------------------------------------------/ /

if defined (noboot) || defined(boot4)

// boot4 : ENTRY + 0x00 // noboot: 0x00 void reset_isr(void) naked interrupt 0 { // Call the Pinguino main routine. main(); }

endif

*/

fcwpinguino commented 8 years ago

define.h

define ANALOGWRITE

define IRRECV_BLINK13

define IRRECV_DECODE

define IRRECV_RESUME

define IRREMOTE

include

include

include

include

fcwpinguino commented 8 years ago

user.c

const int led = 11; int fadeValue; int lastCounter = 1; int counter;

int RECV_PIN = 1;

decode_results results;

void setup()

{
pinmode(led, OUTPUT); IRrecv_enableIRIn(RECV_PIN); IRrecv_blink13(true); }

void loop() { counter = lastCounter; if (IRrecv_decode(&results)) { if (results.value == 0x10 || results.value == 0x810){ counter ++; }

if (results.value == 0x11 || results.value == 0x811){ 
  counter --;
  }

IRrecv_resume(); }

if (counter > 20){
counter = 20; }

if (counter < 2){
counter = 1; }

switch (counter){

case 1: fadeValue = 00; break;

case 2: fadeValue = 250; break;

case 3: fadeValue = 500; break;

case 4: fadeValue = 750; break;

case 5: fadeValue = 1023; break;

}

analogwrite(led, fadeValue);

lastCounter = counter;
}

rblanchot commented 8 years ago

Hi Fred, T3_RUN_FROM_OSC has been renamed in T3_SOURCE_FOSC in interrupt.h to be coherent with the Datasheet and other timers bit names. Can you try with it and tell me if it's better. I'll try to answer quickly next time ;-)

fcwpinguino commented 8 years ago

regis, this seems to work. thank you fred

rblanchot commented 8 years ago

Cool. Once you're sure it works fine can you pull a request about the new irremote file in the pinguino-libraries section ? Thank you.

fcwpinguino commented 8 years ago

yes i will thanks again