add contiki combatibility
This commit is contained in:
parent
406d69a27c
commit
44d4f855c6
3 changed files with 17 additions and 8 deletions
|
@ -14,6 +14,7 @@
|
||||||
// Modified Record:
|
// Modified Record:
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
#include "RGBdriver.h"
|
#include "RGBdriver.h"
|
||||||
|
|
||||||
RGBdriver::RGBdriver(uint8_t Clk, uint8_t Data)
|
RGBdriver::RGBdriver(uint8_t Clk, uint8_t Data)
|
||||||
{
|
{
|
||||||
Clkpin = Clk;
|
Clkpin = Clk;
|
||||||
|
@ -34,21 +35,26 @@ void RGBdriver::end(void)
|
||||||
|
|
||||||
void RGBdriver::ClkRise(void)
|
void RGBdriver::ClkRise(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
digitalWrite(Clkpin, LOW);
|
digitalWrite(Clkpin, LOW);
|
||||||
delayMicroseconds(20);
|
delayMicroseconds(20);
|
||||||
digitalWrite(Clkpin, HIGH);
|
digitalWrite(Clkpin, HIGH);
|
||||||
delayMicroseconds(20);
|
delayMicroseconds(20);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RGBdriver::Send32Zero(void)
|
void RGBdriver::Send32Zero(void)
|
||||||
{
|
{
|
||||||
unsigned char i;
|
unsigned char i;
|
||||||
|
uint8_t volatile sreg;
|
||||||
|
sreg = SREG; /* Save status register before disabling interrupts. */
|
||||||
|
cli(); /* Disable interrupts. */
|
||||||
for (i=0; i<32; i++)
|
for (i=0; i<32; i++)
|
||||||
{
|
{
|
||||||
digitalWrite(Datapin, LOW);
|
digitalWrite(Datapin, LOW);
|
||||||
ClkRise();
|
ClkRise();
|
||||||
}
|
}
|
||||||
|
SREG = sreg; /* Enable interrupts. */
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t RGBdriver::TakeAntiCode(uint8_t dat)
|
uint8_t RGBdriver::TakeAntiCode(uint8_t dat)
|
||||||
|
@ -72,7 +78,9 @@ uint8_t RGBdriver::TakeAntiCode(uint8_t dat)
|
||||||
void RGBdriver::DatSend(uint32_t dx)
|
void RGBdriver::DatSend(uint32_t dx)
|
||||||
{
|
{
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
|
uint8_t volatile sreg;
|
||||||
|
sreg = SREG; /* Save status register before disabling interrupts. */
|
||||||
|
cli(); /* Disable interrupts. */
|
||||||
for (i=0; i<32; i++)
|
for (i=0; i<32; i++)
|
||||||
{
|
{
|
||||||
if ((dx & 0x80000000) != 0)
|
if ((dx & 0x80000000) != 0)
|
||||||
|
@ -87,6 +95,7 @@ void RGBdriver::DatSend(uint32_t dx)
|
||||||
dx <<= 1;
|
dx <<= 1;
|
||||||
ClkRise();
|
ClkRise();
|
||||||
}
|
}
|
||||||
|
SREG = sreg; /* Enable interrupts. */
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set color
|
// Set color
|
||||||
|
|
|
@ -39,8 +39,8 @@
|
||||||
#define SICSLOWPAN_CONF_FRAG 1
|
#define SICSLOWPAN_CONF_FRAG 1
|
||||||
|
|
||||||
/* For Debug: Dont allow MCU sleeping between channel checks */
|
/* For Debug: Dont allow MCU sleeping between channel checks */
|
||||||
//#undef RDC_CONF_MCU_SLEEP
|
#undef RDC_CONF_MCU_SLEEP
|
||||||
//#define RDC_CONF_MCU_SLEEP 0
|
#define RDC_CONF_MCU_SLEEP 0
|
||||||
|
|
||||||
/* Disabling RDC for demo purposes. Core updates often require more memory. */
|
/* Disabling RDC for demo purposes. Core updates often require more memory. */
|
||||||
/* For projects, optimize memory and enable RDC again. */
|
/* For projects, optimize memory and enable RDC again. */
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
|
|
||||||
#include "RGBdriver.h"
|
#include "RGBdriver.h"
|
||||||
|
|
||||||
#define CLK 2//pins definitions for the driver
|
#define CLK 3//pins definitions for the driver
|
||||||
#define DIO 3
|
#define DIO 14
|
||||||
RGBdriver Driver(CLK,DIO);
|
RGBdriver Driver(CLK,DIO);
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
Loading…
Add table
Reference in a new issue