7 #pragma GCC diagnostic push 8 #pragma GCC diagnostic ignored "-Wall" 9 #pragma GCC diagnostic ignored "-Wextra" 11 #pragma pack(1) //only works on mega sad^^ 395 #ifndef EBOARD_HEADER_GUARD 396 #define EBOARD_HEADER_GUARD 403 #define EBOARD_I2C 0x1 408 #define EBOARD_LCD 0x1 412 #define EBOARD_SHIFT_REGISTER 0x1 416 #define EBOARD_BLUETOOTH 0x1 424 #define __AVR_ATmega2560__ 428 #define __AVR_ATmega328P__ 432 #define EBOARD_NEO 0x1 444 #include <avr/pgmspace.h> 451 #ifndef EBOARD_GUESSPATH 455 #define EBOARD_GUESSPATH 0x1 458 #if defined(ARDUINO) //general platform-check [No tab] 463 #define main eVirtual_main //main has a different meaning^^ 465 #if ARDUINO >= 100 //this could be only Arduino.h but this snippet is portable :D 471 #if not ( defined(__AVR_ATmega2560__) || defined(__AVR_ATmega328P__)) 472 #error "This library was build for ARDUINO UNO R3 Aand ARDUINO MEGA 2560!" 475 #if defined(__AVR_ATmega2560__) 479 #define PIN_MAX 0x32 //53 pins to address - 4 !!53 is SS 481 #define PIN_MAX 0xA // 13 Pins to address - 4 !!10 is SS 485 #include <avr/interrupt.h> 487 #if EBOARD_I2C > 0x0 && EBOARD_GUESSPATH > 0x0 491 #include <inttypes.h> 496 #define TWI_FREQ 100000L 499 #ifndef TWI_BUFFER_LENGTH 500 #define TWI_BUFFER_LENGTH 32 510 void twi_setAddress(uint8_t);
511 uint8_t twi_readFrom(uint8_t, uint8_t*, uint8_t, uint8_t);
512 uint8_t twi_writeTo(uint8_t, uint8_t*, uint8_t, uint8_t, uint8_t);
513 uint8_t twi_transmit(
const uint8_t*, uint8_t);
514 void twi_attachSlaveRxEvent(
void (*)(uint8_t*,
int) );
515 void twi_attachSlaveTxEvent(
void (*)(
void) );
516 void twi_reply(uint8_t);
518 void twi_releaseBus(
void);
522 #include <inttypes.h> 524 #include <avr/interrupt.h> 525 #include <compat/twi.h> 528 #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) 532 #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) 535 #include "pins_arduino.h" 537 static volatile uint8_t twi_state;
538 static volatile uint8_t twi_slarw;
539 static volatile uint8_t twi_sendStop;
540 static volatile uint8_t twi_inRepStart;
542 static void (*twi_onSlaveTransmit)(void);
543 static void (*twi_onSlaveReceive)(uint8_t*, int);
545 static uint8_t twi_masterBuffer[TWI_BUFFER_LENGTH];
546 static volatile uint8_t twi_masterBufferIndex;
547 static volatile uint8_t twi_masterBufferLength;
549 static uint8_t twi_txBuffer[TWI_BUFFER_LENGTH];
550 static volatile uint8_t twi_txBufferIndex;
551 static volatile uint8_t twi_txBufferLength;
553 static uint8_t twi_rxBuffer[TWI_BUFFER_LENGTH];
554 static volatile uint8_t twi_rxBufferIndex;
556 static volatile uint8_t twi_error;
558 void twi_init(
void) {
559 twi_state = TWI_READY;
561 twi_inRepStart =
false;
563 digitalWrite(SDA, 1);
564 digitalWrite(SCL, 1);
568 TWBR = ((F_CPU / TWI_FREQ) - 16) / 2;
570 TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA);
573 void twi_setAddress(uint8_t address) {
577 uint8_t twi_readFrom(uint8_t address, uint8_t* data, uint8_t length, uint8_t sendStop) {
580 if(TWI_BUFFER_LENGTH < length){
584 while(TWI_READY != twi_state){
588 twi_sendStop = sendStop;
592 twi_masterBufferIndex = 0;
593 twi_masterBufferLength = length-1;
595 twi_slarw |= address << 1;
597 if (
true == twi_inRepStart) {
598 twi_inRepStart =
false;
600 TWCR = _BV(TWINT) | _BV(TWEA) | _BV(TWEN) | _BV(TWIE);
603 TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA) | _BV(TWINT) | _BV(TWSTA);
605 while(TWI_MRX == twi_state){
609 if (twi_masterBufferIndex < length)
610 length = twi_masterBufferIndex;
612 for(i = 0; i < length; ++i){
613 data[i] = twi_masterBuffer[i];
619 uint8_t twi_writeTo(uint8_t address, uint8_t* data, uint8_t length, uint8_t wait, uint8_t sendStop)
623 if(TWI_BUFFER_LENGTH < length){
627 while(TWI_READY != twi_state){
631 twi_sendStop = sendStop;
634 twi_masterBufferIndex = 0;
635 twi_masterBufferLength = length;
637 for(i = 0; i < length; ++i){
638 twi_masterBuffer[i] = data[i];
641 twi_slarw = TW_WRITE;
642 twi_slarw |= address << 1;
644 if (
true == twi_inRepStart) {
645 twi_inRepStart =
false;
647 TWCR = _BV(TWINT) | _BV(TWEA) | _BV(TWEN) | _BV(TWIE);
650 TWCR = _BV(TWINT) | _BV(TWEA) | _BV(TWEN) | _BV(TWIE) | _BV(TWSTA);
652 while(wait && (TWI_MTX == twi_state)){
656 if (twi_error == 0xFF)
658 else if (twi_error == TW_MT_SLA_NACK)
660 else if (twi_error == TW_MT_DATA_NACK)
666 uint8_t twi_transmit(
const uint8_t* data, uint8_t length) {
669 if(TWI_BUFFER_LENGTH < length){
673 if(TWI_STX != twi_state){
677 twi_txBufferLength = length;
678 for(i = 0; i < length; ++i){
679 twi_txBuffer[i] = data[i];
685 void twi_attachSlaveRxEvent(
void (*
function)(uint8_t*,
int) ) {
686 twi_onSlaveReceive =
function;
689 void twi_attachSlaveTxEvent(
void (*
function)(
void) ) {
690 twi_onSlaveTransmit =
function;
693 void twi_reply(uint8_t ack) {
695 TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWINT) | _BV(TWEA);
697 TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWINT);
702 void twi_stop(
void) {
703 TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA) | _BV(TWINT) | _BV(TWSTO);
705 while(TWCR & _BV(TWSTO)){
709 twi_state = TWI_READY;
712 void twi_releaseBus(
void){
713 TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA) | _BV(TWINT);
714 twi_state = TWI_READY;
727 if(twi_masterBufferIndex < twi_masterBufferLength){
728 TWDR = twi_masterBuffer[twi_masterBufferIndex++];
734 twi_inRepStart =
true;
735 TWCR = _BV(TWINT) | _BV(TWSTA)| _BV(TWEN) ;
736 twi_state = TWI_READY;
741 twi_error = TW_MT_SLA_NACK;
744 case TW_MT_DATA_NACK:
745 twi_error = TW_MT_DATA_NACK;
749 twi_error = TW_MT_ARB_LOST;
754 twi_masterBuffer[twi_masterBufferIndex++] = TWDR;
756 if(twi_masterBufferIndex < twi_masterBufferLength){
762 case TW_MR_DATA_NACK:
763 twi_masterBuffer[twi_masterBufferIndex++] = TWDR;
767 twi_inRepStart =
true;
768 TWCR = _BV(TWINT) | _BV(TWSTA)| _BV(TWEN) ;
769 twi_state = TWI_READY;
776 case TW_SR_GCALL_ACK:
777 case TW_SR_ARB_LOST_SLA_ACK:
778 case TW_SR_ARB_LOST_GCALL_ACK:
780 twi_rxBufferIndex = 0;
784 case TW_SR_GCALL_DATA_ACK:
785 if(twi_rxBufferIndex < TWI_BUFFER_LENGTH){
786 twi_rxBuffer[twi_rxBufferIndex++] = TWDR;
793 if(twi_rxBufferIndex < TWI_BUFFER_LENGTH){
794 twi_rxBuffer[twi_rxBufferIndex] =
'\0';
797 twi_onSlaveReceive(twi_rxBuffer, twi_rxBufferIndex);
798 twi_rxBufferIndex = 0;
801 case TW_SR_DATA_NACK:
802 case TW_SR_GCALL_DATA_NACK:
806 case TW_ST_ARB_LOST_SLA_ACK:
808 twi_txBufferIndex = 0;
809 twi_txBufferLength = 0;
810 twi_onSlaveTransmit();
811 if(0 == twi_txBufferLength){
812 twi_txBufferLength = 1;
813 twi_txBuffer[0] = 0x00;
816 TWDR = twi_txBuffer[twi_txBufferIndex++];
817 if(twi_txBufferIndex < twi_txBufferLength){
823 case TW_ST_DATA_NACK:
824 case TW_ST_LAST_DATA:
826 twi_state = TWI_READY;
832 twi_error = TW_BUS_ERROR;
838 #include <inttypes.h> 841 #define BUFFER_LENGTH 32 859 class TwoWire :
public Stream {
904 void begin(uint8_t address);
910 inline void begin(
int address);
951 inline uint8_t
requestFrom(uint8_t address, uint8_t quantity);
959 uint8_t
requestFrom(uint8_t address , uint8_t quantity, uint8_t sendStop);
967 inline uint8_t
requestFrom(
int address,
int quantity);
976 inline uint8_t
requestFrom(
int address,
int quantity,
int sendStop);
985 virtual size_t write(uint8_t data);
993 virtual size_t write(
const uint8_t *data,
size_t quantity);
1004 virtual int read(
void);
1010 virtual int peek(
void);
1012 virtual void flush(
void);
1019 void onReceive(
void (*
function)(
int) );
1026 void onRequest(
void (*
function)(
void) );
1040 #include <inttypes.h> 1071 twi_setAddress(address);
1078 begin((uint8_t)address);
1085 uint8_t
read = twi_readFrom(address,
rxBuffer, quantity, sendStop);
1093 return requestFrom((uint8_t)address, (uint8_t)quantity, (uint8_t)
true);
1097 return requestFrom((uint8_t)address, (uint8_t)quantity, (uint8_t)
true);
1101 return requestFrom((uint8_t)address, (uint8_t)quantity, (uint8_t)sendStop);
1137 twi_transmit(&data, 1);
1144 for(
size_t i = 0; i < quantity; ++i) {
1148 twi_transmit(data, quantity);
1191 for(uint8_t i = 0; i < numBytes; ++i) {
1226 #ifndef EBOARD_USE_SPI 1227 #define EBOARD_USE_SPI 0x1 1229 #if EBOARD_USE_SPI > 0x0 1230 #define _SPI_H_INCLUDED 1235 #define SPI_CLOCK_DIV4 0x00 1236 #define SPI_CLOCK_DIV16 0x01 1238 #define SPI_CLOCK_DIV64 0x02 1240 #define SPI_CLOCK_DIV128 0x03 1242 #define SPI_CLOCK_DIV2 0x04 1244 #define SPI_CLOCK_DIV8 0x05 1246 #define SPI_CLOCK_DIV32 0x06 1250 #define SPI_MODE0 0x00 1251 #define SPI_MODE1 0x04 1253 #define SPI_MODE2 0x08 1255 #define SPI_MODE3 0x0C 1259 #define SPI_MODE_MASK 0x0C 1260 #define SPI_CLOCK_MASK 0x03 1262 #define SPI_2XCLOCK_MASK 0x01 1284 inline static byte
transfer(byte _data);
1296 static void begin(
void);
1300 inline static void end(
void);
1321 while (!(SPSR & _BV(SPIF)));
1330 digitalWrite(SS, HIGH);
1331 pinMode(SS, OUTPUT);
1334 pinMode(SCK, OUTPUT);
1335 pinMode(MOSI, OUTPUT);
1341 if(bitOrder == LSBFIRST) SPCR |= _BV(DORD);
1342 else SPCR &= ~(_BV(DORD));
1356 #if (EBOARD_I2C > 0x0) && (EBOARD_LCD > 0x0) 1357 #include <avr/pgmspace.h> 1365 static bool STOP =
false;
1379 #ifndef EBOARD_DEBUG_MODE 1380 #define EBOARD_DEBUG_MODE 0x1 1387 #define EBOARD_NANO 0x0 1392 #ifndef EBOARD_CHECK_PINS 1393 #define EBOARD_CHECK_PINS 0x1 1396 #ifndef EBOARD_SHIFT_REGISTER 1400 #define EBOARD_SHIFT_REGISTER 0x0 1406 #ifndef EBOARD_CHECK_PINS_PWM 1407 #define EBOARD_CHECK_PINS_PWM 0x1 1413 #ifndef EBOARD_DEBUG_SPEED 1414 #define EBOARD_DEBUG_SPEED 9600 1419 #ifndef EBOARD_SPI_SERVO_MAX 1420 #define EBOARD_SPI_SERVO_MAX 2 1425 #ifndef EBOARD_USE_UTILITY 1426 #define EBOARD_USE_UTILITY 0x1 1431 #define EBOARD_COPY_AND_PASTE 0x1 1435 #ifndef EBOARD_PWM_SPE 1436 #define EBOARD_PWM_SPE 1 1443 #define EBOARD_I2C 0x0 //disabled by default 1446 #ifndef EBOARD_BLUETOOTH 1450 #define EBOARD_BLUETOOTH 0x0 1455 #ifndef EBOARD_CLAMP 1456 #define EBOARD_CLAMP 0x1 1464 #define EBOARD_NEO 0x0 1471 #ifndef EBOARD_USE_RESET 1472 #define EBOARD_USE_RESET 0x1 1475 #if EBOARD_USE_RESET > 0x0 1476 #include <avr/wdt.h> 1482 #ifndef PIN_BLUETOOTH_STATE 1483 #if defined(__AVR_ATmega2560__) 1484 #define PIN_BLUETOOTH_STATE 0x13 // 19 1486 #define PIN_BLUETOOTH_STATE 0x2 1493 #ifndef PIN_BLUETOOTH_RX 1494 #if defined(__AVR_ATmega2560__) 1495 #define PIN_BLUETOOTH_RX 0x13 // 19 1497 #define PIN_BLUETOOTH_RX 0x2 1504 #ifndef PIN_BLUETOOTH_TX 1505 #if defined(__AVR_ATmega2560__) 1506 #define PIN_BLUETOOTH_TX 0x12 // 18 1508 #define PIN_BLUETOOTH_TX 0x3 1515 #ifndef PIN_MOTOR_DIR 1516 #define PIN_MOTOR_DIR 0x4 1522 #ifndef PIN_MOTOR_SPE 1523 #define PIN_MOTOR_SPE 0x5 1529 #ifndef PIN_SHIFT_CLK 1530 #define PIN_SHIFT_CLK 0x6 1535 #ifndef PIN_SHIFT_DAT 1536 #define PIN_SHIFT_DAT 0x7 1541 #ifndef PIN_SHIFT_LAT 1542 #define PIN_SHIFT_LAT 0x8 1555 #if (EBOARD_BLUETOOTH > 0x0) && defined(__AVR_ATmega328P__) 1556 #if EBOARD_GUESSPATH > 0x0 1566 #define _SS_MAX_RX_BUFF 64 // RX buffer size 1568 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) 1643 void setTX(uint8_t transmitPin);
1648 void setRX(uint8_t receivePin);
1653 static inline void tunedDelay(uint16_t delay);
1663 SoftwareSerial(uint8_t receivePin, uint8_t transmitPin,
bool inverse_logic =
false);
1685 void begin(
long speed);
1692 inline void end(
void);
1714 virtual size_t write(uint8_t byte);
1719 virtual int read(
void);
1728 virtual void flush(
void);
1755 #if EBOARD_DEBUG_MODE > 0x0 1757 #define _DEBUG_PIN1 11 1758 #define _DEBUG_PIN2 13 1760 typedef struct _DELAY_TABLE {
1762 unsigned short rx_delay_centering;
1763 unsigned short rx_delay_intrabit;
1764 unsigned short rx_delay_stopbit;
1765 unsigned short tx_delay;
1768 #if F_CPU == 16000000 1770 static const DELAY_TABLE PROGMEM table[] = {
1772 { 115200, 1, 17, 17, 12, },
1773 { 57600, 10, 37, 37, 33, },
1774 { 38400, 25, 57, 57, 54, },
1775 { 31250, 31, 70, 70, 68, },
1776 { 28800, 34, 77, 77, 74, },
1777 { 19200, 54, 117, 117, 114, },
1778 { 14400, 74, 156, 156, 153, },
1779 { 9600, 114, 236, 236, 233, },
1780 { 4800, 233, 474, 474, 471, },
1781 { 2400, 471, 950, 950, 947, },
1782 { 1200, 947, 1902, 1902, 1899, },
1783 { 600, 1902, 3804, 3804, 3800, },
1784 { 300, 3804, 7617, 7617, 7614, },
1787 const int XMIT_START_ADJUSTMENT = 5;
1789 #elif F_CPU == 8000000 1791 static const DELAY_TABLE table[] PROGMEM = {
1793 { 115200, 1, 5, 5, 3, },
1794 { 57600, 1, 15, 15, 13, },
1795 { 38400, 2, 25, 26, 23, },
1796 { 31250, 7, 32, 33, 29, },
1797 { 28800, 11, 35, 35, 32, },
1798 { 19200, 20, 55, 55, 52, },
1799 { 14400, 30, 75, 75, 72, },
1800 { 9600, 50, 114, 114, 112, },
1801 { 4800, 110, 233, 233, 230, },
1802 { 2400, 229, 472, 472, 469, },
1803 { 1200, 467, 948, 948, 945, },
1804 { 600, 948, 1895, 1895, 1890, },
1805 { 300, 1895, 3805, 3805, 3802, },
1808 const int XMIT_START_ADJUSTMENT = 4;
1810 #elif F_CPU == 20000000 1812 static const DELAY_TABLE PROGMEM table[] = {
1814 { 115200, 3, 21, 21, 18, },
1815 { 57600, 20, 43, 43, 41, },
1816 { 38400, 37, 73, 73, 70, },
1817 { 31250, 45, 89, 89, 88, },
1818 { 28800, 46, 98, 98, 95, },
1819 { 19200, 71, 148, 148, 145, },
1820 { 14400, 96, 197, 197, 194, },
1821 { 9600, 146, 297, 297, 294, },
1822 { 4800, 296, 595, 595, 592, },
1823 { 2400, 592, 1189, 1189, 1186, },
1824 { 1200, 1187, 2379, 2379, 2376, },
1825 { 600, 2379, 4759, 4759, 4755, },
1826 { 300, 4759, 9523, 9523, 9520, },
1829 const int XMIT_START_ADJUSTMENT = 6;
1832 #error This version of SoftwareSerial supports only 20, 16 and 8MHz processors 1839 #if EBOARD_DEBUG_MODE > 0x0 1840 inline void DebugPulse(uint8_t pin, uint8_t count) {
1842 volatile uint8_t *pport = portOutputRegister(digitalPinToPort(pin));
1844 uint8_t val = *pport;
1847 *pport = val | digitalPinToBitMask(pin);
1856 asm volatile(
"sbiw %0, 0x01 \n\t" 1858 "cpi %A0, 0xFF \n\t" 1861 :
"+r" (delay),
"+a" (tmp)
1870 uint8_t oldSREG = SREG;
1883 #if GCC_VERSION < 40302 1901 #if EBOARD_DEBUG_MODE > 0x0 1902 DebugPulse(_DEBUG_PIN2, 1);
1905 for (uint8_t i=0x1; i; i <<= 1)
1908 #if EBOARD_DEBUG_MODE > 0x0 1909 DebugPulse(_DEBUG_PIN2, 1);
1920 #if EBOARD_DEBUG_MODE > 0x0 1921 DebugPulse(_DEBUG_PIN2, 1);
1931 #if EBOARD_DEBUG_MODE > 0x0 1932 #if _DEBUG // for scope: pulse pin as overflow indictator 1933 DebugPulse(_DEBUG_PIN1, 1);
1940 #if GCC_VERSION < 40302 1955 if (pin_state == LOW)
1971 #if defined(PCINT0_vect) 1977 #if defined(PCINT1_vect) 1983 #if defined(PCINT2_vect) 1989 #if defined(PCINT3_vect) 1996 _rx_delay_centering(0),
1997 _rx_delay_intrabit(0),
1998 _rx_delay_stopbit(0),
2000 _buffer_overflow(false),
2001 _inverse_logic(inverse_logic) {
2006 SoftwareSerial::~SoftwareSerial() {
2011 pinMode(tx, OUTPUT);
2012 digitalWrite(tx, HIGH);
2014 uint8_t port = digitalPinToPort(tx);
2021 digitalWrite(rx, HIGH);
2024 uint8_t port = digitalPinToPort(rx);
2031 for (
unsigned i=0; i<
sizeof(table)/
sizeof(table[0]); ++i) {
2032 long baud = pgm_read_dword(&table[i].baud);
2033 if (baud == speed) {
2037 _tx_delay = pgm_read_word(&table[i].tx_delay);
2051 pinMode(_DEBUG_PIN1, OUTPUT);
2052 pinMode(_DEBUG_PIN2, OUTPUT);
2089 uint8_t oldSREG = SREG;
2096 for (byte mask = 0x01; mask; mask <<= 1) {
2108 for (byte mask = 0x01; mask; mask <<= 1) {
2129 uint8_t oldSREG = SREG;
2154 #if EBOARD_DEBUG_MODE > 0x0 2158 #define __ASSERT_USE_STDERR 2177 void __assert (
const char *__func,
const char *__file,
optVAL_t __lineno,
const char *__sexp);
2179 void __assert (
const char *__func,
const char *__file,
optVAL_t __lineno,
const char *__sexp){
2180 Serial.print(
"Error with: "); Serial.print(__func);
2181 Serial.print(
" in "); Serial.print(__file);
2182 Serial.print(
" @"); Serial.println(__lineno, DEC);
2183 Serial.print(
" >>");
2184 Serial.println(__sexp);
2185 if(strcmp(__func,
"checkIdx")==0){
2186 Serial.println(
" This happens if an out of bounds exception");
2187 Serial.println(
" has occured. Following pins shouldn't be used:");
2190 Serial.println(
" : Used for Bluetooth communication");
2191 Serial.print(
" D");Serial.print(
PIN_MOTOR_DIR);Serial.print(
"&");
2193 Serial.println(
" : Used for main motor control");
2194 #if EBOARD_USE_SPI > 0x0 2195 Serial.print(
" D10-13");
2196 Serial.println(
": Used for smart-servo-shield");
2198 }
else if (strcmp(__func,
"readPin")==0){
2199 Serial.println(
"You've tried to access an analogPin that isn't present on the board you're currently working on!");
2216 #if EBOARD_DEBUG_MODE > 0x0 2217 assert(idx>=0x0 && idx <
PIN_MAX);
2223 #if EBOARD_COPY_AND_PASTE > 0x0 2224 #if EBOARD_CHECK_PINS_PWM > 0x0 2235 for (count = 0; x; count++)
2242 #if EBOARD_CHECK_PINS > 0x0 2248 #if defined(__AVR_ATmega328P__) && not defined(__AVR_ATmega2560__) 2250 #elif defined(__AVR_ATmega2560__) 2256 #if defined(__AVR_ATmega328P__) && not defined(__AVR_ATmega2560__) 2258 #elif defined(__AVR_ATmega2560__) 2275 return (mode == OUTPUT)? ((
pin_out & (1<<idx))>0x0):((
pin_in & (1<<idx))>0x0);
2288 #if EBOARD_CHECK_PINS > 0x0 2304 #if EBOARD_BLUETOOTH > 0x0 2313 inline char readVal(
char oF =
'.');
2326 template <
typename T>
2327 inline void writeVal(
const T& val);
2343 #if (EBOARD_BLUETOOTH > 0x0) && (((PIN_BLUETOOTH_RX==0x13) && (PIN_BLUETOOTH_TX==0x12)) && defined(__AVR_ATmega2560__)) 2349 inline char readVal(
char oF) {
2350 #if (EBOARD_BLUETOOTH > 0x0) && (((PIN_BLUETOOTH_RX==0x13) && (PIN_BLUETOOTH_TX==0x12)) && defined(__AVR_ATmega2560__)) 2351 return ((Serial1.available())?(Serial1.read()):(oF));
2356 template<
typename T>
2357 inline void writeVal(
const T& val){
2358 #if (EBOARD_BLUETOOTH > 0x0) && (((PIN_BLUETOOTH_RX==0x13) && (PIN_BLUETOOTH_TX==0x12)) && defined(__AVR_ATmega2560__)) 2365 #if PIN_BLUETOOTH_RX != PIN_BLUETOOTH_STATE 2374 #if EBOARD_SHIFT_REGISTER > 0x0 2422 val = min(val,0xFF); val = max(0x0,val);
2427 extern void rept_task(
void);
2430 ISR(TIMER1_COMPA_vect) {
2453 #if EBOARD_SHIFT_REGISTER > 0x0 2460 #if EBOARD_CHECK_PINS > 0x0 2464 #if EBOARD_COPY_AND_PASTE > 0x0 2467 pinMode(idx,OUTPUT);
2469 digitalWrite(idx,val);
2485 #if EBOARD_CHECK_PINS > 0x0 2487 #if defined (__AVR_ATmega2560__) 2488 else if (idx<0||idx>0xF){
2490 else if (idx<0||idx>0x7){
2492 #if EBOARD_DEBUG_MODE > 0x0 2499 #if EBOARD_COPY_AND_PASTE > 0x0 2504 return((dig)? digitalRead(idx) : analogRead(idx));
2508 #if EBOARD_USE_SPI > 0x0 && (EBOARD_NANO == 0x0) 2544 #if defined(__AVR_ATmega2560__) 2642 this->velocity_temp = 0x96;
2643 this->upperLimit_temp = 0x12C;
2646 void ServoCds55::begin() {
2647 pinMode(this->
cs,OUTPUT);
2648 digitalWrite(this->
cs,HIGH);
2655 delayMicroseconds (20);
2669 digitalWrite(this->
cs, LOW);
2673 digitalWrite(this->
cs, HIGH);
2678 digitalWrite(this->
cs, LOW);
2682 digitalWrite(this->
cs, HIGH);
2687 digitalWrite(this->
cs, LOW);
2691 digitalWrite(this->
cs, HIGH);
2696 digitalWrite(this->
cs, LOW);
2699 digitalWrite(this->
cs, HIGH);
2704 digitalWrite(this->
cs, LOW);
2707 digitalWrite(this->
cs, HIGH);
2716 #if EBOARD_COPY_AND_PASTE > 0x0 && EBOARD_NANO == 0 2749 #if EBOARD_USE_UTILITY > 0x0 or defined(__AVR_ATmega2560__) //won't shrink space... just speed things up 2758 inline void led(
int idx,
bool state);
2766 inline void ledOn(
int idx);
2774 inline void ledOff(
int idx);
2780 inline void ledsOff(
void);
2786 inline void ledMeter(
int);
2789 #if EBOARD_USE_UTILITY > 0x0 2790 inline void button(
int);
2793 inline void waitForButton(
int);
2805 inline void motor(uint8_t
id,int16_t val);
2807 inline void motorsOff(
void);
2822 inline void power(
optVAL_t id,
bool state);
2848 inline void sleep(uint16_t t);
2854 inline void msleep(uint16_t t);
2872 inline void reset(
void);
2877 #if defined(__AVR_ATmega2560__) 2883 #elif EBOARD_USE_UTILITY > 0x0 2891 #if EBOARD_USE_UTILITY > 0x0 2898 else if(
id>0&&
id<3&&(val>-0 && val < 1024)) {
_servoHandler.
write((
id-1),(val *600/1023 - 300));}
2903 #if EBOARD_USE_RESET > 0x0 2904 wdt_enable(WDTO_15MS);
2920 #define DIGITAL_IN 0x0 2921 #define DIGITAL_IN_INV 0x1 2923 #define DIGITAL_IN_PULLUP 0x2 2925 #define DIGITAL_IN_PULLUP_INV 0x3 2927 #define DIGITAL_OUT 0x4 2929 #define DIGITAL_OUT_INV 0x5 2931 #define DIGITAL_OUT_LOW 0x6 2933 #define DIGITAL_OUT_HIGH 0x7 2935 #define ANALOG_IN_8_BIT 0x8 2937 #define ANALOG_IN_10_BIT 0x9 2939 #define ANALOG_IN_MEAN_8_BIT 0xA 2941 #define ANALOG_IN_MEAN_10_BIT 0xB 2943 #define COUNTER_8_BIT 0xC 2945 #define COUNTER_16_BIT 0xD 2947 #define COUNTER_RISE_8_BIT 0xE 2949 #define COUNTER_RISE_16_BIT 0xF 2951 #define PWM_SLOW 0x8 2953 #define PWM_FAST 0x9 2955 #define FREQ_LOW 0xA 2957 #define FREQ_HIGH 0xB 2959 #define COUNTER_B_DIR 0xC 2961 #define COUNTER_B_DIR_PULLUP 0xD 2963 #define COUNTER_MEAN_8_BIT 0xE 2965 #define COUNTER_MEAN_16_BIT 0xF 3000 #if EBOARD_USE_UTILITY > 0x0 3001 inline void read(
void);
3004 inline void changeAddress(
optVAL_t);
3012 inline void write(
void);
3024 this->A=0x0;this->B=0x0;this->C=0x0;
3026 #if EBOARD_USE_UTILITY > 0x0 3080 #if EBOARD_USE_UTILITY > 0x0 3097 inline void changeMotorID(
optVAL_t newID);
3103 inline void setPositionMode(
void);
3109 inline void setSpeedMode(
void);
3117 inline void ledOff(
void);
3119 inline void ledOn(
void);
3121 inline void setTorque(uint16_t);
3131 void setPosition(
int pos,
int speed=0x3FF);
3139 inline void storePosition(
int pos,
int speed = 0x3FF);
3153 inline bool isMoving(
void);
3181 #if EBOARD_USE_UTILITY > 0x0 3194 #if EBOARD_CLAMP > 0x0 3195 if(pos>1023 || speed > 1023)
return;
3196 this->actPos=pos; this->storedPos=pos; this->storedSpe = speed;
3197 speed = speed*600/1023 - 300;
3198 pos = pos *600/1023 - 300;
3201 if(pos>300 || speed > 300)
return;
3202 this->actPos=pos; this->storedPos=pos; this->storedSpe = speed;
3208 return this->actPos;
3242 #if EBOARD_USE_UTILITY > 0x0 3246 inline void changeMotorID(
optVAL_t);
3252 inline void action(
void);
3270 #if EBOARD_USE_UTILITY > 0x0 3278 if(this->connected[i] != NULL)
3295 #if EBOARD_BLUETOOTH > 0x0 3343 inline void write(
const char*
const val);
3361 #if EBOARD_I2C > 0x0 3407 for (byte i = 1; (i < 255 && !
STOP); i++) {
3411 if(count < ret_len) ret[count] = i;
3449 #if EBOARD_LCD > 0x0 3452 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
3453 {0x00,0x00,0x5F,0x00,0x00,0x00,0x00,0x00},
3454 {0x00,0x00,0x07,0x00,0x07,0x00,0x00,0x00},
3455 {0x00,0x14,0x7F,0x14,0x7F,0x14,0x00,0x00},
3456 {0x00,0x24,0x2A,0x7F,0x2A,0x12,0x00,0x00},
3457 {0x00,0x23,0x13,0x08,0x64,0x62,0x00,0x00},
3458 {0x00,0x36,0x49,0x55,0x22,0x50,0x00,0x00},
3459 {0x00,0x00,0x05,0x03,0x00,0x00,0x00,0x00},
3460 {0x00,0x1C,0x22,0x41,0x00,0x00,0x00,0x00},
3461 {0x00,0x41,0x22,0x1C,0x00,0x00,0x00,0x00},
3462 {0x00,0x08,0x2A,0x1C,0x2A,0x08,0x00,0x00},
3463 {0x00,0x08,0x08,0x3E,0x08,0x08,0x00,0x00},
3464 {0x00,0xA0,0x60,0x00,0x00,0x00,0x00,0x00},
3465 {0x00,0x08,0x08,0x08,0x08,0x08,0x00,0x00},
3466 {0x00,0x60,0x60,0x00,0x00,0x00,0x00,0x00},
3467 {0x00,0x20,0x10,0x08,0x04,0x02,0x00,0x00},
3468 {0x00,0x3E,0x51,0x49,0x45,0x3E,0x00,0x00},
3469 {0x00,0x00,0x42,0x7F,0x40,0x00,0x00,0x00},
3470 {0x00,0x62,0x51,0x49,0x49,0x46,0x00,0x00},
3471 {0x00,0x22,0x41,0x49,0x49,0x36,0x00,0x00},
3472 {0x00,0x18,0x14,0x12,0x7F,0x10,0x00,0x00},
3473 {0x00,0x27,0x45,0x45,0x45,0x39,0x00,0x00},
3474 {0x00,0x3C,0x4A,0x49,0x49,0x30,0x00,0x00},
3475 {0x00,0x01,0x71,0x09,0x05,0x03,0x00,0x00},
3476 {0x00,0x36,0x49,0x49,0x49,0x36,0x00,0x00},
3477 {0x00,0x06,0x49,0x49,0x29,0x1E,0x00,0x00},
3478 {0x00,0x00,0x36,0x36,0x00,0x00,0x00,0x00},
3479 {0x00,0x00,0xAC,0x6C,0x00,0x00,0x00,0x00},
3480 {0x00,0x08,0x14,0x22,0x41,0x00,0x00,0x00},
3481 {0x00,0x14,0x14,0x14,0x14,0x14,0x00,0x00},
3482 {0x00,0x41,0x22,0x14,0x08,0x00,0x00,0x00},
3483 {0x00,0x02,0x01,0x51,0x09,0x06,0x00,0x00},
3484 {0x00,0x32,0x49,0x79,0x41,0x3E,0x00,0x00},
3485 {0x00,0x7E,0x09,0x09,0x09,0x7E,0x00,0x00},
3486 {0x00,0x7F,0x49,0x49,0x49,0x36,0x00,0x00},
3487 {0x00,0x3E,0x41,0x41,0x41,0x22,0x00,0x00},
3488 {0x00,0x7F,0x41,0x41,0x22,0x1C,0x00,0x00},
3489 {0x00,0x7F,0x49,0x49,0x49,0x41,0x00,0x00},
3490 {0x00,0x7F,0x09,0x09,0x09,0x01,0x00,0x00},
3491 {0x00,0x3E,0x41,0x41,0x51,0x72,0x00,0x00},
3492 {0x00,0x7F,0x08,0x08,0x08,0x7F,0x00,0x00},
3493 {0x00,0x41,0x7F,0x41,0x00,0x00,0x00,0x00},
3494 {0x00,0x20,0x40,0x41,0x3F,0x01,0x00,0x00},
3495 {0x00,0x7F,0x08,0x14,0x22,0x41,0x00,0x00},
3496 {0x00,0x7F,0x40,0x40,0x40,0x40,0x00,0x00},
3497 {0x00,0x7F,0x02,0x0C,0x02,0x7F,0x00,0x00},
3498 {0x00,0x7F,0x04,0x08,0x10,0x7F,0x00,0x00},
3499 {0x00,0x3E,0x41,0x41,0x41,0x3E,0x00,0x00},
3500 {0x00,0x7F,0x09,0x09,0x09,0x06,0x00,0x00},
3501 {0x00,0x3E,0x41,0x51,0x21,0x5E,0x00,0x00},
3502 {0x00,0x7F,0x09,0x19,0x29,0x46,0x00,0x00},
3503 {0x00,0x26,0x49,0x49,0x49,0x32,0x00,0x00},
3504 {0x00,0x01,0x01,0x7F,0x01,0x01,0x00,0x00},
3505 {0x00,0x3F,0x40,0x40,0x40,0x3F,0x00,0x00},
3506 {0x00,0x1F,0x20,0x40,0x20,0x1F,0x00,0x00},
3507 {0x00,0x3F,0x40,0x38,0x40,0x3F,0x00,0x00},
3508 {0x00,0x63,0x14,0x08,0x14,0x63,0x00,0x00},
3509 {0x00,0x03,0x04,0x78,0x04,0x03,0x00,0x00},
3510 {0x00,0x61,0x51,0x49,0x45,0x43,0x00,0x00},
3511 {0x00,0x7F,0x41,0x41,0x00,0x00,0x00,0x00},
3512 {0x00,0x02,0x04,0x08,0x10,0x20,0x00,0x00},
3513 {0x00,0x41,0x41,0x7F,0x00,0x00,0x00,0x00},
3514 {0x00,0x04,0x02,0x01,0x02,0x04,0x00,0x00},
3515 {0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00},
3516 {0x00,0x01,0x02,0x04,0x00,0x00,0x00,0x00},
3517 {0x00,0x20,0x54,0x54,0x54,0x78,0x00,0x00},
3518 {0x00,0x7F,0x48,0x44,0x44,0x38,0x00,0x00},
3519 {0x00,0x38,0x44,0x44,0x28,0x00,0x00,0x00},
3520 {0x00,0x38,0x44,0x44,0x48,0x7F,0x00,0x00},
3521 {0x00,0x38,0x54,0x54,0x54,0x18,0x00,0x00},
3522 {0x00,0x08,0x7E,0x09,0x02,0x00,0x00,0x00},
3523 {0x00,0x18,0xA4,0xA4,0xA4,0x7C,0x00,0x00},
3524 {0x00,0x7F,0x08,0x04,0x04,0x78,0x00,0x00},
3525 {0x00,0x00,0x7D,0x00,0x00,0x00,0x00,0x00},
3526 {0x00,0x80,0x84,0x7D,0x00,0x00,0x00,0x00},
3527 {0x00,0x7F,0x10,0x28,0x44,0x00,0x00,0x00},
3528 {0x00,0x41,0x7F,0x40,0x00,0x00,0x00,0x00},
3529 {0x00,0x7C,0x04,0x18,0x04,0x78,0x00,0x00},
3530 {0x00,0x7C,0x08,0x04,0x7C,0x00,0x00,0x00},
3531 {0x00,0x38,0x44,0x44,0x38,0x00,0x00,0x00},
3532 {0x00,0xFC,0x24,0x24,0x18,0x00,0x00,0x00},
3533 {0x00,0x18,0x24,0x24,0xFC,0x00,0x00,0x00},
3534 {0x00,0x00,0x7C,0x08,0x04,0x00,0x00,0x00},
3535 {0x00,0x48,0x54,0x54,0x24,0x00,0x00,0x00},
3536 {0x00,0x04,0x7F,0x44,0x00,0x00,0x00,0x00},
3537 {0x00,0x3C,0x40,0x40,0x7C,0x00,0x00,0x00},
3538 {0x00,0x1C,0x20,0x40,0x20,0x1C,0x00,0x00},
3539 {0x00,0x3C,0x40,0x30,0x40,0x3C,0x00,0x00},
3540 {0x00,0x44,0x28,0x10,0x28,0x44,0x00,0x00},
3541 {0x00,0x1C,0xA0,0xA0,0x7C,0x00,0x00,0x00},
3542 {0x00,0x44,0x64,0x54,0x4C,0x44,0x00,0x00},
3543 {0x00,0x08,0x36,0x41,0x00,0x00,0x00,0x00},
3544 {0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00},
3545 {0x00,0x41,0x36,0x08,0x00,0x00,0x00,0x00},
3546 {0x00,0x02,0x01,0x01,0x02,0x01,0x00,0x00},
3547 {0x00,0x02,0x05,0x05,0x02,0x00,0x00,0x00}
3812 #define LCD_COMMAND_MODE 0x80 3813 #define LCD_DATA_MODE 0x40 3815 #define LCD_COMMAND_DISPLAY_OFF 0xAE 3817 #define LCD_COMMAND_DISPLAY_ON 0xAF 3819 #define LCD_COMMAND_BLACK_BACKGROUND 0xA6 3821 #define LCD_COMMAND_WHITE_BACKGROUND 0xA7 3823 #define LCD_COMMAND_SET_BRIGHTNESS 0x81 3825 #define LCD_PAGE_ADDRESSING 0x02 3827 #define LCD_HORIZONTAL_ADDRESSING 0x00 3831 #define LCD_COMMAND_CHARGE_PUMP_SETTING 0x8d 3832 #define LCD_COMMAND_CHARGE_PUMP_ENABLE 0x14 3836 #define LCD_WIDTH 128 3840 #define LCD_HEIGHT 64 3887 #if EBOARD_NANO == 0 3925 inline bool clear(
void);
3931 inline void print(
const char* data);
3937 inline void print(
int data);
3982 inline bool reset(
void);
3997 inline bool init(
void);
4007 inline void drawBitmap(
const unsigned char *bitmap, byte posX, byte posY, byte hiX, byte hiY);
4029 inline bool setCursor(byte posX = 0x0, byte posY = 0x0);
4090 #if EBOARD_NANO == 0x0 4105 return this->
init();
4109 for(byte i = 0; i < 8; i++){
4113 for (byte j = 0; j < 128; j++) {
4134 if(data[i] < 32 || data[i] > 127){ i++;
continue;}
4135 for (byte j = 0; j < 8; j++){
4142 char buffer[11] =
"";
4143 itoa(data,buffer,10);
4144 this->
print(line,col,buffer);
4153 return this->
clear();
4170 return this->
clear();
4173 inline void LCD::drawBitmap(
const unsigned char *bitmap, byte posX, byte posY, byte hiX, byte hiY){
4177 for(
int i = 0x0; i < (hiX * 8 * hiY); i++){
4178 this->
s1Dat(pgm_read_byte(&bitmap[i]));
4179 if(++col == (hiX * 8)) {
4192 this->
s2Cmd((0x00 + (8 *posX & 0x0F)),(0x10 + ((8 * posX >> 4) & 0x0F)));
4195 this->
pX = posX; this->
pY = posY;
4201 this->
s2Cmd(0x81,val);
4232 #if EBOARD_NEO > 0x0 4237 #define EBOARD_NEO_RGB ((0 << 6) | (0 << 4) | (1 << 2) | (2)) 4238 #define EBOARD_NEO_RBG ((0 << 6) | (0 << 4) | (2 << 2) | (1)) 4240 #define EBOARD_NEO_GRB ((1 << 6) | (1 << 4) | (0 << 2) | (2)) 4242 #define EBOARD_NEO_GBR ((2 << 6) | (2 << 4) | (0 << 2) | (1)) 4244 #define EBOARD_NEO_BRG ((1 << 6) | (1 << 4) | (2 << 2) | (0)) 4246 #define EBOARD_NEO_BGR ((2 << 6) | (2 << 4) | (1 << 2) | (0)) 4252 #define EBOARD_NEO_WRGB ((0 << 6) | (1 << 4) | (2 << 2) | (3)) 4253 #define EBOARD_NEO_WRBG ((0 << 6) | (1 << 4) | (3 << 2) | (2)) 4255 #define EBOARD_NEO_WGRB ((0 << 6) | (2 << 4) | (1 << 2) | (3)) 4257 #define EBOARD_NEO_WGBR ((0 << 6) | (3 << 4) | (1 << 2) | (2)) 4259 #define EBOARD_NEO_WBRG ((0 << 6) | (2 << 4) | (3 << 2) | (1)) 4261 #define EBOARD_NEO_WBGR ((0 << 6) | (3 << 4) | (2 << 2) | (1)) 4263 #define EBOARD_NEO_RWGB ((1 << 6) | (0 << 4) | (2 << 2) | (3)) 4265 #define EBOARD_NEO_RWBG ((1 << 6) | (0 << 4) | (3 << 2) | (2)) 4267 #define EBOARD_NEO_RGWB ((2 << 6) | (0 << 4) | (1 << 2) | (3)) 4269 #define EBOARD_NEO_RGBW ((3 << 6) | (0 << 4) | (1 << 2) | (2)) 4271 #define EBOARD_NEO_RBWG ((2 << 6) | (0 << 4) | (3 << 2) | (1)) 4273 #define EBOARD_NEO_RBGW ((3 << 6) | (0 << 4) | (2 << 2) | (1)) 4275 #define EBOARD_NEO_GWRB ((1 << 6) | (2 << 4) | (0 << 2) | (3)) 4277 #define EBOARD_NEO_GWBR ((1 << 6) | (3 << 4) | (0 << 2) | (2)) 4279 #define EBOARD_NEO_GRWB ((2 << 6) | (1 << 4) | (0 << 2) | (3)) 4281 #define EBOARD_NEO_GRBW ((3 << 6) | (1 << 4) | (0 << 2) | (2)) 4283 #define EBOARD_NEO_GBWR ((2 << 6) | (3 << 4) | (0 << 2) | (1)) 4285 #define EBOARD_NEO_GBRW ((3 << 6) | (2 << 4) | (0 << 2) | (1)) 4287 #define EBOARD_NEO_BWRG ((1 << 6) | (2 << 4) | (3 << 2) | (0)) 4289 #define EBOARD_NEO_BWGR ((1 << 6) | (3 << 4) | (2 << 2) | (0)) 4291 #define EBOARD_NEO_BRWG ((2 << 6) | (1 << 4) | (3 << 2) | (0)) 4293 #define EBOARD_NEO_BRGW ((3 << 6) | (1 << 4) | (2 << 2) | (0)) 4295 #define EBOARD_NEO_BGWR ((2 << 6) | (3 << 4) | (1 << 2) | (0)) 4297 #define EBOARD_NEO_BGRW ((3 << 6) | (2 << 4) | (1 << 2) | (0)) 4302 #define EBOARD_NEO_800KHZ 0x0000 4303 #define EBOARD_NEO_400KHZ 0x0100 4373 void setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b);
4382 void setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b, uint8_t w);
4423 uint8_t
sine8(uint8_t x)
const;
4429 uint8_t
gamma8(uint8_t x)
const;
4434 inline int8_t
getPin(
void);
4446 static inline uint32_t
Color(uint8_t r, uint8_t g, uint8_t b);
4454 static inline uint32_t
Color(uint8_t r, uint8_t g, uint8_t b, uint8_t w);
4493 #ifdef __AVR__ //not needed (rem?) 4494 volatile uint8_t *
port;
4506 begun(false), brightness(0), pixels(NULL), endTime(0) {
4516 begun(false), numLEDs(0), numBytes(0), pin(-1), brightness(0), pixels(NULL),
4517 rOffset(1), gOffset(0), bOffset(2), wOffset(1), endTime(0)
4522 if(
pin >= 0) pinMode(
pin, INPUT);
4527 pinMode(
pin, OUTPUT);
4528 digitalWrite(
pin, LOW);
4552 is800KHz = (t < 256);
4560 #if defined(ESP8266) 4562 extern "C" void ICACHE_RAM_ATTR espShow(
4563 uint8_t pin, uint8_t *pixels, uint32_t numBytes, uint8_t type);
4564 #elif defined(ESP32) 4565 extern "C" void espShow(
4566 uint8_t pin, uint8_t *pixels, uint32_t numBytes, uint8_t type);
4583 #if (F_CPU >= 7400000UL) && (F_CPU <= 9500000UL) 4586 volatile uint8_t n1, n2 = 0;
4589 #if defined(PORTB) || defined(PORTC) || defined(PORTF) 4590 if(
port == &PORTD) {
4596 if(b & 0x80) n1 = hi;
4601 "out %[port] , %[hi]" "\n\t" 4602 "mov %[n2] , %[lo]" "\n\t" 4603 "out %[port] , %[n1]" "\n\t" 4605 "sbrc %[byte] , 6" "\n\t" 4606 "mov %[n2] , %[hi]" "\n\t" 4607 "out %[port] , %[lo]" "\n\t" 4610 "out %[port] , %[hi]" "\n\t" 4611 "mov %[n1] , %[lo]" "\n\t" 4612 "out %[port] , %[n2]" "\n\t" 4614 "sbrc %[byte] , 5" "\n\t" 4615 "mov %[n1] , %[hi]" "\n\t" 4616 "out %[port] , %[lo]" "\n\t" 4619 "out %[port] , %[hi]" "\n\t" 4620 "mov %[n2] , %[lo]" "\n\t" 4621 "out %[port] , %[n1]" "\n\t" 4623 "sbrc %[byte] , 4" "\n\t" 4624 "mov %[n2] , %[hi]" "\n\t" 4625 "out %[port] , %[lo]" "\n\t" 4628 "out %[port] , %[hi]" "\n\t" 4629 "mov %[n1] , %[lo]" "\n\t" 4630 "out %[port] , %[n2]" "\n\t" 4632 "sbrc %[byte] , 3" "\n\t" 4633 "mov %[n1] , %[hi]" "\n\t" 4634 "out %[port] , %[lo]" "\n\t" 4637 "out %[port] , %[hi]" "\n\t" 4638 "mov %[n2] , %[lo]" "\n\t" 4639 "out %[port] , %[n1]" "\n\t" 4641 "sbrc %[byte] , 2" "\n\t" 4642 "mov %[n2] , %[hi]" "\n\t" 4643 "out %[port] , %[lo]" "\n\t" 4646 "out %[port] , %[hi]" "\n\t" 4647 "mov %[n1] , %[lo]" "\n\t" 4648 "out %[port] , %[n2]" "\n\t" 4650 "sbrc %[byte] , 1" "\n\t" 4651 "mov %[n1] , %[hi]" "\n\t" 4652 "out %[port] , %[lo]" "\n\t" 4655 "out %[port] , %[hi]" "\n\t" 4656 "mov %[n2] , %[lo]" "\n\t" 4657 "out %[port] , %[n1]" "\n\t" 4659 "sbrc %[byte] , 0" "\n\t" 4660 "mov %[n2] , %[hi]" "\n\t" 4661 "out %[port] , %[lo]" "\n\t" 4662 "sbiw %[count], 1" "\n\t" 4664 "out %[port] , %[hi]" "\n\t" 4665 "mov %[n1] , %[lo]" "\n\t" 4666 "out %[port] , %[n2]" "\n\t" 4667 "ld %[byte] , %a[ptr]+" "\n\t" 4668 "sbrc %[byte] , 7" "\n\t" 4669 "mov %[n1] , %[hi]" "\n\t" 4670 "out %[port] , %[lo]" "\n\t" 4676 : [
port]
"I" (_SFR_IO_ADDR(PORTD)),
4681 #if defined(PORTB) || defined(PORTC) || defined(PORTF) 4686 #if defined(PORTD) || defined(PORTC) || defined(PORTF) 4687 if(
port == &PORTB) {
4688 #endif // defined(PORTD/C/F) 4692 if(b & 0x80) n1 = hi;
4696 "out %[port] , %[hi]" "\n\t" 4697 "mov %[n2] , %[lo]" "\n\t" 4698 "out %[port] , %[n1]" "\n\t" 4700 "sbrc %[byte] , 6" "\n\t" 4701 "mov %[n2] , %[hi]" "\n\t" 4702 "out %[port] , %[lo]" "\n\t" 4704 "out %[port] , %[hi]" "\n\t" 4705 "mov %[n1] , %[lo]" "\n\t" 4706 "out %[port] , %[n2]" "\n\t" 4708 "sbrc %[byte] , 5" "\n\t" 4709 "mov %[n1] , %[hi]" "\n\t" 4710 "out %[port] , %[lo]" "\n\t" 4712 "out %[port] , %[hi]" "\n\t" 4713 "mov %[n2] , %[lo]" "\n\t" 4714 "out %[port] , %[n1]" "\n\t" 4716 "sbrc %[byte] , 4" "\n\t" 4717 "mov %[n2] , %[hi]" "\n\t" 4718 "out %[port] , %[lo]" "\n\t" 4720 "out %[port] , %[hi]" "\n\t" 4721 "mov %[n1] , %[lo]" "\n\t" 4722 "out %[port] , %[n2]" "\n\t" 4724 "sbrc %[byte] , 3" "\n\t" 4725 "mov %[n1] , %[hi]" "\n\t" 4726 "out %[port] , %[lo]" "\n\t" 4728 "out %[port] , %[hi]" "\n\t" 4729 "mov %[n2] , %[lo]" "\n\t" 4730 "out %[port] , %[n1]" "\n\t" 4732 "sbrc %[byte] , 2" "\n\t" 4733 "mov %[n2] , %[hi]" "\n\t" 4734 "out %[port] , %[lo]" "\n\t" 4736 "out %[port] , %[hi]" "\n\t" 4737 "mov %[n1] , %[lo]" "\n\t" 4738 "out %[port] , %[n2]" "\n\t" 4740 "sbrc %[byte] , 1" "\n\t" 4741 "mov %[n1] , %[hi]" "\n\t" 4742 "out %[port] , %[lo]" "\n\t" 4744 "out %[port] , %[hi]" "\n\t" 4745 "mov %[n2] , %[lo]" "\n\t" 4746 "out %[port] , %[n1]" "\n\t" 4748 "sbrc %[byte] , 0" "\n\t" 4749 "mov %[n2] , %[hi]" "\n\t" 4750 "out %[port] , %[lo]" "\n\t" 4751 "sbiw %[count], 1" "\n\t" 4752 "out %[port] , %[hi]" "\n\t" 4753 "mov %[n1] , %[lo]" "\n\t" 4754 "out %[port] , %[n2]" "\n\t" 4755 "ld %[byte] , %a[ptr]+" "\n\t" 4756 "sbrc %[byte] , 7" "\n\t" 4757 "mov %[n1] , %[hi]" "\n\t" 4758 "out %[port] , %[lo]" "\n\t" 4760 : [byte]
"+r" (b), [n1]
"+r" (n1), [n2]
"+r" (n2), [count]
"+w" (i)
4761 : [
port]
"I" (_SFR_IO_ADDR(PORTB)), [ptr]
"e" (ptr), [hi]
"r" (hi),
4764 #if defined(PORTD) || defined(PORTC) || defined(PORTF) 4767 #if defined(PORTC) || defined(PORTF) 4773 #if defined(PORTD) || defined(PORTB) || defined(PORTF) 4774 if(
port == &PORTC) {
4780 if(b & 0x80) n1 = hi;
4784 "out %[port] , %[hi]" "\n\t" 4785 "mov %[n2] , %[lo]" "\n\t" 4786 "out %[port] , %[n1]" "\n\t" 4788 "sbrc %[byte] , 6" "\n\t" 4789 "mov %[n2] , %[hi]" "\n\t" 4790 "out %[port] , %[lo]" "\n\t" 4792 "out %[port] , %[hi]" "\n\t" 4793 "mov %[n1] , %[lo]" "\n\t" 4794 "out %[port] , %[n2]" "\n\t" 4796 "sbrc %[byte] , 5" "\n\t" 4797 "mov %[n1] , %[hi]" "\n\t" 4798 "out %[port] , %[lo]" "\n\t" 4800 "out %[port] , %[hi]" "\n\t" 4801 "mov %[n2] , %[lo]" "\n\t" 4802 "out %[port] , %[n1]" "\n\t" 4804 "sbrc %[byte] , 4" "\n\t" 4805 "mov %[n2] , %[hi]" "\n\t" 4806 "out %[port] , %[lo]" "\n\t" 4808 "out %[port] , %[hi]" "\n\t" 4809 "mov %[n1] , %[lo]" "\n\t" 4810 "out %[port] , %[n2]" "\n\t" 4812 "sbrc %[byte] , 3" "\n\t" 4813 "mov %[n1] , %[hi]" "\n\t" 4814 "out %[port] , %[lo]" "\n\t" 4816 "out %[port] , %[hi]" "\n\t" 4817 "mov %[n2] , %[lo]" "\n\t" 4818 "out %[port] , %[n1]" "\n\t" 4820 "sbrc %[byte] , 2" "\n\t" 4821 "mov %[n2] , %[hi]" "\n\t" 4822 "out %[port] , %[lo]" "\n\t" 4824 "out %[port] , %[hi]" "\n\t" 4825 "mov %[n1] , %[lo]" "\n\t" 4826 "out %[port] , %[n2]" "\n\t" 4828 "sbrc %[byte] , 1" "\n\t" 4829 "mov %[n1] , %[hi]" "\n\t" 4830 "out %[port] , %[lo]" "\n\t" 4832 "out %[port] , %[hi]" "\n\t" 4833 "mov %[n2] , %[lo]" "\n\t" 4834 "out %[port] , %[n1]" "\n\t" 4836 "sbrc %[byte] , 0" "\n\t" 4837 "mov %[n2] , %[hi]" "\n\t" 4838 "out %[port] , %[lo]" "\n\t" 4839 "sbiw %[count], 1" "\n\t" 4840 "out %[port] , %[hi]" "\n\t" 4841 "mov %[n1] , %[lo]" "\n\t" 4842 "out %[port] , %[n2]" "\n\t" 4843 "ld %[byte] , %a[ptr]+" "\n\t" 4844 "sbrc %[byte] , 7" "\n\t" 4845 "mov %[n1] , %[hi]" "\n\t" 4846 "out %[port] , %[lo]" "\n\t" 4848 : [byte]
"+r" (b), [n1]
"+r" (n1), [n2]
"+r" (n2), [count]
"+w" (i)
4849 : [
port]
"I" (_SFR_IO_ADDR(PORTC)), [ptr]
"e" (ptr), [hi]
"r" (hi),
4852 #if defined(PORTD) || defined(PORTB) || defined(PORTF) 4861 #if defined(PORTD) || defined(PORTB) || defined(PORTC) 4862 if(
port == &PORTF) {
4863 #endif // defined(PORTD/B/C) 4868 if(b & 0x80) n1 = hi;
4872 "out %[port] , %[hi]" "\n\t" 4873 "mov %[n2] , %[lo]" "\n\t" 4874 "out %[port] , %[n1]" "\n\t" 4876 "sbrc %[byte] , 6" "\n\t" 4877 "mov %[n2] , %[hi]" "\n\t" 4878 "out %[port] , %[lo]" "\n\t" 4880 "out %[port] , %[hi]" "\n\t" 4881 "mov %[n1] , %[lo]" "\n\t" 4882 "out %[port] , %[n2]" "\n\t" 4884 "sbrc %[byte] , 5" "\n\t" 4885 "mov %[n1] , %[hi]" "\n\t" 4886 "out %[port] , %[lo]" "\n\t" 4888 "out %[port] , %[hi]" "\n\t" 4889 "mov %[n2] , %[lo]" "\n\t" 4890 "out %[port] , %[n1]" "\n\t" 4892 "sbrc %[byte] , 4" "\n\t" 4893 "mov %[n2] , %[hi]" "\n\t" 4894 "out %[port] , %[lo]" "\n\t" 4896 "out %[port] , %[hi]" "\n\t" 4897 "mov %[n1] , %[lo]" "\n\t" 4898 "out %[port] , %[n2]" "\n\t" 4900 "sbrc %[byte] , 3" "\n\t" 4901 "mov %[n1] , %[hi]" "\n\t" 4902 "out %[port] , %[lo]" "\n\t" 4904 "out %[port] , %[hi]" "\n\t" 4905 "mov %[n2] , %[lo]" "\n\t" 4906 "out %[port] , %[n1]" "\n\t" 4908 "sbrc %[byte] , 2" "\n\t" 4909 "mov %[n2] , %[hi]" "\n\t" 4910 "out %[port] , %[lo]" "\n\t" 4912 "out %[port] , %[hi]" "\n\t" 4913 "mov %[n1] , %[lo]" "\n\t" 4914 "out %[port] , %[n2]" "\n\t" 4916 "sbrc %[byte] , 1" "\n\t" 4917 "mov %[n1] , %[hi]" "\n\t" 4918 "out %[port] , %[lo]" "\n\t" 4920 "out %[port] , %[hi]" "\n\t" 4921 "mov %[n2] , %[lo]" "\n\t" 4922 "out %[port] , %[n1]" "\n\t" 4924 "sbrc %[byte] , 0" "\n\t" 4925 "mov %[n2] , %[hi]" "\n\t" 4926 "out %[port] , %[lo]" "\n\t" 4927 "sbiw %[count], 1" "\n\t" 4928 "out %[port] , %[hi]" "\n\t" 4929 "mov %[n1] , %[lo]" "\n\t" 4930 "out %[port] , %[n2]" "\n\t" 4931 "ld %[byte] , %a[ptr]+" "\n\t" 4932 "sbrc %[byte] , 7" "\n\t" 4933 "mov %[n1] , %[hi]" "\n\t" 4934 "out %[port] , %[lo]" "\n\t" 4936 : [byte]
"+r" (b), [n1]
"+r" (n1), [n2]
"+r" (n2), [count]
"+w" (i)
4937 : [
port]
"I" (_SFR_IO_ADDR(PORTF)), [ptr]
"e" (ptr), [hi]
"r" (hi),
4940 #if defined(PORTD) || defined(PORTB) || defined(PORTC) 4942 #endif // defined(PORTD/B/C) 4943 #endif // defined(PORTF) 4946 volatile uint8_t next, bit;
4955 "st %a[port], %[hi]" "\n\t" 4956 "sbrc %[byte] , 7" "\n\t" 4957 "mov %[next], %[hi]" "\n\t" 4958 "st %a[port], %[next]" "\n\t" 4959 "mov %[next] , %[lo]" "\n\t" 4961 "breq nextbyte20" "\n\t" 4962 "rol %[byte]" "\n\t" 4963 "st %a[port], %[lo]" "\n\t" 4967 "rjmp head20" "\n\t" 4968 "nextbyte20:" "\n\t" 4969 "st %a[port], %[lo]" "\n\t" 4971 "ldi %[bit] , 8" "\n\t" 4972 "ld %[byte] , %a[ptr]+" "\n\t" 4973 "sbiw %[count], 1" "\n\t" 4984 #elif (F_CPU >= 11100000UL) && (F_CPU <= 14300000UL) 4986 volatile uint8_t next;
4991 #if defined(PORTB) || defined(PORTC) || defined(PORTF) 4992 if(
port == &PORTD) {
4998 if(b & 0x80) next = hi;
5001 "out %[port], %[hi]" "\n\t" 5002 "rcall bitTimeD" "\n\t" 5003 "out %[port], %[hi]" "\n\t" 5004 "rcall bitTimeD" "\n\t" 5005 "out %[port], %[hi]" "\n\t" 5006 "rcall bitTimeD" "\n\t" 5007 "out %[port], %[hi]" "\n\t" 5008 "rcall bitTimeD" "\n\t" 5009 "out %[port], %[hi]" "\n\t" 5010 "rcall bitTimeD" "\n\t" 5011 "out %[port], %[hi]" "\n\t" 5012 "rcall bitTimeD" "\n\t" 5013 "out %[port], %[hi]" "\n\t" 5014 "rcall bitTimeD" "\n\t" 5016 "out %[port] , %[hi]" "\n\t" 5018 "ld %[byte] , %a[ptr]+" "\n\t" 5019 "out %[port] , %[next]" "\n\t" 5020 "mov %[next] , %[lo]" "\n\t" 5021 "sbrc %[byte] , 7" "\n\t" 5022 "mov %[next] , %[hi]" "\n\t" 5024 "out %[port] , %[lo]" "\n\t" 5025 "sbiw %[count], 1" "\n\t" 5029 "out %[port], %[next]" "\n\t" 5030 "mov %[next], %[lo]" "\n\t" 5031 "rol %[byte]" "\n\t" 5032 "sbrc %[byte], 7" "\n\t" 5033 "mov %[next], %[hi]" "\n\t" 5035 "out %[port], %[lo]" "\n\t" 5041 : [
port]
"I" (_SFR_IO_ADDR(PORTD)),
5046 #if defined(PORTB) || defined(PORTC) || defined(PORTF) 5052 #if defined(PORTD) || defined(PORTC) || defined(PORTF) 5053 if(
port == &PORTB) {
5059 if(b & 0x80) next = hi;
5063 "out %[port], %[hi]" "\n\t" 5064 "rcall bitTimeB" "\n\t" 5065 "out %[port], %[hi]" "\n\t" 5066 "rcall bitTimeB" "\n\t" 5067 "out %[port], %[hi]" "\n\t" 5068 "rcall bitTimeB" "\n\t" 5069 "out %[port], %[hi]" "\n\t" 5070 "rcall bitTimeB" "\n\t" 5071 "out %[port], %[hi]" "\n\t" 5072 "rcall bitTimeB" "\n\t" 5073 "out %[port], %[hi]" "\n\t" 5074 "rcall bitTimeB" "\n\t" 5075 "out %[port], %[hi]" "\n\t" 5076 "rcall bitTimeB" "\n\t" 5077 "out %[port] , %[hi]" "\n\t" 5079 "ld %[byte] , %a[ptr]+" "\n\t" 5080 "out %[port] , %[next]" "\n\t" 5081 "mov %[next] , %[lo]" "\n\t" 5082 "sbrc %[byte] , 7" "\n\t" 5083 "mov %[next] , %[hi]" "\n\t" 5085 "out %[port] , %[lo]" "\n\t" 5086 "sbiw %[count], 1" "\n\t" 5090 "out %[port], %[next]" "\n\t" 5091 "mov %[next], %[lo]" "\n\t" 5092 "rol %[byte]" "\n\t" 5093 "sbrc %[byte], 7" "\n\t" 5094 "mov %[next], %[hi]" "\n\t" 5096 "out %[port], %[lo]" "\n\t" 5099 : [byte]
"+r" (b), [next]
"+r" (next), [count]
"+w" (i)
5100 : [
port]
"I" (_SFR_IO_ADDR(PORTB)), [ptr]
"e" (ptr), [hi]
"r" (hi),
5103 #if defined(PORTD) || defined(PORTC) || defined(PORTF) 5106 #if defined(PORTC) || defined(PORTF) 5112 #if defined(PORTD) || defined(PORTB) || defined(PORTF) 5113 if(
port == &PORTC) {
5119 if(b & 0x80) next = hi;
5123 "out %[port], %[hi]" "\n\t" 5124 "rcall bitTimeC" "\n\t" 5125 "out %[port], %[hi]" "\n\t" 5126 "rcall bitTimeC" "\n\t" 5127 "out %[port], %[hi]" "\n\t" 5128 "rcall bitTimeC" "\n\t" 5129 "out %[port], %[hi]" "\n\t" 5130 "rcall bitTimeC" "\n\t" 5131 "out %[port], %[hi]" "\n\t" 5132 "rcall bitTimeC" "\n\t" 5133 "out %[port], %[hi]" "\n\t" 5134 "rcall bitTimeC" "\n\t" 5135 "out %[port], %[hi]" "\n\t" 5136 "rcall bitTimeC" "\n\t" 5137 "out %[port] , %[hi]" "\n\t" 5139 "ld %[byte] , %a[ptr]+" "\n\t" 5140 "out %[port] , %[next]" "\n\t" 5141 "mov %[next] , %[lo]" "\n\t" 5142 "sbrc %[byte] , 7" "\n\t" 5143 "mov %[next] , %[hi]" "\n\t" 5145 "out %[port] , %[lo]" "\n\t" 5146 "sbiw %[count], 1" "\n\t" 5150 "out %[port], %[next]" "\n\t" 5151 "mov %[next], %[lo]" "\n\t" 5152 "rol %[byte]" "\n\t" 5153 "sbrc %[byte], 7" "\n\t" 5154 "mov %[next], %[hi]" "\n\t" 5156 "out %[port], %[lo]" "\n\t" 5159 : [byte]
"+r" (b), [next]
"+r" (next), [count]
"+w" (i)
5160 : [
port]
"I" (_SFR_IO_ADDR(PORTC)), [ptr]
"e" (ptr), [hi]
"r" (hi),
5163 #if defined(PORTD) || defined(PORTB) || defined(PORTF) 5172 #if defined(PORTD) || defined(PORTB) || defined(PORTC) 5173 if(
port == &PORTF) {
5179 if(b & 0x80) next = hi;
5183 "out %[port], %[hi]" "\n\t" 5184 "rcall bitTimeC" "\n\t" 5185 "out %[port], %[hi]" "\n\t" 5186 "rcall bitTimeC" "\n\t" 5187 "out %[port], %[hi]" "\n\t" 5188 "rcall bitTimeC" "\n\t" 5189 "out %[port], %[hi]" "\n\t" 5190 "rcall bitTimeC" "\n\t" 5191 "out %[port], %[hi]" "\n\t" 5192 "rcall bitTimeC" "\n\t" 5193 "out %[port], %[hi]" "\n\t" 5194 "rcall bitTimeC" "\n\t" 5195 "out %[port], %[hi]" "\n\t" 5196 "rcall bitTimeC" "\n\t" 5197 "out %[port] , %[hi]" "\n\t" 5199 "ld %[byte] , %a[ptr]+" "\n\t" 5200 "out %[port] , %[next]" "\n\t" 5201 "mov %[next] , %[lo]" "\n\t" 5202 "sbrc %[byte] , 7" "\n\t" 5203 "mov %[next] , %[hi]" "\n\t" 5205 "out %[port] , %[lo]" "\n\t" 5206 "sbiw %[count], 1" "\n\t" 5210 "out %[port], %[next]" "\n\t" 5211 "mov %[next], %[lo]" "\n\t" 5212 "rol %[byte]" "\n\t" 5213 "sbrc %[byte], 7" "\n\t" 5214 "mov %[next], %[hi]" "\n\t" 5216 "out %[port], %[lo]" "\n\t" 5219 : [byte]
"+r" (b), [next]
"+r" (next), [count]
"+w" (i)
5220 : [
port]
"I" (_SFR_IO_ADDR(PORTF)), [ptr]
"e" (ptr), [hi]
"r" (hi),
5223 #if defined(PORTD) || defined(PORTB) || defined(PORTC) 5228 volatile uint8_t next, bit;
5237 "st %a[port], %[hi]" "\n\t" 5238 "sbrc %[byte] , 7" "\n\t" 5239 "mov %[next], %[hi]" "\n\t" 5241 "st %a[port], %[next]" "\n\t" 5246 "st %a[port], %[lo]" "\n\t" 5249 "breq nextbyte30" "\n\t" 5250 "rol %[byte]" "\n\t" 5254 "rjmp head30" "\n\t" 5255 "nextbyte30:" "\n\t" 5257 "ldi %[bit] , 8" "\n\t" 5258 "ld %[byte] , %a[ptr]+" "\n\t" 5259 "sbiw %[count], 1" "\n\t" 5270 #elif (F_CPU >= 15400000UL) && (F_CPU <= 19000000L) 5272 volatile uint8_t next, bit;
5281 "st %a[port], %[hi]" "\n\t" 5282 "sbrc %[byte], 7" "\n\t" 5283 "mov %[next], %[hi]" "\n\t" 5285 "st %a[port], %[next]" "\n\t" 5286 "mov %[next] , %[lo]" "\n\t" 5287 "breq nextbyte20" "\n\t" 5288 "rol %[byte]" "\n\t" 5291 "st %a[port], %[lo]" "\n\t" 5294 "rjmp head20" "\n\t" 5295 "nextbyte20:" "\n\t" 5296 "ldi %[bit] , 8" "\n\t" 5297 "ld %[byte] , %a[ptr]+" "\n\t" 5298 "st %a[port], %[lo]" "\n\t" 5300 "sbiw %[count], 1" "\n\t" 5312 volatile uint8_t next, bit;
5321 "st %a[port], %[hi]" "\n\t" 5322 "sbrc %[byte] , 7" "\n\t" 5323 "mov %[next] , %[hi]" "\n\t" 5326 "st %a[port], %[next]" "\n\t" 5332 "st %a[port], %[lo]" "\n\t" 5334 "mov %[next] , %[lo]" "\n\t" 5336 "breq nextbyte40" "\n\t" 5337 "rol %[byte]" "\n\t" 5344 "rjmp head40" "\n\t" 5345 "nextbyte40:" "\n\t" 5346 "ldi %[bit] , 8" "\n\t" 5347 "ld %[byte] , %a[ptr]+" "\n\t" 5349 "st %a[port], %[lo]" "\n\t" 5351 "sbiw %[count], 1" "\n\t" 5363 #error "CPU SPEED NOT SUPPORTED" 5365 #elif defined(__arm__) 5368 #if defined(TEENSYDUINO) && defined(KINETISK) // Teensy 3.0, 3.1, 3.2, 3.5, 3.6 5369 #define CYCLES_800_T0H (F_CPU / 4000000) 5370 #define CYCLES_800_T1H (F_CPU / 1250000) 5371 #define CYCLES_800 (F_CPU / 800000) 5372 #define CYCLES_400_T0H (F_CPU / 2000000) 5373 #define CYCLES_400_T1H (F_CPU / 833333) 5374 #define CYCLES_400 (F_CPU / 400000) 5378 volatile uint8_t *
set = portSetRegister(
pin),
5379 *clr = portClearRegister(
pin);
5382 ARM_DEMCR |= ARM_DEMCR_TRCENA;
5383 ARM_DWT_CTRL |= ARM_DWT_CTRL_CYCCNTENA;
5386 cyc = ARM_DWT_CYCCNT + CYCLES_800;
5389 for(mask = 0x80; mask; mask >>= 1) {
5390 while(ARM_DWT_CYCCNT - cyc < CYCLES_800);
5391 cyc = ARM_DWT_CYCCNT;
5394 while(ARM_DWT_CYCCNT - cyc < CYCLES_800_T1H);
5396 while(ARM_DWT_CYCCNT - cyc < CYCLES_800_T0H);
5401 while(ARM_DWT_CYCCNT - cyc < CYCLES_800);
5403 cyc = ARM_DWT_CYCCNT + CYCLES_400;
5406 for(mask = 0x80; mask; mask >>= 1) {
5407 while(ARM_DWT_CYCCNT - cyc < CYCLES_400);
5408 cyc = ARM_DWT_CYCCNT;
5411 while(ARM_DWT_CYCCNT - cyc < CYCLES_400_T1H);
5413 while(ARM_DWT_CYCCNT - cyc < CYCLES_400_T0H);
5418 while(ARM_DWT_CYCCNT - cyc < CYCLES_400);
5421 #error "Sorry, only 48 MHz is supported, please set Tools > CPU Speed to 48 MHz" 5423 #elif defined(ESP8266) || defined(ESP32) 5427 #elif defined(__ARDUINO_ARC__) 5431 #define NOPx7 { __builtin_arc_nop(); \ 5432 __builtin_arc_nop(); __builtin_arc_nop(); \ 5433 __builtin_arc_nop(); __builtin_arc_nop(); \ 5434 __builtin_arc_nop(); __builtin_arc_nop(); } 5436 PinDescription *pindesc = &g_APinDescription[
pin];
5438 register uint8_t *p =
pixels;
5439 register uint32_t currByte = (uint32_t) (*p);
5440 register uint32_t currBit = 0x80 & currByte;
5441 register uint32_t bitCounter = 0;
5442 register uint32_t first = 1;
5444 if (pindesc->ulGPIOType == SS_GPIO) {
5445 register uint32_t reg = pindesc->ulGPIOBase + SS_GPIO_SWPORTA_DR;
5446 uint32_t reg_val = __builtin_arc_lr((
volatile uint32_t)reg);
5447 register uint32_t reg_bit_high = reg_val | (1 << pindesc->ulGPIOId);
5448 register uint32_t reg_bit_low = reg_val & ~(1 << pindesc->ulGPIOId);
5458 __builtin_arc_sr(first ? reg_bit_low : reg_bit_high, (
volatile uint32_t)reg);
5465 __builtin_arc_nop();
5468 __builtin_arc_sr(reg_bit_low, (
volatile uint32_t)reg);
5472 if(bitCounter >= 8) {
5474 currByte = (uint32_t) (*++p);
5477 currBit = 0x80 & currByte;
5480 }
else if(pindesc->ulGPIOType == SOC_GPIO) {
5481 register uint32_t reg = pindesc->ulGPIOBase + SOC_GPIO_SWPORTA_DR;
5482 uint32_t reg_val = MMIO_REG_VAL(reg);
5483 register uint32_t reg_bit_high = reg_val | (1 << pindesc->ulGPIOId);
5484 register uint32_t reg_bit_low = reg_val & ~(1 << pindesc->ulGPIOId);
5492 MMIO_REG_VAL(reg) = first ? reg_bit_low : reg_bit_high;
5496 __builtin_arc_nop();
5502 MMIO_REG_VAL(reg) = reg_bit_low;
5506 if(bitCounter >= 8) {
5508 currByte = (uint32_t) (*++p);
5511 currBit = 0x80 & currByte;
5517 #error Architecture not supported 5532 digitalWrite(p, LOW);
5535 port = portOutputRegister(digitalPinToPort(p));
5536 pinMask = digitalPinToBitMask(p);
5541 uint16_t n, uint8_t r, uint8_t g, uint8_t b) {
5563 uint16_t n, uint8_t r, uint8_t g, uint8_t b, uint8_t w) {
5588 r = (uint8_t)(c >> 16),
5589 g = (uint8_t)(c >> 8),
5600 uint8_t w = (uint8_t)(c >> 24);
5610 return ((uint32_t)r << 16) | ((uint32_t)g << 8) | b;
5613 uint32_t
NeoPixel::Color(uint8_t r, uint8_t g, uint8_t b, uint8_t w) {
5614 return ((uint32_t)w << 24) | ((uint32_t)r << 16) | ((uint32_t)g << 8) | b;
5630 return ((uint32_t)p[
rOffset] << 16) |
5642 return ((uint32_t)p[
wOffset] << 24) |
5643 ((uint32_t)p[
rOffset] << 16) |
5661 uint8_t newBrightness = b + 1;
5667 if(oldBrightness == 0) scale = 0;
5668 else if(b == 255) scale = 65535 / oldBrightness;
5669 else scale = (((uint16_t)newBrightness << 8) - 1) / oldBrightness;
5670 for(uint16_t i=0; i<
numBytes; i++) {
5672 *ptr++ = (c * scale) >> 8;
5686 static const uint8_t PROGMEM _sineTable[256] = {
5687 128,131,134,137,140,143,146,149,152,155,158,162,165,167,170,173,
5688 176,179,182,185,188,190,193,196,198,201,203,206,208,211,213,215,
5689 218,220,222,224,226,228,230,232,234,235,237,238,240,241,243,244,
5690 245,246,248,249,250,250,251,252,253,253,254,254,254,255,255,255,
5691 255,255,255,255,254,254,254,253,253,252,251,250,250,249,248,246,
5692 245,244,243,241,240,238,237,235,234,232,230,228,226,224,222,220,
5693 218,215,213,211,208,206,203,201,198,196,193,190,188,185,182,179,
5694 176,173,170,167,165,162,158,155,152,149,146,143,140,137,134,131,
5695 128,124,121,118,115,112,109,106,103,100, 97, 93, 90, 88, 85, 82,
5696 79, 76, 73, 70, 67, 65, 62, 59, 57, 54, 52, 49, 47, 44, 42, 40,
5697 37, 35, 33, 31, 29, 27, 25, 23, 21, 20, 18, 17, 15, 14, 12, 11,
5698 10, 9, 7, 6, 5, 5, 4, 3, 2, 2, 1, 1, 1, 0, 0, 0,
5699 0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 4, 5, 5, 6, 7, 9,
5700 10, 11, 12, 14, 15, 17, 18, 20, 21, 23, 25, 27, 29, 31, 33, 35,
5701 37, 40, 42, 44, 47, 49, 52, 54, 57, 59, 62, 65, 67, 70, 73, 76,
5702 79, 82, 85, 88, 90, 93, 97,100,103,106,109,112,115,118,121,124};
5704 static const uint8_t PROGMEM _gammaTable[256] = {
5705 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5706 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
5707 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3,
5708 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7,
5709 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12,
5710 13, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20,
5711 20, 21, 21, 22, 22, 23, 24, 24, 25, 25, 26, 27, 27, 28, 29, 29,
5712 30, 31, 31, 32, 33, 34, 34, 35, 36, 37, 38, 38, 39, 40, 41, 42,
5713 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
5714 58, 59, 60, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 75,
5715 76, 77, 78, 80, 81, 82, 84, 85, 86, 88, 89, 90, 92, 93, 94, 96,
5716 97, 99,100,102,103,105,106,108,109,111,112,114,115,117,119,120,
5717 122,124,125,127,129,130,132,134,136,137,139,141,143,145,146,148,
5718 150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,
5719 182,184,186,188,191,193,195,197,199,202,204,206,209,211,213,215,
5720 218,220,223,225,227,230,232,235,237,240,242,245,247,250,252,255};
5723 return pgm_read_byte(&_sineTable[x]);
5727 return pgm_read_byte(&_gammaTable[x]);
5950 #if EBOARD_COPY_AND_PASTE > 0x0 5964 #if EBOARD_DEBUG_MODE > 0x0 5969 TCCR1A = 0; TCCR1B = 0;
5971 TCCR1B |= (1 << WGM12); TCCR1B |= (1 << CS10); TCCR1B |= (1 << CS12);
5972 TIMSK1 |= (1 << OCIE1A);
5974 #if EBOARD_BLUETOOTH > 0x0 5975 #if (EBOARD_BLUETOOTH > 0x0) && (((PIN_BLUETOOTH_RX==0x13) && (PIN_BLUETOOTH_TX==0x12)) && defined(__AVR_ATmega2560__)) 5978 Serial1.begin(38400);
5984 #if EBOARD_I2C > 0x0 5987 #if EBOARD_SHIFT_REGISTER > 0x0 5993 #if EBOARD_USE_SPI > 0x0 && (EBOARD_NANO == 0) 5997 #if EBOARD_DEBUG_MODE > 0x0 5999 Serial.println(
" -- Exit Code. \n Program has finished. Reset to start again");
6020 #error This library is build for arduino-devices and should be used only in the Arduino IDE or with a similar linking process 6022 #pragma GCC diagnostic pop uint16_t _rx_delay_intrabit
the rx startbit delay
uint8_t * pixels
stores the pixels
void onRequest(void(*function)(void))
this will set the user_onRequest method
volatile uint8_t * port
the used port register
virtual size_t write(uint8_t data)
this will write a single unsigned 8-bit value to address
bool checkPin(optVAL_t idx, optVAL_t mode=0x1)
[COPY&PASTE] [CHECK_PINS] Check if a pin is set to a specific mode
void recv(void)
private receive routine called each time interrupt handler gets triggered
SoccerBoard(void)
The constructor.
void setTX(uint8_t transmitPin)
sets a specific pin to be 'the chosen one' as a txPin
int8_t pin
stores the pin -1 if the pin wasn't set
uint8_t gOffset
stores the green color offset
void begin(long speed)
the start function to setup delay_values etc.
void shiftSingle(optVAL_t idx, bool val)
[SHIFT] Changes a single output Pin
AX12Servo * connected[2]
stores the pointers to the registerd AX12Servo
const unsigned char * buf[11]
to enable 'smooth' access (:
void writePWM(optVAL_t val)
write a clamped pwm value to an output pin
uint8_t _transmitBitMask
the pin mask to address the tx pin
[COPY&PASTE] This is the SoccerBoard ghost struct :D
static void(* user_onReceive)(int numBytes)
twi slave [Rx]receive-event user def handler
void writeVal(const T &val)
[BLUETOOTH] writes Data to bluetooth
byte sendWait(const byte what)
sends data.
void setPosLimit(optVAL_t posLimit)
Sets the position limits for the servos.
static volatile uint8_t _receive_buffer_head
current location in rxBuffer
[COPY&PASTE] This is the AX12Servo ghost struct :D
static void detachInterrupt(void)
disables the interrupt feature
void write(void)
this will write values stored in B and C
static uint8_t rxBufferIndex
this defines the rxBuffer Index - current position in rxBuffer array
bool canShow(void)
this will determine if the next show is available [last show finished]
void storePosition(int pos, int speed=0x3FF)
This saves the Servo Position.
int actSpe
stores the actual 'would use speed' of the AX12Servo
optVAL_t getPosition(void)
This "kind of" returns the Servo-Position.
virtual size_t write(uint8_t byte)
writes a specific value to the tx register
void setID(optVAL_t newID)
change the AX-12 Servo this object should speak to
uint8_t getBrightness(void) const
returns the current set brightness
[SPI] This is used to avoid path resolving issues and defines the common known Arduino SPI interface ...
uint16_t numLEDs
stores the amount of LEDs
I2CInOut(SoccerBoard &, optVAL_t, optVAL_t, optVAL_t, optVAL_t)
The constructor.
void setVelocity(optVAL_t velocity)
Sets the default speed of servos.
void button(int)
š§ I prevent errors!
#define EBOARD_DEBUG_SPEED
bool isListening(void)
checks if this object is the listening object
~NeoPixel(void)
the destructor [calling free on pixel and freeing input pin]
optVAL_t countSetBits(optVAL_t x)
[COPY&PASTE] [CHECK_PWM] counts high-bits in an int/byte (determined by IGNORE_SIZE) ...
#define LCD_COMMAND_DISPLAY_OFF
TwoWire Wire
this is the well-known Arduino Wire Interface, just a little bit 'modified' ;P
[SPI] This is used to communicate with the smart servo shield         Don't use manually ...
static uint8_t txBufferIndex
this defines the txBuffer Index - current position in txBuffer array
static void onRequestService(void)
twi slave [Tx]transmitting-event handler
void loop(void)
[COPY&PASTE] As we have an Arduino we need a setup function ;)
bool is800kHz
determines the speed the communcation is working on
uint16_t _rx_delay_stopbit
the rx stopbit dely
char channel(optVAL_t)
will return the next char received by the module. A 64 byte Serial buffer is included! ...
uint8_t bOffset
stores the blue color offset
This is used to avoid path resolving issues and defines the common known Arduino Wire-Interface    ...
int peek(void)
reads the actual pointed rxBuffer element without dropping it
void led(int idx, bool state)
[MEGA] Control the OnBoard LED
uint8_t rx_pin_read(void)
simple routine to read the rxPin by registers
bool begun
true if NeoPixel::begin has been called
static uint8_t transmitting
'boolean' value. Set to 1 if transmitting => in master write mode
RB14Scan(void)
The constructor.
void s2Cmd(optVAL_t o, optVAL_t t)
this function will execute two cmd sends without starting and without ending the transmission ...
void ledOff(int idx)
[MEGA] Deactivate the OnBoard LED
optVAL_t readPin(optVAL_t idx, bool dig=true)
read a digital state from an INPUTpin
uint8_t gamma8(uint8_t x) const
acces to the gamma-correction-8-bit table ;D
void ledMeter(int)
[MEGA] Activate the OnBoard LED
void writePin(optVAL_t idx, bool val)
write a boolean state to an output pin
void powerOn(optVAL_t id)
Set the state of a certain D-pin to HIGH.
long store_bits
[SHIFT] Manipulate me to set Pins via bitSet operations
void changeModes(optVAL_t, optVAL_t, optVAL_t)
š§ I prevent errors!
static void end(void)
this will end the SPI connection
int8_t getPin(void)
this will return the set data pin
void reset(void)
Resets the Soccerboard if EBOARD_USE_RESET is set to true.
bool listen(void)
sets the SoftwareSerial object to be the listening one gaining control over the buffers etc...
bool reset(void)
clears the screen
bool isMoving(void)
Use this if you wan't to have a nice way of writing false.
void Reset(optVAL_t ID)
resets a servo
void sleep(uint16_t t)
Say goodnight!
void setTorque(uint16_t)
š§ I prevent errors!
void changeMode(bool newMode=true)
enable or disable the display
void ledOn(void)
Noone needs the AX-12 Servo LED^^.
static uint8_t rxBufferLength
this defines the length of rxBuffer
#define LCD_COMMAND_DISPLAY_ON
static uint8_t txAddress
this defines the txAddress the transmitting Dta
int storedPos
stores the position the Servo should go to DynamixelBoard::action()
void SetServoLimit(optVAL_t ID, optVAL_t upperLimit)
(probably) set the posLimit for only one servo (will be overwritten by write() => writePos()) ...
bool init(void)
initializes the Display called by:
void tx_pin_write(uint8_t pin_state)
writes a bool value on the txPin by registers
static uint8_t txBuffer[]
this defines the txBuffer used to enable delayed read
void setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b)
sets the rgb color of a specific pixel
int upperLimit_temp
stores the posLimit value send with write()
#define LCD_PAGE_ADDRESSING
void changeAddress(optVAL_t)
š§ I prevent errors!
int eVirtual_main()
[COPY&PASTE] Assures the existence of the "qfix-code-main-method"
this namespace contains all the Don't use manually classes ;)
SoftwareSerial _serial(0x13, 0x12)
this is the recomenned-to-use _serial object for bluetooth communcation :D
static void attachInterrupt(void)
enables the interrupt feature
SoftwareSerial(uint8_t receivePin, uint8_t transmitPin, bool inverse_logic=false)
the constructor for the SoftwareSerial object
virtual void flush(void)
resets the position in buffer and the buffer itself if the object is listening
static char _receive_buffer[64]
the buffer for rxBuffer
#define LCD_COMMAND_CHARGE_PUMP_SETTING
static void begin(void)
this will setup everything for SPI connection
optVAL_t id
stores the id of the AX12Servo obejct
void msleep(uint16_t t)
Say goodnight!
void shiftAll(void)
[SHIFT] Changes bits according to store_bits
byte pX
the addressing mode (page/horizontal)
DynamixelBoard(SoccerBoard &)
The constructor.
ServoCds55 _servoHandler
this is the "to_use" instance of ServoCds55
void updateLength(uint16_t n)
this changes the length of the connected LED stripe
#define PIN_BLUETOOTH_STATE
void readI2C(optVAL_t deviceID, optVAL_t ret[], optVAL_t ret_len, bool blocking=true)
Reads a special amount of bits from a certain I²C-Device.
void write(optVAL_t ID, optVAL_t Pos)
Moves a Servo to a certain position.
void setPin(optVAL_t idx, optVAL_t mode=0x1)
[COPY&PASTE] set a pin to a certain mode => checkPin() will return true then
uint16_t numBytes
stores the byte size [pixels] used internally
static uint32_t Color(uint8_t r, uint8_t g, uint8_t b)
returns a color value that can be used with NeoPixel::setPixelColor()
void setPin(uint8_t p)
sets pin for communication
virtual int read(void)
this will read a single byte from rxBuffer and increment the Index
#define EBOARD_SPI_SERVO_MAX
void clear(void)
this will reset all set pixels [won't call NeoPixel::show()]
bool setCursor(byte posX=0x0, byte posY=0x0)
set the position of the cursor
uint8_t * getPixels(void) const
this will give you access to the pixels
~SoftwareSerial(void)
the destructor of the SoftwareSerial object
void WritePos(optVAL_t ID, optVAL_t Pos)
Moves a Servo to a certain position.
LCD(SoccerBoard &soccerBoard, optVAL_t id=0x3C)
The constructor.
#define LCD_COMMAND_WHITE_BACKGROUND
void waitForButton(int)
š§ I prevent errors!
void motorsOff(void)
As requested this is the shortcut to disable the main motor.
int raw(optVAL_t)
this will check for connection status [will return true if pin not connected]
bool overflow(void)
returns the current overflow flag and disables it
static void setDataMode(uint8_t mode)
this will set the Data transfer mode
void s1Cmd(optVAL_t o)
this function will execute one cmd send without starting and without ending the transmission ...
void updateType(uint16_t t)
this changes the type of communication between arduino and LED stripe
virtual int available(void)
checks if there is data to read available
NeoPixel(void)
the empty constructor
[COPY&PASTE] [BLUETOOTH] This is the RB14Scan ghost struct :D
uint8_t requestFrom(uint8_t address, uint8_t quantity)
this will read a specific quantity of bytes from a specific address
void changeBackground(bool newBackground=false)
changes the background of the display
static void onReceiveService(uint8_t *inBytes, int numBytes)
twi slave [Rx]receive-event handler
void begin()
begin the TwoWire communcation without any data set
optVAL_t ID
ID of the Display.
void rotate(optVAL_t, optVAL_t)
makes nothing
void pingI2C(optVAL_t ret[], optVAL_t ret_len)
Sends a byte to a certain I²C-Device.
void motor(uint8_t id, int16_t val)
As requested this is the ultimate shortcut ;)
uint8_t sine8(uint8_t x) const
acces to the sine-8-bit table ;D
bool digital(optVAL_t id)
Reads a digital value from a pin.
static void handle_interrupt(void)
used to handle interrupts on active listening object
int storedSpe
stores the Speed of the Servo DynamixelBoard::action()
[COPY&PASTE] This is the DynamixelBoard ghost struct :D
char readVal(char oF='.')
[BLUETOOTH] reads a single value from bluetooth if available!
void checkIdx(optVAL_t idx)
[DEBUG_MODE] used to check if a pin index is in bounds
bool checkOverflow(void)
[BLUETOOTH] checks if theres a lack of Data!
TwoWire()
The constructor of the TwoWire class.
volatile uint8_t * _transmitPortRegister
the register the reveice pin is located on
static void setClockDivider(uint8_t rate)
this will change the clock devider the
void write(const char *const val)
this will write a constant string to the output
void beginTransmission(uint8_t address)
this will start a new transmission to a specific address => master mode
void power(optVAL_t id, bool state)
Set the state of a certain D-pin.
void s1Dat(optVAL_t o)
this function will execute one dat send without starting and without ending the transmission ...
uint32_t endTime
stores the last call time of show for NeoPixel::canShow()
void changeId(optVAL_t)
š§ I prevent errors!
uint8_t wOffset
stores the white color offset
uint16_t _tx_delay
the (generic) tx delay
DynamixelBoard * _conBoard
virtual int peek(void)
this will read a single byte from rxBuffer without increment the Index
void setBrightness(uint8_t val)
changes the brightness for all further acceses via NeoPixel::setPixelColor()
void setSpeed(optVAL_t)
š§ I prevent errors!
void lightOn(void)
enable the backlight
[COPY&PASTE] This is the I2CInOut ghost struct :D
void lightOff(void)
disable the backlight
void setRX(uint8_t receivePin)
sets a specific pin to be 'the chosen one' as a rxPin
optVAL_t velocity_temp
stores the velocity value send with writePos()
bool clear(void)
clears the LCD
void onReceive(void(*function)(int))
this will set the user_onReceive method
uint8_t brightness
stores the brightness
uint8_t pinMask
the used pinMask
void __assert(const char *__func, const char *__file, optVAL_t __lineno, const char *__sexp)
[DEBUG_MODE] custom assert message
void ledsOff(void)
[MEGA] Deactivate the OnBoard LED
static uint8_t txBufferLength
this defines the length of txBuffer
static byte transfer(byte _data)
this will send a single bite via the SPI connection
void setPositionMode(void)
set the AX-12 Servo to positionMode
static void setBitOrder(uint8_t bitOrder)
this will set the BitOrder
void setup(void)
this is a guard
void end(void)
ends communcation on the rx pin
void action(void)
will force every AX12Servo to drive to AX12Servo::storedPos with AX12Servo::storedSpeed ...
static SoftwareSerial * active_object
the active SoftwareSerial object to operate on
bool changeBrightness(byte val=0x64)
changes the brightness of the display
void read(void)
š§ I prevent errors!
optVAL_t analog(optVAL_t id)
Reads an analog value from a pin.
void ledOn(int idx)
[MEGA] Activate the OnBoard LED
AX12Servo(void)
The constructor.
void ledOn(optVAL_t)
š§ I prevent errors!
bool changeID(optVAL_t newID=0x3C)
changes the address of the LCD display talked to
void setPosition(int pos, int speed=0x3FF)
This moves the Servo to the new position.
uint16_t _inverse_logic
determining if all pin reads etc whould be inverted (e.g. no pullup on rx);
DynamixelBoard dBoard(board)
the dBoard object
uint16_t _rx_delay_centering
the rx center delay
static volatile uint8_t _receive_buffer_tail
size of rxBuffer
uint8_t rOffset
stores the red color offset
uint8_t endTransmission(void)
this will end the transmission and send the STOP-sequence
bool isConnected(void)
[BLUETOOTH] this will check if the HC-05 is paired
void print(const char *data)
prints a string to the display
void setSpeedMode(void)
set the AX-12 Servo NOT to speedMode
void SetMotormode(optVAL_t ID, optVAL_t velocity)
(probably) set the velocity of only one Servo
virtual int available(void)
this will return the amount of rxBuffer left
uint8_t _receivePin
the id of the receive pin
void drawBitmap(const unsigned char *bitmap, byte posX, byte posY, byte hiX, byte hiY)
draws a bitmap representet as an array of bytes
#define LCD_COMMAND_CHARGE_PUMP_ENABLE
void ledOff(void)
Noone needs the AX-12 Servo LED^^.
void powerOff(optVAL_t id)
Set the state of a certain D-pin to LOW.
uint16_t _buffer_overflow
determining if an _buffer_overflow occured
static void(* user_onRequest)(void)
twi slave [Tx]transmitting-event user def handler
uint8_t _receiveBitMask
the pin mask to directly read from register (Rx)
virtual int read(void)
reads the actual pointed rxBuffer top element
optVAL_t sendI2C(optVAL_t deviceID, byte *buf, byte buf_len)
Sends a buffer of bytes to a certain I²C-Device.
PROGMEM const byte basicFont[][8]
optVAL_t cs
stores the ControlPin id
static uint8_t rxBuffer[]
this defines the rxBuffer used to enable delayed read
volatile uint8_t * _receivePortRegister
the register the reveice pin is located on
void SetID(optVAL_t ID, optVAL_t newID)
change the ID of a special Servo
void begin(void)
this has to be called to start the communcation (you should call NeoPixel::setPin() before) ...
[NEO] this allows you to access Adafruit LED-stripes
virtual void flush(void)
as this isn't implemented in the offical Wire library, this does nothing xD
uint32_t getPixelColor(uint16_t n) const
returns the color of a specific pixel
void changeMotorID(optVAL_t)
š§ I prevent errors!
void show(void)
this will reveal the setPixels [via NeoPixel::setPixelColor() etc...]
uint16_t numPixels(void) const
returns the size of the LED stripe
void ledOff(optVAL_t)
š§ I prevent errors!
static void tunedDelay(uint16_t delay)
apply a specific delay to achieve higher precision
#define EBOARD_NEO_800KHZ
ServoCds55(optVAL_t CS=53)
The constructor.
void begin()
begin the communication and setup SPI
[I2C] [LCD] This is used to add support for OLED displays connected to the 'SoccerBoard' ...
#define LCD_COMMAND_BLACK_BACKGROUND
void changeMotorID(optVAL_t newID)
change the AX-12 Servo this object should speak to
This is used to avoid path resolving issues and defines the common known Arduino SoftwareSerial inter...