-
Notifications
You must be signed in to change notification settings - Fork 7
TLI_ISR
gicking edited this page Feb 10, 2018
·
3 revisions
back to Command Reference / Interrupt
Implementation of top-level pin interrupt (TLI). Note that, in contrast to port interrupts, a TLI acts only per pin.
If TLI interrupt is enabled for a pin, interrupt service routine TLI_ISR()
is automatically called if the
selected edge is detected on the pin.
Generally only one pin of an STM8 is TLI interrupt capable. See respective device datasheet for details.
Notes:
- to enable the TLI interrupt, the respective pin has be configured as
INPUT_INTERRUPT
orINPUT_PULLUP_INTERRUPT
via pinMode() or portMode() - edge sensitivity is configured via configEdgeTLI()
- global interrupts must also be enabled, see interrupts()
- defined in
stm8_interrupt_vector.h
- auto-loaded in
main_general.h
- in
config.h
set#define USE_TLI_ISR
ISR_HANDLER(TLI_ISR, TLI_VECTOR)
-
input:
- none
-
output:
- none
- Nothing
The below code counts the number of falling edges on TLI pin PD7 (without debounce).
#include "main_general.h"
uint16_t count=0;
ISR_HANDLER(TLI_ISR, __TLI_VECTOR__)
{
count++;
}
void setup()
{
noInterrupts();
configEdgeTLI(FALLING);
pinMode(&PORT_D, 7, INPUT_PULLUP_INTERRUPT);
interrupts();
}
void loop()
{
// dummy
}
- before changing the edge sensitivity, globally disable interrupts via noInterrupts(). Re-enable them afterwards via interrupts().
- to use TLI the respective pin must also be configured as
INPUT_INTERRUPT
orINPUT_PULLUP_INTERRUPT
via pinMode() or portMode()
To avoid damage
- do not expose I/Os to voltages outside [-0.3V; Vdd+0.3V], else limit injection currents to the specificied limits
- for
OUTPUT
pins assert that sink and source currents are below the specificied limits - do not directly connect two
OUTPUT
pins. If e.g. half-duplex is required, use a pull-up andOUTPUT_OPENDRAIN
, instead
-
Getting Started
-
- General Commands
- Libraries
- LCD BTHQ21605V
- poti AD5280
- poti AD5282
- freemodbus
- PetitFS SD-card (min)
- FatFS: SD card (full)
- Board Specific
-
- Universal
- Board Specific