From aa276d72956b9c9938dd8d34529276d7f1631b93 Mon Sep 17 00:00:00 2001 From: ukw Date: Tue, 10 Nov 2015 08:43:54 +0000 Subject: [PATCH] Version 2.9.6: added support for STM8 mikrocontroller git-svn-id: svn://mikrocontroller.net/irmp@166 aeb2e35e-bfc4-4214-b83c-9e8de998ed28 --- irmp.c | 11 +++++++++-- irmp.h | 9 ++++++++- irmpconfig.h | 22 +++++++++++++++------- irmpsystem.h | 13 ++++++++++++- 4 files changed, 44 insertions(+), 11 deletions(-) diff --git a/irmp.c b/irmp.c index 8bf45dc..3ad1948 100644 --- a/irmp.c +++ b/irmp.c @@ -3,7 +3,7 @@ * * Copyright (c) 2009-2015 Frank Meyer - frank(at)fli4l.de * - * $Id: irmp.c,v 1.177 2015/09/19 15:28:31 fm Exp $ + * $Id: irmp.c,v 1.178 2015/11/10 08:39:27 fm Exp $ * * Supported AVR mikrocontrollers: * @@ -2013,6 +2013,9 @@ irmp_init (void) ROM_GPIOPadConfigSet(IRMP_PORT_BASE, IRMP_PORT_PIN, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); +#elif defined(__SDCC_stm8) // STM8 + IRMP_GPIO_STRUCT->CR1 |= (1<DDR &= ~(1<IDR) +#else irmp_input = input(IRMP_PIN); +#endif #if IRMP_USE_CALLBACK == 1 if (irmp_callback_ptr) @@ -3594,7 +3601,7 @@ irmp_ISR (void) else if (irmp_bit >= GRUNDIG_COMPLETE_DATA_LEN) { #ifdef ANALYZE - ANALYZE_PRINTF ("Switching to NOKIA protocol\n"); + ANALYZE_PRINTF ("Switching to NOKIA protocol, irmp_bit = %d\n", irmp_bit); #endif // ANALYZE irmp_param.protocol = IRMP_NOKIA_PROTOCOL; // change protocol irmp_param.address_offset = NOKIA_ADDRESS_OFFSET; diff --git a/irmp.h b/irmp.h index 76346ce..fd027b9 100644 --- a/irmp.h +++ b/irmp.h @@ -3,7 +3,7 @@ * * Copyright (c) 2009-2015 Frank Meyer - frank(at)fli4l.de * - * $Id: irmp.h,v 1.97 2015/09/19 15:28:31 fm Exp $ + * $Id: irmp.h,v 1.98 2015/11/10 08:39:27 fm Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -73,6 +73,13 @@ # define input(x) ((uint8_t)(ROM_GPIOPinRead(IRMP_PORT_BASE, IRMP_PORT_PIN))) # define sei() IntMasterEnable() +#elif defined(__SDCC_stm8) +# define _CONCAT(a,b) a##b +# define CONCAT(a,b) _CONCAT(a,b) +# define IRMP_GPIO_STRUCT CONCAT(GPIO, IRMP_PORT_LETTER) +# define IRMP_BIT IRMP_BIT_NUMBER +# define input(x) ((x) & (1 << IRMP_BIT)) + #endif #if IRMP_SUPPORT_TECHNICS_PROTOCOL == 1 diff --git a/irmpconfig.h b/irmpconfig.h index 5c18ddd..5ee1566 100644 --- a/irmpconfig.h +++ b/irmpconfig.h @@ -6,7 +6,7 @@ * Copyright (c) 2009-2015 Frank Meyer - frank(at)fli4l.de * Extensions for PIC 12F1820 W.Strobl 2014-07-20 * - * $Id: irmpconfig.h,v 1.136 2015/09/21 12:44:16 fm Exp $ + * $Id: irmpconfig.h,v 1.137 2015/11/10 08:39:28 fm Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -56,17 +56,17 @@ #define IRMP_SUPPORT_KASEIKYO_PROTOCOL 1 // Kaseikyo >= 10000 ~250 bytes // more protocols, enable here! Enable Remarks F_INTERRUPTS Program Space -#define IRMP_SUPPORT_JVC_PROTOCOL 0 // JVC >= 10000 ~150 bytes -#define IRMP_SUPPORT_NEC16_PROTOCOL 0 // NEC16 >= 10000 ~100 bytes -#define IRMP_SUPPORT_NEC42_PROTOCOL 0 // NEC42 >= 10000 ~300 bytes -#define IRMP_SUPPORT_MATSUSHITA_PROTOCOL 0 // Matsushita >= 10000 ~50 bytes +#define IRMP_SUPPORT_JVC_PROTOCOL 1 // JVC >= 10000 ~150 bytes +#define IRMP_SUPPORT_NEC16_PROTOCOL 1 // NEC16 >= 10000 ~100 bytes +#define IRMP_SUPPORT_NEC42_PROTOCOL 1 // NEC42 >= 10000 ~300 bytes +#define IRMP_SUPPORT_MATSUSHITA_PROTOCOL 1 // Matsushita >= 10000 ~50 bytes #define IRMP_SUPPORT_DENON_PROTOCOL 0 // DENON, Sharp >= 10000 ~250 bytes #define IRMP_SUPPORT_RC5_PROTOCOL 0 // RC5 >= 10000 ~250 bytes #define IRMP_SUPPORT_RC6_PROTOCOL 0 // RC6 & RC6A >= 10000 ~250 bytes #define IRMP_SUPPORT_IR60_PROTOCOL 0 // IR60 (SDA2008) >= 10000 ~300 bytes #define IRMP_SUPPORT_GRUNDIG_PROTOCOL 0 // Grundig >= 10000 ~300 bytes #define IRMP_SUPPORT_SIEMENS_PROTOCOL 0 // Siemens Gigaset >= 15000 ~550 bytes -#define IRMP_SUPPORT_NOKIA_PROTOCOL 0 // Nokia >= 10000 ~300 bytes +#define IRMP_SUPPORT_NOKIA_PROTOCOL 1 // Nokia >= 10000 ~300 bytes // exotic protocols, enable here! Enable Remarks F_INTERRUPTS Program Space #define IRMP_SUPPORT_BOSE_PROTOCOL 0 // BOSE >= 10000 ~150 bytes @@ -78,7 +78,7 @@ #define IRMP_SUPPORT_RECS80_PROTOCOL 0 // RECS80 (SAA3004) >= 15000 ~50 bytes #define IRMP_SUPPORT_RECS80EXT_PROTOCOL 0 // RECS80EXT (SAA3008) >= 15000 ~50 bytes #define IRMP_SUPPORT_THOMSON_PROTOCOL 0 // Thomson >= 10000 ~250 bytes -#define IRMP_SUPPORT_NIKON_PROTOCOL 0 // NIKON camera >= 10000 ~250 bytes +#define IRMP_SUPPORT_NIKON_PROTOCOL 1 // NIKON camera >= 10000 ~250 bytes #define IRMP_SUPPORT_NETBOX_PROTOCOL 0 // Netbox keyboard >= 10000 ~400 bytes (PROTOTYPE!) #define IRMP_SUPPORT_ORTEK_PROTOCOL 0 // ORTEK (Hama) >= 10000 ~150 bytes #define IRMP_SUPPORT_TELEFUNKEN_PROTOCOL 0 // Telefunken 1560 >= 10000 ~150 bytes @@ -140,6 +140,14 @@ # define IRMP_PORT_LETTER B # define IRMP_BIT_NUMBER 4 +/*--------------------------------------------------------------------------------------------------------------------------------------------------- + * Change hardware pin here for STM8 + *--------------------------------------------------------------------------------------------------------------------------------------------------- + */ +#elif defined (SDCC_STM8) // use PA1 as IR input on STM8 +# define IRMP_PORT_LETTER A +# define IRMP_BIT_NUMBER 1 + /*--------------------------------------------------------------------------------------------------------------------------------------------------- * Handling of unknown target system: DON'T CHANGE *--------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/irmpsystem.h b/irmpsystem.h index 41cd344..07e4ef1 100644 --- a/irmpsystem.h +++ b/irmpsystem.h @@ -3,7 +3,7 @@ * * Copyright (c) 2009-2015 Frank Meyer - frank(at)fli4l.de * - * $Id: irmpsystem.h,v 1.18 2015/05/18 10:51:07 fm Exp $ + * $Id: irmpsystem.h,v 1.19 2015/11/10 08:39:28 fm Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,6 +43,8 @@ # include # define ARM_STM32 # define ARM_STM32F4XX +#elif defined(__SDCC_stm8) // STM8 +# define SDCC_STM8 #elif defined(TARGET_IS_BLIZZARD_RA2) // TI Stellaris (tested on Stellaris Launchpad with Code Composer Studio) # define STELLARIS_ARM_CORTEX_M4 # define F_CPU (SysCtlClockGet()) @@ -116,6 +118,15 @@ typedef unsigned short uint16_t; # define PROGMEM # define memcpy_P memcpy +#elif defined(SDCC_STM8) + +# include "stm8s.h" +# define PROGMEM +# define memcpy_P memcpy +# define __attribute__(x) +# define uint_fast8_t uint8_t +# define uint_fast16_t uint16_t + #else # define PROGMEM -- 2.39.2