Skip to content

Commit

Permalink
Set up systefs/fastled headers for k26. Tweak some TEENSY3 define che…
Browse files Browse the repository at this point in the history
…cks to also check (or ignore) TEENSYLC
  • Loading branch information
focalintent committed Feb 4, 2015
1 parent 2f26e8b commit a317355
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 2 deletions.
8 changes: 7 additions & 1 deletion PORTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@

The heart of the FastLED library is the fast pin accesss. This is a templated class that provides 1-2 cycle pin access, bypassing digital write and other such things. As such, this will usually be the first bit of the library that you will want to port when moving to a new platform. Once you have FastPIN up and running then you can do some basic work like testing toggles or running bit-bang'd SPI output.

There's two low level FastPin classes. There's the base FastPIN template class, and then there is FastPinBB which is for bit-banded access on those MCUs that support bitbanding. Note that the bitband class is optional and primarily useful in the implementation of other functionality internal to the platform.
There's two low level FastPin classes. There's the base FastPIN template class, and then there is FastPinBB which is for bit-banded access on those MCUs that support bitbanding. Note that the bitband class is optional and primarily useful in the implementation of other functionality internal to the platform. This file is also where you would do the pin to port/bit mapping defines.

Explaining how the macros work and should be used is currently beyond the scope of this document.

== Porting fastspi.h ==

This is where you define the low level interface to the hardware SPI system (including a writePixels method that does a bunch of housekeeping for writing led data)
2 changes: 1 addition & 1 deletion fastspi.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SoftwareSPIOutput : public AVRSoftwareSPIOutput<_DATA_PIN, _CLOCK_PIN, _SP
#ifndef FASTLED_FORCE_SOFTWARE_SPI
#if defined(SPI_DATA) && defined(SPI_CLOCK)

#if defined(FASTLED_TEENSY3) && defined(CORE_TEENSY)
#if (defined(FASTLED_TEENSY3) || defined(FASTLED_TEENSYLC)) && defined(CORE_TEENSY)

template<uint8_t SPI_SPEED>
class SPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED> : public ARMHardwareSPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED, 0x4002C000> {};
Expand Down
10 changes: 10 additions & 0 deletions platforms/arm/k26/fastled_arm_k26.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef __INC_FASTLED_ARM_K26_H
#define __INC_FASTLED_ARM_K26_H

// Include the k20 headers
#include "delay.h"
#include "fastpin_arm_k26.h"
#include "fastspi_arm_k26.h"
#include "clockless_arm_k26.h"

#endif
37 changes: 37 additions & 0 deletions platforms/arm/k26/led_sysdefs_arm_k26.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#ifndef __INC_LED_SYSDEFS_ARM_K26_H
#define __INC_LED_SYSDEFS_ARM_K26_H

#define FASTLED_TEENSYLC
#define FASTLED_ARM

#ifndef INTERRUPT_THRESHOLD
#define INTERRUPT_THRESHOLD 1
#endif

// Default to allowing interrupts
#ifndef FASTLED_ALLOW_INTERRUPTS
#define FASTLED_ALLOW_INTERRUPTS 1
#endif

#if FASTLED_ALLOW_INTERRUPTS == 1
#define FASTLED_ACCURATE_CLOCK
#endif

#if (F_CPU == 96000000)
#define CLK_DBL 1
#endif

// Get some system include files
#include <avr/io.h>
#include <avr/interrupt.h> // for cli/se definitions

// Define the rgister types
#if defined(ARDUINO) // && ARDUINO < 150
typedef volatile uint8_t RoReg; /**< Read only 8-bit register (volatile const unsigned int) */
typedef volatile uint8_t RwReg; /**< Read-Write 8-bit register (volatile unsigned int) */
#endif

extern volatile uint32_t systick_millis_count;
# define MS_COUNTER systick_millis_count

#endif

0 comments on commit a317355

Please sign in to comment.