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^^ 391 #ifndef EBOARD_HEADER_GUARD 392 #define EBOARD_HEADER_GUARD 399 #define EBOARD_I2C 0x1 404 #define EBOARD_LCD 0x1 408 #define EBOARD_SHIFT_REGISTER 0x1 412 #define EBOARD_BLUETOOTH 0x1 420 #define __AVR_ATmega2560__ 424 #define __AVR_ATmega328P__ 428 #define EBOARD_NEO 0x1 440 #include <avr/pgmspace.h> 447 #ifndef EBOARD_GUESSPATH 451 #define EBOARD_GUESSPATH 0x1 454 #if defined(ARDUINO) //general platform-check [No tab] 459 #define main eVirtual_main //main has a different meaning^^ 461 #if ARDUINO >= 100 //this could be only Arduino.h but this snippet is portable :D 467 #if not ( defined(__AVR_ATmega2560__) || defined(__AVR_ATmega328P__)) 468 #error "This library was build for ARDUINO UNO R3 Aand ARDUINO MEGA 2560!" 471 #if defined(__AVR_ATmega2560__) 475 #define PIN_MAX 0x32 //53 pins to address - 4 !!53 is SS 477 #define PIN_MAX 0xA // 13 Pins to address - 4 !!10 is SS 481 #include <avr/interrupt.h> 483 #if EBOARD_I2C > 0x0 && EBOARD_GUESSPATH > 0x0 487 #include <inttypes.h> 492 #define TWI_FREQ 100000L 495 #ifndef TWI_BUFFER_LENGTH 496 #define TWI_BUFFER_LENGTH 32 506 void twi_setAddress(uint8_t);
507 uint8_t twi_readFrom(uint8_t, uint8_t*, uint8_t, uint8_t);
508 uint8_t twi_writeTo(uint8_t, uint8_t*, uint8_t, uint8_t, uint8_t);
509 uint8_t twi_transmit(
const uint8_t*, uint8_t);
510 void twi_attachSlaveRxEvent(
void (*)(uint8_t*,
int) );
511 void twi_attachSlaveTxEvent(
void (*)(
void) );
512 void twi_reply(uint8_t);
514 void twi_releaseBus(
void);
518 #include <inttypes.h> 520 #include <avr/interrupt.h> 521 #include <compat/twi.h> 524 #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) 528 #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) 531 #include "pins_arduino.h" 533 static volatile uint8_t twi_state;
534 static volatile uint8_t twi_slarw;
535 static volatile uint8_t twi_sendStop;
536 static volatile uint8_t twi_inRepStart;
538 static void (*twi_onSlaveTransmit)(void);
539 static void (*twi_onSlaveReceive)(uint8_t*, int);
541 static uint8_t twi_masterBuffer[TWI_BUFFER_LENGTH];
542 static volatile uint8_t twi_masterBufferIndex;
543 static volatile uint8_t twi_masterBufferLength;
545 static uint8_t twi_txBuffer[TWI_BUFFER_LENGTH];
546 static volatile uint8_t twi_txBufferIndex;
547 static volatile uint8_t twi_txBufferLength;
549 static uint8_t twi_rxBuffer[TWI_BUFFER_LENGTH];
550 static volatile uint8_t twi_rxBufferIndex;
552 static volatile uint8_t twi_error;
554 void twi_init(
void) {
555 twi_state = TWI_READY;
557 twi_inRepStart =
false;
559 digitalWrite(SDA, 1);
560 digitalWrite(SCL, 1);
564 TWBR = ((F_CPU / TWI_FREQ) - 16) / 2;
566 TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA);
569 void twi_setAddress(uint8_t address) {
573 uint8_t twi_readFrom(uint8_t address, uint8_t* data, uint8_t length, uint8_t sendStop) {
576 if(TWI_BUFFER_LENGTH < length){
580 while(TWI_READY != twi_state){
584 twi_sendStop = sendStop;
588 twi_masterBufferIndex = 0;
589 twi_masterBufferLength = length-1;
591 twi_slarw |= address << 1;
593 if (
true == twi_inRepStart) {
594 twi_inRepStart =
false;
596 TWCR = _BV(TWINT) | _BV(TWEA) | _BV(TWEN) | _BV(TWIE);
599 TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA) | _BV(TWINT) | _BV(TWSTA);
601 while(TWI_MRX == twi_state){
605 if (twi_masterBufferIndex < length)
606 length = twi_masterBufferIndex;
608 for(i = 0; i < length; ++i){
609 data[i] = twi_masterBuffer[i];
615 uint8_t twi_writeTo(uint8_t address, uint8_t* data, uint8_t length, uint8_t wait, uint8_t sendStop)
619 if(TWI_BUFFER_LENGTH < length){
623 while(TWI_READY != twi_state){
627 twi_sendStop = sendStop;
630 twi_masterBufferIndex = 0;
631 twi_masterBufferLength = length;
633 for(i = 0; i < length; ++i){
634 twi_masterBuffer[i] = data[i];
637 twi_slarw = TW_WRITE;
638 twi_slarw |= address << 1;
640 if (
true == twi_inRepStart) {
641 twi_inRepStart =
false;
643 TWCR = _BV(TWINT) | _BV(TWEA) | _BV(TWEN) | _BV(TWIE);
646 TWCR = _BV(TWINT) | _BV(TWEA) | _BV(TWEN) | _BV(TWIE) | _BV(TWSTA);
648 while(wait && (TWI_MTX == twi_state)){
652 if (twi_error == 0xFF)
654 else if (twi_error == TW_MT_SLA_NACK)
656 else if (twi_error == TW_MT_DATA_NACK)
662 uint8_t twi_transmit(
const uint8_t* data, uint8_t length) {
665 if(TWI_BUFFER_LENGTH < length){
669 if(TWI_STX != twi_state){
673 twi_txBufferLength = length;
674 for(i = 0; i < length; ++i){
675 twi_txBuffer[i] = data[i];
681 void twi_attachSlaveRxEvent(
void (*
function)(uint8_t*,
int) ) {
682 twi_onSlaveReceive =
function;
685 void twi_attachSlaveTxEvent(
void (*
function)(
void) ) {
686 twi_onSlaveTransmit =
function;
689 void twi_reply(uint8_t ack) {
691 TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWINT) | _BV(TWEA);
693 TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWINT);
698 void twi_stop(
void) {
699 TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA) | _BV(TWINT) | _BV(TWSTO);
701 while(TWCR & _BV(TWSTO)){
705 twi_state = TWI_READY;
708 void twi_releaseBus(
void){
709 TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA) | _BV(TWINT);
710 twi_state = TWI_READY;
723 if(twi_masterBufferIndex < twi_masterBufferLength){
724 TWDR = twi_masterBuffer[twi_masterBufferIndex++];
730 twi_inRepStart =
true;
731 TWCR = _BV(TWINT) | _BV(TWSTA)| _BV(TWEN) ;
732 twi_state = TWI_READY;
737 twi_error = TW_MT_SLA_NACK;
740 case TW_MT_DATA_NACK:
741 twi_error = TW_MT_DATA_NACK;
745 twi_error = TW_MT_ARB_LOST;
750 twi_masterBuffer[twi_masterBufferIndex++] = TWDR;
752 if(twi_masterBufferIndex < twi_masterBufferLength){
758 case TW_MR_DATA_NACK:
759 twi_masterBuffer[twi_masterBufferIndex++] = TWDR;
763 twi_inRepStart =
true;
764 TWCR = _BV(TWINT) | _BV(TWSTA)| _BV(TWEN) ;
765 twi_state = TWI_READY;
772 case TW_SR_GCALL_ACK:
773 case TW_SR_ARB_LOST_SLA_ACK:
774 case TW_SR_ARB_LOST_GCALL_ACK:
776 twi_rxBufferIndex = 0;
780 case TW_SR_GCALL_DATA_ACK:
781 if(twi_rxBufferIndex < TWI_BUFFER_LENGTH){
782 twi_rxBuffer[twi_rxBufferIndex++] = TWDR;
789 if(twi_rxBufferIndex < TWI_BUFFER_LENGTH){
790 twi_rxBuffer[twi_rxBufferIndex] =
'\0';
793 twi_onSlaveReceive(twi_rxBuffer, twi_rxBufferIndex);
794 twi_rxBufferIndex = 0;
797 case TW_SR_DATA_NACK:
798 case TW_SR_GCALL_DATA_NACK:
802 case TW_ST_ARB_LOST_SLA_ACK:
804 twi_txBufferIndex = 0;
805 twi_txBufferLength = 0;
806 twi_onSlaveTransmit();
807 if(0 == twi_txBufferLength){
808 twi_txBufferLength = 1;
809 twi_txBuffer[0] = 0x00;
812 TWDR = twi_txBuffer[twi_txBufferIndex++];
813 if(twi_txBufferIndex < twi_txBufferLength){
819 case TW_ST_DATA_NACK:
820 case TW_ST_LAST_DATA:
822 twi_state = TWI_READY;
828 twi_error = TW_BUS_ERROR;
834 #include <inttypes.h> 837 #define BUFFER_LENGTH 32 855 class TwoWire :
public Stream {
900 void begin(uint8_t address);
906 inline void begin(
int address);
947 inline uint8_t
requestFrom(uint8_t address, uint8_t quantity);
955 uint8_t
requestFrom(uint8_t address , uint8_t quantity, uint8_t sendStop);
963 inline uint8_t
requestFrom(
int address,
int quantity);
972 inline uint8_t
requestFrom(
int address,
int quantity,
int sendStop);
981 virtual size_t write(uint8_t data);
989 virtual size_t write(
const uint8_t *data,
size_t quantity);
1000 virtual int read(
void);
1006 virtual int peek(
void);
1008 virtual void flush(
void);
1015 void onReceive(
void (*
function)(
int) );
1022 void onRequest(
void (*
function)(
void) );
1036 #include <inttypes.h> 1067 twi_setAddress(address);
1074 begin((uint8_t)address);
1081 uint8_t
read = twi_readFrom(address,
rxBuffer, quantity, sendStop);
1089 return requestFrom((uint8_t)address, (uint8_t)quantity, (uint8_t)
true);
1093 return requestFrom((uint8_t)address, (uint8_t)quantity, (uint8_t)
true);
1097 return requestFrom((uint8_t)address, (uint8_t)quantity, (uint8_t)sendStop);
1133 twi_transmit(&data, 1);
1140 for(
size_t i = 0; i < quantity; ++i) {
1144 twi_transmit(data, quantity);
1187 for(uint8_t i = 0; i < numBytes; ++i) {
1222 #ifndef EBOARD_USE_SPI 1223 #define EBOARD_USE_SPI 0x1 1225 #if EBOARD_USE_SPI > 0x0 1226 #define _SPI_H_INCLUDED 1231 #define SPI_CLOCK_DIV4 0x00 1232 #define SPI_CLOCK_DIV16 0x01 1234 #define SPI_CLOCK_DIV64 0x02 1236 #define SPI_CLOCK_DIV128 0x03 1238 #define SPI_CLOCK_DIV2 0x04 1240 #define SPI_CLOCK_DIV8 0x05 1242 #define SPI_CLOCK_DIV32 0x06 1246 #define SPI_MODE0 0x00 1247 #define SPI_MODE1 0x04 1249 #define SPI_MODE2 0x08 1251 #define SPI_MODE3 0x0C 1255 #define SPI_MODE_MASK 0x0C 1256 #define SPI_CLOCK_MASK 0x03 1258 #define SPI_2XCLOCK_MASK 0x01 1280 inline static byte
transfer(byte _data);
1292 static void begin(
void);
1296 inline static void end(
void);
1317 while (!(SPSR & _BV(SPIF)));
1326 digitalWrite(SS, HIGH);
1327 pinMode(SS, OUTPUT);
1330 pinMode(SCK, OUTPUT);
1331 pinMode(MOSI, OUTPUT);
1337 if(bitOrder == LSBFIRST) SPCR |= _BV(DORD);
1338 else SPCR &= ~(_BV(DORD));
1352 #if (EBOARD_I2C > 0x0) && (EBOARD_LCD > 0x0) 1353 #include <avr/pgmspace.h> 1361 static bool STOP =
false;
1375 #ifndef EBOARD_DEBUG_MODE 1376 #define EBOARD_DEBUG_MODE 0x1 1383 #define EBOARD_NANO 0x0 1388 #ifndef EBOARD_CHECK_PINS 1389 #define EBOARD_CHECK_PINS 0x1 1392 #ifndef EBOARD_SHIFT_REGISTER 1396 #define EBOARD_SHIFT_REGISTER 0x0 1402 #ifndef EBOARD_CHECK_PINS_PWM 1403 #define EBOARD_CHECK_PINS_PWM 0x1 1409 #ifndef EBOARD_DEBUG_SPEED 1410 #define EBOARD_DEBUG_SPEED 9600 1415 #ifndef EBOARD_SPI_SERVO_MAX 1416 #define EBOARD_SPI_SERVO_MAX 2 1421 #ifndef EBOARD_USE_UTILITY 1422 #define EBOARD_USE_UTILITY 0x1 1427 #define EBOARD_COPY_AND_PASTE 0x1 1431 #ifndef EBOARD_PWM_SPE 1432 #define EBOARD_PWM_SPE 1 1439 #define EBOARD_I2C 0x0 //disabled by default 1442 #ifndef EBOARD_BLUETOOTH 1446 #define EBOARD_BLUETOOTH 0x0 1451 #ifndef EBOARD_CLAMP 1452 #define EBOARD_CLAMP 0x1 1460 #define EBOARD_NEO 0x0 1467 #ifndef EBOARD_USE_RESET 1468 #define EBOARD_USE_RESET 0x1 1471 #if EBOARD_USE_RESET > 0x0 1472 #include <avr/wdt.h> 1478 #ifndef PIN_BLUETOOTH_STATE 1479 #if defined(__AVR_ATmega2560__) 1480 #define PIN_BLUETOOTH_STATE 0x13 // 19 1482 #define PIN_BLUETOOTH_STATE 0x2 1489 #ifndef PIN_BLUETOOTH_RX 1490 #if defined(__AVR_ATmega2560__) 1491 #define PIN_BLUETOOTH_RX 0x13 // 19 1493 #define PIN_BLUETOOTH_RX 0x2 1500 #ifndef PIN_BLUETOOTH_TX 1501 #if defined(__AVR_ATmega2560__) 1502 #define PIN_BLUETOOTH_TX 0x12 // 18 1504 #define PIN_BLUETOOTH_TX 0x3 1511 #ifndef PIN_MOTOR_DIR 1512 #define PIN_MOTOR_DIR 0x4 1518 #ifndef PIN_MOTOR_SPE 1519 #define PIN_MOTOR_SPE 0x5 1525 #ifndef PIN_SHIFT_CLK 1526 #define PIN_SHIFT_CLK 0x6 1531 #ifndef PIN_SHIFT_DAT 1532 #define PIN_SHIFT_DAT 0x7 1537 #ifndef PIN_SHIFT_LAT 1538 #define PIN_SHIFT_LAT 0x8 1551 #if (EBOARD_BLUETOOTH > 0x0) && defined(__AVR_ATmega328P__) 1552 #if EBOARD_GUESSPATH > 0x0 1555 #define _SS_MAX_RX_BUFF 64 // RX buffer size 1557 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) 1632 void setTX(uint8_t transmitPin);
1637 void setRX(uint8_t receivePin);
1642 static inline void tunedDelay(uint16_t delay);
1652 SoftwareSerial(uint8_t receivePin, uint8_t transmitPin,
bool inverse_logic =
false);
1674 void begin(
long speed);
1681 inline void end(
void);
1703 virtual size_t write(uint8_t byte);
1708 virtual int read(
void);
1717 virtual void flush(
void);
1744 #if EBOARD_DEBUG_MODE > 0x0 1746 #define _DEBUG_PIN1 11 1747 #define _DEBUG_PIN2 13 1749 typedef struct _DELAY_TABLE {
1751 unsigned short rx_delay_centering;
1752 unsigned short rx_delay_intrabit;
1753 unsigned short rx_delay_stopbit;
1754 unsigned short tx_delay;
1757 #if F_CPU == 16000000 1759 static const DELAY_TABLE PROGMEM table[] = {
1761 { 115200, 1, 17, 17, 12, },
1762 { 57600, 10, 37, 37, 33, },
1763 { 38400, 25, 57, 57, 54, },
1764 { 31250, 31, 70, 70, 68, },
1765 { 28800, 34, 77, 77, 74, },
1766 { 19200, 54, 117, 117, 114, },
1767 { 14400, 74, 156, 156, 153, },
1768 { 9600, 114, 236, 236, 233, },
1769 { 4800, 233, 474, 474, 471, },
1770 { 2400, 471, 950, 950, 947, },
1771 { 1200, 947, 1902, 1902, 1899, },
1772 { 600, 1902, 3804, 3804, 3800, },
1773 { 300, 3804, 7617, 7617, 7614, },
1776 const int XMIT_START_ADJUSTMENT = 5;
1778 #elif F_CPU == 8000000 1780 static const DELAY_TABLE table[] PROGMEM = {
1782 { 115200, 1, 5, 5, 3, },
1783 { 57600, 1, 15, 15, 13, },
1784 { 38400, 2, 25, 26, 23, },
1785 { 31250, 7, 32, 33, 29, },
1786 { 28800, 11, 35, 35, 32, },
1787 { 19200, 20, 55, 55, 52, },
1788 { 14400, 30, 75, 75, 72, },
1789 { 9600, 50, 114, 114, 112, },
1790 { 4800, 110, 233, 233, 230, },
1791 { 2400, 229, 472, 472, 469, },
1792 { 1200, 467, 948, 948, 945, },
1793 { 600, 948, 1895, 1895, 1890, },
1794 { 300, 1895, 3805, 3805, 3802, },
1797 const int XMIT_START_ADJUSTMENT = 4;
1799 #elif F_CPU == 20000000 1801 static const DELAY_TABLE PROGMEM table[] = {
1803 { 115200, 3, 21, 21, 18, },
1804 { 57600, 20, 43, 43, 41, },
1805 { 38400, 37, 73, 73, 70, },
1806 { 31250, 45, 89, 89, 88, },
1807 { 28800, 46, 98, 98, 95, },
1808 { 19200, 71, 148, 148, 145, },
1809 { 14400, 96, 197, 197, 194, },
1810 { 9600, 146, 297, 297, 294, },
1811 { 4800, 296, 595, 595, 592, },
1812 { 2400, 592, 1189, 1189, 1186, },
1813 { 1200, 1187, 2379, 2379, 2376, },
1814 { 600, 2379, 4759, 4759, 4755, },
1815 { 300, 4759, 9523, 9523, 9520, },
1818 const int XMIT_START_ADJUSTMENT = 6;
1821 #error This version of SoftwareSerial supports only 20, 16 and 8MHz processors 1828 #if EBOARD_DEBUG_MODE > 0x0 1829 inline void DebugPulse(uint8_t pin, uint8_t count) {
1831 volatile uint8_t *pport = portOutputRegister(digitalPinToPort(pin));
1833 uint8_t val = *pport;
1836 *pport = val | digitalPinToBitMask(pin);
1845 asm volatile(
"sbiw %0, 0x01 \n\t" 1847 "cpi %A0, 0xFF \n\t" 1850 :
"+r" (delay),
"+a" (tmp)
1859 uint8_t oldSREG = SREG;
1872 #if GCC_VERSION < 40302 1890 #if EBOARD_DEBUG_MODE > 0x0 1891 DebugPulse(_DEBUG_PIN2, 1);
1894 for (uint8_t i=0x1; i; i <<= 1)
1897 #if EBOARD_DEBUG_MODE > 0x0 1898 DebugPulse(_DEBUG_PIN2, 1);
1909 #if EBOARD_DEBUG_MODE > 0x0 1910 DebugPulse(_DEBUG_PIN2, 1);
1920 #if EBOARD_DEBUG_MODE > 0x0 1921 #if _DEBUG // for scope: pulse pin as overflow indictator 1922 DebugPulse(_DEBUG_PIN1, 1);
1929 #if GCC_VERSION < 40302 1944 if (pin_state == LOW)
1960 #if defined(PCINT0_vect) 1966 #if defined(PCINT1_vect) 1972 #if defined(PCINT2_vect) 1978 #if defined(PCINT3_vect) 1985 _rx_delay_centering(0),
1986 _rx_delay_intrabit(0),
1987 _rx_delay_stopbit(0),
1989 _buffer_overflow(false),
1990 _inverse_logic(inverse_logic) {
1995 SoftwareSerial::~SoftwareSerial() {
2000 pinMode(tx, OUTPUT);
2001 digitalWrite(tx, HIGH);
2003 uint8_t port = digitalPinToPort(tx);
2010 digitalWrite(rx, HIGH);
2013 uint8_t port = digitalPinToPort(rx);
2020 for (
unsigned i=0; i<
sizeof(table)/
sizeof(table[0]); ++i) {
2021 long baud = pgm_read_dword(&table[i].baud);
2022 if (baud == speed) {
2026 _tx_delay = pgm_read_word(&table[i].tx_delay);
2040 pinMode(_DEBUG_PIN1, OUTPUT);
2041 pinMode(_DEBUG_PIN2, OUTPUT);
2078 uint8_t oldSREG = SREG;
2085 for (byte mask = 0x01; mask; mask <<= 1) {
2097 for (byte mask = 0x01; mask; mask <<= 1) {
2118 uint8_t oldSREG = SREG;
2143 #if EBOARD_DEBUG_MODE > 0x0 2147 #define __ASSERT_USE_STDERR 2166 void __assert (
const char *__func,
const char *__file,
optVAL_t __lineno,
const char *__sexp);
2168 void __assert (
const char *__func,
const char *__file,
optVAL_t __lineno,
const char *__sexp){
2169 Serial.print(
"Error with: "); Serial.print(__func);
2170 Serial.print(
" in "); Serial.print(__file);
2171 Serial.print(
" @"); Serial.println(__lineno, DEC);
2172 Serial.print(
" >>");
2173 Serial.println(__sexp);
2174 if(strcmp(__func,
"checkIdx")==0){
2175 Serial.println(
" This happens if an out of bounds exception");
2176 Serial.println(
" has occured. Following pins shouldn't be used:");
2179 Serial.println(
" : Used for Bluetooth communication");
2180 Serial.print(
" D");Serial.print(
PIN_MOTOR_DIR);Serial.print(
"&");
2182 Serial.println(
" : Used for main motor control");
2183 #if EBOARD_USE_SPI > 0x0 2184 Serial.print(
" D10-13");
2185 Serial.println(
": Used for smart-servo-shield");
2187 }
else if (strcmp(__func,
"readPin")==0){
2188 Serial.println(
"You've tried to access an analogPin that isn't present on the board you're currently working on!");
2205 #if EBOARD_DEBUG_MODE > 0x0 2206 assert(idx>=0x0 && idx <
PIN_MAX);
2212 #if EBOARD_COPY_AND_PASTE > 0x0 2213 #if EBOARD_CHECK_PINS_PWM > 0x0 2224 for (count = 0; x; count++)
2231 #if EBOARD_CHECK_PINS > 0x0 2237 #if defined(__AVR_ATmega328P__) && not defined(__AVR_ATmega2560__) 2239 #elif defined(__AVR_ATmega2560__) 2245 #if defined(__AVR_ATmega328P__) && not defined(__AVR_ATmega2560__) 2247 #elif defined(__AVR_ATmega2560__) 2264 return (mode == OUTPUT)? ((
pin_out & (1<<idx))>0x0):((
pin_in & (1<<idx))>0x0);
2277 #if EBOARD_CHECK_PINS > 0x0 2293 #if EBOARD_BLUETOOTH > 0x0 2302 inline char readVal(
char oF =
'.');
2315 template <
typename T>
2316 inline void writeVal(
const T& val);
2332 #if (EBOARD_BLUETOOTH > 0x0) && (((PIN_BLUETOOTH_RX==0x13) && (PIN_BLUETOOTH_TX==0x12)) && defined(__AVR_ATmega2560__)) 2338 inline char readVal(
char oF) {
2339 #if (EBOARD_BLUETOOTH > 0x0) && (((PIN_BLUETOOTH_RX==0x13) && (PIN_BLUETOOTH_TX==0x12)) && defined(__AVR_ATmega2560__)) 2340 return ((Serial1.available())?(Serial1.read()):(oF));
2345 template<
typename T>
2346 inline void writeVal(
const T& val){
2347 #if (EBOARD_BLUETOOTH > 0x0) && (((PIN_BLUETOOTH_RX==0x13) && (PIN_BLUETOOTH_TX==0x12)) && defined(__AVR_ATmega2560__)) 2354 #if PIN_BLUETOOTH_RX != PIN_BLUETOOTH_STATE 2363 #if EBOARD_SHIFT_REGISTER > 0x0 2411 val = min(val,0xFF); val = max(0x0,val);
2416 extern void rept_task(
void);
2419 ISR(TIMER1_COMPA_vect) {
2442 #if EBOARD_SHIFT_REGISTER > 0x0 2449 #if EBOARD_CHECK_PINS > 0x0 2453 #if EBOARD_COPY_AND_PASTE > 0x0 2456 pinMode(idx,OUTPUT);
2458 digitalWrite(idx,val);
2474 #if EBOARD_CHECK_PINS > 0x0 2476 #if defined (__AVR_ATmega2560__) 2477 else if (idx<0||idx>0xF){
2479 else if (idx<0||idx>0x7){
2481 #if EBOARD_DEBUG_MODE > 0x0 2488 #if EBOARD_COPY_AND_PASTE > 0x0 2493 return((dig)? digitalRead(idx) : analogRead(idx));
2497 #if EBOARD_USE_SPI > 0x0 && (EBOARD_NANO == 0x0) 2533 #if defined(__AVR_ATmega2560__) 2631 this->velocity_temp = 0x96;
2632 this->upperLimit_temp = 0x12C;
2635 void ServoCds55::begin() {
2636 pinMode(this->
cs,OUTPUT);
2637 digitalWrite(this->
cs,HIGH);
2644 delayMicroseconds (20);
2658 digitalWrite(this->
cs, LOW);
2662 digitalWrite(this->
cs, HIGH);
2667 digitalWrite(this->
cs, LOW);
2671 digitalWrite(this->
cs, HIGH);
2676 digitalWrite(this->
cs, LOW);
2680 digitalWrite(this->
cs, HIGH);
2685 digitalWrite(this->
cs, LOW);
2688 digitalWrite(this->
cs, HIGH);
2693 digitalWrite(this->
cs, LOW);
2696 digitalWrite(this->
cs, HIGH);
2705 #if EBOARD_COPY_AND_PASTE > 0x0 && EBOARD_NANO == 0 2737 #if EBOARD_USE_UTILITY > 0x0 or defined(__AVR_ATmega2560__) //won't shrink space... just speed things up 2746 inline void led(
int idx,
bool state);
2754 inline void ledOn(
int idx);
2762 inline void ledOff(
int idx);
2768 inline void ledsOff(
void);
2774 inline void ledMeter(
int);
2777 #if EBOARD_USE_UTILITY > 0x0 2778 inline void button(
int);
2781 inline void waitForButton(
int);
2793 inline void motor(uint8_t
id,int16_t val);
2795 inline void motorsOff(
void);
2810 inline void power(
optVAL_t id,
bool state);
2836 inline void sleep(uint16_t t);
2842 inline void msleep(uint16_t t);
2860 inline void reset(
void);
2865 #if defined(__AVR_ATmega2560__) 2871 #elif EBOARD_USE_UTILITY > 0x0 2879 #if EBOARD_USE_UTILITY > 0x0 2886 else if(
id>0&&
id<3&&(val>-0 && val < 1024)) {
_servoHandler.
write((
id-1),(val *600/1023 - 300));}
2891 #if EBOARD_USE_RESET > 0x0 2892 wdt_enable(WDTO_15MS);
2908 #define DIGITAL_IN 0x0 2909 #define DIGITAL_IN_INV 0x1 2911 #define DIGITAL_IN_PULLUP 0x2 2913 #define DIGITAL_IN_PULLUP_INV 0x3 2915 #define DIGITAL_OUT 0x4 2917 #define DIGITAL_OUT_INV 0x5 2919 #define DIGITAL_OUT_LOW 0x6 2921 #define DIGITAL_OUT_HIGH 0x7 2923 #define ANALOG_IN_8_BIT 0x8 2925 #define ANALOG_IN_10_BIT 0x9 2927 #define ANALOG_IN_MEAN_8_BIT 0xA 2929 #define ANALOG_IN_MEAN_10_BIT 0xB 2931 #define COUNTER_8_BIT 0xC 2933 #define COUNTER_16_BIT 0xD 2935 #define COUNTER_RISE_8_BIT 0xE 2937 #define COUNTER_RISE_16_BIT 0xF 2939 #define PWM_SLOW 0x8 2941 #define PWM_FAST 0x9 2943 #define FREQ_LOW 0xA 2945 #define FREQ_HIGH 0xB 2947 #define COUNTER_B_DIR 0xC 2949 #define COUNTER_B_DIR_PULLUP 0xD 2951 #define COUNTER_MEAN_8_BIT 0xE 2953 #define COUNTER_MEAN_16_BIT 0xF 2986 #if EBOARD_USE_UTILITY > 0x0 2987 inline void read(
void);
2990 inline void changeAddress(
optVAL_t);
2998 inline void write(
void);
3010 this->A=0x0;this->B=0x0;this->C=0x0;
3012 #if EBOARD_USE_UTILITY > 0x0 3065 #if EBOARD_USE_UTILITY > 0x0 3082 inline void changeMotorID(
optVAL_t newID);
3088 inline void setPositionMode(
void);
3094 inline void setSpeedMode(
void);
3102 inline void ledOff(
void);
3104 inline void ledOn(
void);
3106 inline void setTorque(uint16_t);
3116 void setPosition(
int pos,
int speed=0x3FF);
3124 inline void storePosition(
int pos,
int speed = 0x3FF);
3138 inline bool isMoving(
void);
3166 #if EBOARD_USE_UTILITY > 0x0 3179 #if EBOARD_CLAMP > 0x0 3180 if(pos>1023 || speed > 1023)
return;
3181 this->actPos=pos; this->storedPos=pos; this->storedSpe = speed;
3182 speed = speed*600/1023 - 300;
3183 pos = pos *600/1023 - 300;
3186 if(pos>300 || speed > 300)
return;
3187 this->actPos=pos; this->storedPos=pos; this->storedSpe = speed;
3193 return this->actPos;
3226 #if EBOARD_USE_UTILITY > 0x0 3230 inline void changeMotorID(
optVAL_t);
3236 inline void action(
void);
3254 #if EBOARD_USE_UTILITY > 0x0 3262 if(this->connected[i] != NULL)
3279 #if EBOARD_BLUETOOTH > 0x0 3324 inline void write(
const char*
const val);
3342 #if EBOARD_I2C > 0x0 3388 for (byte i = 1; (i < 255 && !
STOP); i++) {
3392 if(count < ret_len) ret[count] = i;
3430 #if EBOARD_LCD > 0x0 3433 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
3434 {0x00,0x00,0x5F,0x00,0x00,0x00,0x00,0x00},
3435 {0x00,0x00,0x07,0x00,0x07,0x00,0x00,0x00},
3436 {0x00,0x14,0x7F,0x14,0x7F,0x14,0x00,0x00},
3437 {0x00,0x24,0x2A,0x7F,0x2A,0x12,0x00,0x00},
3438 {0x00,0x23,0x13,0x08,0x64,0x62,0x00,0x00},
3439 {0x00,0x36,0x49,0x55,0x22,0x50,0x00,0x00},
3440 {0x00,0x00,0x05,0x03,0x00,0x00,0x00,0x00},
3441 {0x00,0x1C,0x22,0x41,0x00,0x00,0x00,0x00},
3442 {0x00,0x41,0x22,0x1C,0x00,0x00,0x00,0x00},
3443 {0x00,0x08,0x2A,0x1C,0x2A,0x08,0x00,0x00},
3444 {0x00,0x08,0x08,0x3E,0x08,0x08,0x00,0x00},
3445 {0x00,0xA0,0x60,0x00,0x00,0x00,0x00,0x00},
3446 {0x00,0x08,0x08,0x08,0x08,0x08,0x00,0x00},
3447 {0x00,0x60,0x60,0x00,0x00,0x00,0x00,0x00},
3448 {0x00,0x20,0x10,0x08,0x04,0x02,0x00,0x00},
3449 {0x00,0x3E,0x51,0x49,0x45,0x3E,0x00,0x00},
3450 {0x00,0x00,0x42,0x7F,0x40,0x00,0x00,0x00},
3451 {0x00,0x62,0x51,0x49,0x49,0x46,0x00,0x00},
3452 {0x00,0x22,0x41,0x49,0x49,0x36,0x00,0x00},
3453 {0x00,0x18,0x14,0x12,0x7F,0x10,0x00,0x00},
3454 {0x00,0x27,0x45,0x45,0x45,0x39,0x00,0x00},
3455 {0x00,0x3C,0x4A,0x49,0x49,0x30,0x00,0x00},
3456 {0x00,0x01,0x71,0x09,0x05,0x03,0x00,0x00},
3457 {0x00,0x36,0x49,0x49,0x49,0x36,0x00,0x00},
3458 {0x00,0x06,0x49,0x49,0x29,0x1E,0x00,0x00},
3459 {0x00,0x00,0x36,0x36,0x00,0x00,0x00,0x00},
3460 {0x00,0x00,0xAC,0x6C,0x00,0x00,0x00,0x00},
3461 {0x00,0x08,0x14,0x22,0x41,0x00,0x00,0x00},
3462 {0x00,0x14,0x14,0x14,0x14,0x14,0x00,0x00},
3463 {0x00,0x41,0x22,0x14,0x08,0x00,0x00,0x00},
3464 {0x00,0x02,0x01,0x51,0x09,0x06,0x00,0x00},
3465 {0x00,0x32,0x49,0x79,0x41,0x3E,0x00,0x00},
3466 {0x00,0x7E,0x09,0x09,0x09,0x7E,0x00,0x00},
3467 {0x00,0x7F,0x49,0x49,0x49,0x36,0x00,0x00},
3468 {0x00,0x3E,0x41,0x41,0x41,0x22,0x00,0x00},
3469 {0x00,0x7F,0x41,0x41,0x22,0x1C,0x00,0x00},
3470 {0x00,0x7F,0x49,0x49,0x49,0x41,0x00,0x00},
3471 {0x00,0x7F,0x09,0x09,0x09,0x01,0x00,0x00},
3472 {0x00,0x3E,0x41,0x41,0x51,0x72,0x00,0x00},
3473 {0x00,0x7F,0x08,0x08,0x08,0x7F,0x00,0x00},
3474 {0x00,0x41,0x7F,0x41,0x00,0x00,0x00,0x00},
3475 {0x00,0x20,0x40,0x41,0x3F,0x01,0x00,0x00},
3476 {0x00,0x7F,0x08,0x14,0x22,0x41,0x00,0x00},
3477 {0x00,0x7F,0x40,0x40,0x40,0x40,0x00,0x00},
3478 {0x00,0x7F,0x02,0x0C,0x02,0x7F,0x00,0x00},
3479 {0x00,0x7F,0x04,0x08,0x10,0x7F,0x00,0x00},
3480 {0x00,0x3E,0x41,0x41,0x41,0x3E,0x00,0x00},
3481 {0x00,0x7F,0x09,0x09,0x09,0x06,0x00,0x00},
3482 {0x00,0x3E,0x41,0x51,0x21,0x5E,0x00,0x00},
3483 {0x00,0x7F,0x09,0x19,0x29,0x46,0x00,0x00},
3484 {0x00,0x26,0x49,0x49,0x49,0x32,0x00,0x00},
3485 {0x00,0x01,0x01,0x7F,0x01,0x01,0x00,0x00},
3486 {0x00,0x3F,0x40,0x40,0x40,0x3F,0x00,0x00},
3487 {0x00,0x1F,0x20,0x40,0x20,0x1F,0x00,0x00},
3488 {0x00,0x3F,0x40,0x38,0x40,0x3F,0x00,0x00},
3489 {0x00,0x63,0x14,0x08,0x14,0x63,0x00,0x00},
3490 {0x00,0x03,0x04,0x78,0x04,0x03,0x00,0x00},
3491 {0x00,0x61,0x51,0x49,0x45,0x43,0x00,0x00},
3492 {0x00,0x7F,0x41,0x41,0x00,0x00,0x00,0x00},
3493 {0x00,0x02,0x04,0x08,0x10,0x20,0x00,0x00},
3494 {0x00,0x41,0x41,0x7F,0x00,0x00,0x00,0x00},
3495 {0x00,0x04,0x02,0x01,0x02,0x04,0x00,0x00},
3496 {0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00},
3497 {0x00,0x01,0x02,0x04,0x00,0x00,0x00,0x00},
3498 {0x00,0x20,0x54,0x54,0x54,0x78,0x00,0x00},
3499 {0x00,0x7F,0x48,0x44,0x44,0x38,0x00,0x00},
3500 {0x00,0x38,0x44,0x44,0x28,0x00,0x00,0x00},
3501 {0x00,0x38,0x44,0x44,0x48,0x7F,0x00,0x00},
3502 {0x00,0x38,0x54,0x54,0x54,0x18,0x00,0x00},
3503 {0x00,0x08,0x7E,0x09,0x02,0x00,0x00,0x00},
3504 {0x00,0x18,0xA4,0xA4,0xA4,0x7C,0x00,0x00},
3505 {0x00,0x7F,0x08,0x04,0x04,0x78,0x00,0x00},
3506 {0x00,0x00,0x7D,0x00,0x00,0x00,0x00,0x00},
3507 {0x00,0x80,0x84,0x7D,0x00,0x00,0x00,0x00},
3508 {0x00,0x7F,0x10,0x28,0x44,0x00,0x00,0x00},
3509 {0x00,0x41,0x7F,0x40,0x00,0x00,0x00,0x00},
3510 {0x00,0x7C,0x04,0x18,0x04,0x78,0x00,0x00},
3511 {0x00,0x7C,0x08,0x04,0x7C,0x00,0x00,0x00},
3512 {0x00,0x38,0x44,0x44,0x38,0x00,0x00,0x00},
3513 {0x00,0xFC,0x24,0x24,0x18,0x00,0x00,0x00},
3514 {0x00,0x18,0x24,0x24,0xFC,0x00,0x00,0x00},
3515 {0x00,0x00,0x7C,0x08,0x04,0x00,0x00,0x00},
3516 {0x00,0x48,0x54,0x54,0x24,0x00,0x00,0x00},
3517 {0x00,0x04,0x7F,0x44,0x00,0x00,0x00,0x00},
3518 {0x00,0x3C,0x40,0x40,0x7C,0x00,0x00,0x00},
3519 {0x00,0x1C,0x20,0x40,0x20,0x1C,0x00,0x00},
3520 {0x00,0x3C,0x40,0x30,0x40,0x3C,0x00,0x00},
3521 {0x00,0x44,0x28,0x10,0x28,0x44,0x00,0x00},
3522 {0x00,0x1C,0xA0,0xA0,0x7C,0x00,0x00,0x00},
3523 {0x00,0x44,0x64,0x54,0x4C,0x44,0x00,0x00},
3524 {0x00,0x08,0x36,0x41,0x00,0x00,0x00,0x00},
3525 {0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00},
3526 {0x00,0x41,0x36,0x08,0x00,0x00,0x00,0x00},
3527 {0x00,0x02,0x01,0x01,0x02,0x01,0x00,0x00},
3528 {0x00,0x02,0x05,0x05,0x02,0x00,0x00,0x00}
3793 #define LCD_COMMAND_MODE 0x80 3794 #define LCD_DATA_MODE 0x40 3796 #define LCD_COMMAND_DISPLAY_OFF 0xAE 3798 #define LCD_COMMAND_DISPLAY_ON 0xAF 3800 #define LCD_COMMAND_BLACK_BACKGROUND 0xA6 3802 #define LCD_COMMAND_WHITE_BACKGROUND 0xA7 3804 #define LCD_COMMAND_SET_BRIGHTNESS 0x81 3806 #define LCD_PAGE_ADDRESSING 0x02 3808 #define LCD_HORIZONTAL_ADDRESSING 0x00 3812 #define LCD_COMMAND_CHARGE_PUMP_SETTING 0x8d 3813 #define LCD_COMMAND_CHARGE_PUMP_ENABLE 0x14 3817 #define LCD_WIDTH 128 3821 #define LCD_HEIGHT 64 3865 #if EBOARD_NANO == 0 3903 inline bool clear(
void);
3909 inline void print(
const char* data);
3915 inline void print(
int data);
3960 inline bool reset(
void);
3975 inline bool init(
void);
3985 inline void drawBitmap(
const unsigned char *bitmap, byte posX, byte posY, byte hiX, byte hiY);
4007 inline bool setCursor(byte posX = 0x0, byte posY = 0x0);
4068 #if EBOARD_NANO == 0x0 4083 return this->
init();
4087 for(byte i = 0; i < 8; i++){
4091 for (byte j = 0; j < 128; j++) {
4112 if(data[i] < 32 || data[i] > 127){ i++;
continue;}
4113 for (byte j = 0; j < 8; j++){
4120 char buffer[11] =
"";
4121 itoa(data,buffer,10);
4122 this->
print(line,col,buffer);
4131 return this->
clear();
4148 return this->
clear();
4151 inline void LCD::drawBitmap(
const unsigned char *bitmap, byte posX, byte posY, byte hiX, byte hiY){
4155 for(
int i = 0x0; i < (hiX * 8 * hiY); i++){
4156 this->
s1Dat(pgm_read_byte(&bitmap[i]));
4157 if(++col == (hiX * 8)) {
4170 this->
s2Cmd((0x00 + (8 *posX & 0x0F)),(0x10 + ((8 * posX >> 4) & 0x0F)));
4173 this->
pX = posX; this->
pY = posY;
4179 this->
s2Cmd(0x81,val);
4210 #if EBOARD_NEO > 0x0 4215 #define EBOARD_NEO_RGB ((0 << 6) | (0 << 4) | (1 << 2) | (2)) 4216 #define EBOARD_NEO_RBG ((0 << 6) | (0 << 4) | (2 << 2) | (1)) 4218 #define EBOARD_NEO_GRB ((1 << 6) | (1 << 4) | (0 << 2) | (2)) 4220 #define EBOARD_NEO_GBR ((2 << 6) | (2 << 4) | (0 << 2) | (1)) 4222 #define EBOARD_NEO_BRG ((1 << 6) | (1 << 4) | (2 << 2) | (0)) 4224 #define EBOARD_NEO_BGR ((2 << 6) | (2 << 4) | (1 << 2) | (0)) 4230 #define EBOARD_NEO_WRGB ((0 << 6) | (1 << 4) | (2 << 2) | (3)) 4231 #define EBOARD_NEO_WRBG ((0 << 6) | (1 << 4) | (3 << 2) | (2)) 4233 #define EBOARD_NEO_WGRB ((0 << 6) | (2 << 4) | (1 << 2) | (3)) 4235 #define EBOARD_NEO_WGBR ((0 << 6) | (3 << 4) | (1 << 2) | (2)) 4237 #define EBOARD_NEO_WBRG ((0 << 6) | (2 << 4) | (3 << 2) | (1)) 4239 #define EBOARD_NEO_WBGR ((0 << 6) | (3 << 4) | (2 << 2) | (1)) 4241 #define EBOARD_NEO_RWGB ((1 << 6) | (0 << 4) | (2 << 2) | (3)) 4243 #define EBOARD_NEO_RWBG ((1 << 6) | (0 << 4) | (3 << 2) | (2)) 4245 #define EBOARD_NEO_RGWB ((2 << 6) | (0 << 4) | (1 << 2) | (3)) 4247 #define EBOARD_NEO_RGBW ((3 << 6) | (0 << 4) | (1 << 2) | (2)) 4249 #define EBOARD_NEO_RBWG ((2 << 6) | (0 << 4) | (3 << 2) | (1)) 4251 #define EBOARD_NEO_RBGW ((3 << 6) | (0 << 4) | (2 << 2) | (1)) 4253 #define EBOARD_NEO_GWRB ((1 << 6) | (2 << 4) | (0 << 2) | (3)) 4255 #define EBOARD_NEO_GWBR ((1 << 6) | (3 << 4) | (0 << 2) | (2)) 4257 #define EBOARD_NEO_GRWB ((2 << 6) | (1 << 4) | (0 << 2) | (3)) 4259 #define EBOARD_NEO_GRBW ((3 << 6) | (1 << 4) | (0 << 2) | (2)) 4261 #define EBOARD_NEO_GBWR ((2 << 6) | (3 << 4) | (0 << 2) | (1)) 4263 #define EBOARD_NEO_GBRW ((3 << 6) | (2 << 4) | (0 << 2) | (1)) 4265 #define EBOARD_NEO_BWRG ((1 << 6) | (2 << 4) | (3 << 2) | (0)) 4267 #define EBOARD_NEO_BWGR ((1 << 6) | (3 << 4) | (2 << 2) | (0)) 4269 #define EBOARD_NEO_BRWG ((2 << 6) | (1 << 4) | (3 << 2) | (0)) 4271 #define EBOARD_NEO_BRGW ((3 << 6) | (1 << 4) | (2 << 2) | (0)) 4273 #define EBOARD_NEO_BGWR ((2 << 6) | (3 << 4) | (1 << 2) | (0)) 4275 #define EBOARD_NEO_BGRW ((3 << 6) | (2 << 4) | (1 << 2) | (0)) 4280 #define EBOARD_NEO_800KHZ 0x0000 4281 #define EBOARD_NEO_400KHZ 0x0100 4351 void setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b);
4360 void setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b, uint8_t w);
4401 uint8_t
sine8(uint8_t x)
const;
4407 uint8_t
gamma8(uint8_t x)
const;
4412 inline int8_t
getPin(
void);
4424 static inline uint32_t
Color(uint8_t r, uint8_t g, uint8_t b);
4432 static inline uint32_t
Color(uint8_t r, uint8_t g, uint8_t b, uint8_t w);
4471 #ifdef __AVR__ //not needed (rem?) 4472 volatile uint8_t *
port;
4484 begun(false), brightness(0), pixels(NULL), endTime(0) {
4494 begun(false), numLEDs(0), numBytes(0), pin(-1), brightness(0), pixels(NULL),
4495 rOffset(1), gOffset(0), bOffset(2), wOffset(1), endTime(0)
4500 if(
pin >= 0) pinMode(
pin, INPUT);
4505 pinMode(
pin, OUTPUT);
4506 digitalWrite(
pin, LOW);
4530 is800KHz = (t < 256);
4538 #if defined(ESP8266) 4540 extern "C" void ICACHE_RAM_ATTR espShow(
4541 uint8_t pin, uint8_t *pixels, uint32_t numBytes, uint8_t type);
4542 #elif defined(ESP32) 4543 extern "C" void espShow(
4544 uint8_t pin, uint8_t *pixels, uint32_t numBytes, uint8_t type);
4561 #if (F_CPU >= 7400000UL) && (F_CPU <= 9500000UL) 4564 volatile uint8_t n1, n2 = 0;
4567 #if defined(PORTB) || defined(PORTC) || defined(PORTF) 4568 if(
port == &PORTD) {
4574 if(b & 0x80) n1 = hi;
4579 "out %[port] , %[hi]" "\n\t" 4580 "mov %[n2] , %[lo]" "\n\t" 4581 "out %[port] , %[n1]" "\n\t" 4583 "sbrc %[byte] , 6" "\n\t" 4584 "mov %[n2] , %[hi]" "\n\t" 4585 "out %[port] , %[lo]" "\n\t" 4588 "out %[port] , %[hi]" "\n\t" 4589 "mov %[n1] , %[lo]" "\n\t" 4590 "out %[port] , %[n2]" "\n\t" 4592 "sbrc %[byte] , 5" "\n\t" 4593 "mov %[n1] , %[hi]" "\n\t" 4594 "out %[port] , %[lo]" "\n\t" 4597 "out %[port] , %[hi]" "\n\t" 4598 "mov %[n2] , %[lo]" "\n\t" 4599 "out %[port] , %[n1]" "\n\t" 4601 "sbrc %[byte] , 4" "\n\t" 4602 "mov %[n2] , %[hi]" "\n\t" 4603 "out %[port] , %[lo]" "\n\t" 4606 "out %[port] , %[hi]" "\n\t" 4607 "mov %[n1] , %[lo]" "\n\t" 4608 "out %[port] , %[n2]" "\n\t" 4610 "sbrc %[byte] , 3" "\n\t" 4611 "mov %[n1] , %[hi]" "\n\t" 4612 "out %[port] , %[lo]" "\n\t" 4615 "out %[port] , %[hi]" "\n\t" 4616 "mov %[n2] , %[lo]" "\n\t" 4617 "out %[port] , %[n1]" "\n\t" 4619 "sbrc %[byte] , 2" "\n\t" 4620 "mov %[n2] , %[hi]" "\n\t" 4621 "out %[port] , %[lo]" "\n\t" 4624 "out %[port] , %[hi]" "\n\t" 4625 "mov %[n1] , %[lo]" "\n\t" 4626 "out %[port] , %[n2]" "\n\t" 4628 "sbrc %[byte] , 1" "\n\t" 4629 "mov %[n1] , %[hi]" "\n\t" 4630 "out %[port] , %[lo]" "\n\t" 4633 "out %[port] , %[hi]" "\n\t" 4634 "mov %[n2] , %[lo]" "\n\t" 4635 "out %[port] , %[n1]" "\n\t" 4637 "sbrc %[byte] , 0" "\n\t" 4638 "mov %[n2] , %[hi]" "\n\t" 4639 "out %[port] , %[lo]" "\n\t" 4640 "sbiw %[count], 1" "\n\t" 4642 "out %[port] , %[hi]" "\n\t" 4643 "mov %[n1] , %[lo]" "\n\t" 4644 "out %[port] , %[n2]" "\n\t" 4645 "ld %[byte] , %a[ptr]+" "\n\t" 4646 "sbrc %[byte] , 7" "\n\t" 4647 "mov %[n1] , %[hi]" "\n\t" 4648 "out %[port] , %[lo]" "\n\t" 4654 : [
port]
"I" (_SFR_IO_ADDR(PORTD)),
4659 #if defined(PORTB) || defined(PORTC) || defined(PORTF) 4664 #if defined(PORTD) || defined(PORTC) || defined(PORTF) 4665 if(
port == &PORTB) {
4666 #endif // defined(PORTD/C/F) 4670 if(b & 0x80) n1 = hi;
4674 "out %[port] , %[hi]" "\n\t" 4675 "mov %[n2] , %[lo]" "\n\t" 4676 "out %[port] , %[n1]" "\n\t" 4678 "sbrc %[byte] , 6" "\n\t" 4679 "mov %[n2] , %[hi]" "\n\t" 4680 "out %[port] , %[lo]" "\n\t" 4682 "out %[port] , %[hi]" "\n\t" 4683 "mov %[n1] , %[lo]" "\n\t" 4684 "out %[port] , %[n2]" "\n\t" 4686 "sbrc %[byte] , 5" "\n\t" 4687 "mov %[n1] , %[hi]" "\n\t" 4688 "out %[port] , %[lo]" "\n\t" 4690 "out %[port] , %[hi]" "\n\t" 4691 "mov %[n2] , %[lo]" "\n\t" 4692 "out %[port] , %[n1]" "\n\t" 4694 "sbrc %[byte] , 4" "\n\t" 4695 "mov %[n2] , %[hi]" "\n\t" 4696 "out %[port] , %[lo]" "\n\t" 4698 "out %[port] , %[hi]" "\n\t" 4699 "mov %[n1] , %[lo]" "\n\t" 4700 "out %[port] , %[n2]" "\n\t" 4702 "sbrc %[byte] , 3" "\n\t" 4703 "mov %[n1] , %[hi]" "\n\t" 4704 "out %[port] , %[lo]" "\n\t" 4706 "out %[port] , %[hi]" "\n\t" 4707 "mov %[n2] , %[lo]" "\n\t" 4708 "out %[port] , %[n1]" "\n\t" 4710 "sbrc %[byte] , 2" "\n\t" 4711 "mov %[n2] , %[hi]" "\n\t" 4712 "out %[port] , %[lo]" "\n\t" 4714 "out %[port] , %[hi]" "\n\t" 4715 "mov %[n1] , %[lo]" "\n\t" 4716 "out %[port] , %[n2]" "\n\t" 4718 "sbrc %[byte] , 1" "\n\t" 4719 "mov %[n1] , %[hi]" "\n\t" 4720 "out %[port] , %[lo]" "\n\t" 4722 "out %[port] , %[hi]" "\n\t" 4723 "mov %[n2] , %[lo]" "\n\t" 4724 "out %[port] , %[n1]" "\n\t" 4726 "sbrc %[byte] , 0" "\n\t" 4727 "mov %[n2] , %[hi]" "\n\t" 4728 "out %[port] , %[lo]" "\n\t" 4729 "sbiw %[count], 1" "\n\t" 4730 "out %[port] , %[hi]" "\n\t" 4731 "mov %[n1] , %[lo]" "\n\t" 4732 "out %[port] , %[n2]" "\n\t" 4733 "ld %[byte] , %a[ptr]+" "\n\t" 4734 "sbrc %[byte] , 7" "\n\t" 4735 "mov %[n1] , %[hi]" "\n\t" 4736 "out %[port] , %[lo]" "\n\t" 4738 : [byte]
"+r" (b), [n1]
"+r" (n1), [n2]
"+r" (n2), [count]
"+w" (i)
4739 : [
port]
"I" (_SFR_IO_ADDR(PORTB)), [ptr]
"e" (ptr), [hi]
"r" (hi),
4742 #if defined(PORTD) || defined(PORTC) || defined(PORTF) 4745 #if defined(PORTC) || defined(PORTF) 4751 #if defined(PORTD) || defined(PORTB) || defined(PORTF) 4752 if(
port == &PORTC) {
4758 if(b & 0x80) n1 = hi;
4762 "out %[port] , %[hi]" "\n\t" 4763 "mov %[n2] , %[lo]" "\n\t" 4764 "out %[port] , %[n1]" "\n\t" 4766 "sbrc %[byte] , 6" "\n\t" 4767 "mov %[n2] , %[hi]" "\n\t" 4768 "out %[port] , %[lo]" "\n\t" 4770 "out %[port] , %[hi]" "\n\t" 4771 "mov %[n1] , %[lo]" "\n\t" 4772 "out %[port] , %[n2]" "\n\t" 4774 "sbrc %[byte] , 5" "\n\t" 4775 "mov %[n1] , %[hi]" "\n\t" 4776 "out %[port] , %[lo]" "\n\t" 4778 "out %[port] , %[hi]" "\n\t" 4779 "mov %[n2] , %[lo]" "\n\t" 4780 "out %[port] , %[n1]" "\n\t" 4782 "sbrc %[byte] , 4" "\n\t" 4783 "mov %[n2] , %[hi]" "\n\t" 4784 "out %[port] , %[lo]" "\n\t" 4786 "out %[port] , %[hi]" "\n\t" 4787 "mov %[n1] , %[lo]" "\n\t" 4788 "out %[port] , %[n2]" "\n\t" 4790 "sbrc %[byte] , 3" "\n\t" 4791 "mov %[n1] , %[hi]" "\n\t" 4792 "out %[port] , %[lo]" "\n\t" 4794 "out %[port] , %[hi]" "\n\t" 4795 "mov %[n2] , %[lo]" "\n\t" 4796 "out %[port] , %[n1]" "\n\t" 4798 "sbrc %[byte] , 2" "\n\t" 4799 "mov %[n2] , %[hi]" "\n\t" 4800 "out %[port] , %[lo]" "\n\t" 4802 "out %[port] , %[hi]" "\n\t" 4803 "mov %[n1] , %[lo]" "\n\t" 4804 "out %[port] , %[n2]" "\n\t" 4806 "sbrc %[byte] , 1" "\n\t" 4807 "mov %[n1] , %[hi]" "\n\t" 4808 "out %[port] , %[lo]" "\n\t" 4810 "out %[port] , %[hi]" "\n\t" 4811 "mov %[n2] , %[lo]" "\n\t" 4812 "out %[port] , %[n1]" "\n\t" 4814 "sbrc %[byte] , 0" "\n\t" 4815 "mov %[n2] , %[hi]" "\n\t" 4816 "out %[port] , %[lo]" "\n\t" 4817 "sbiw %[count], 1" "\n\t" 4818 "out %[port] , %[hi]" "\n\t" 4819 "mov %[n1] , %[lo]" "\n\t" 4820 "out %[port] , %[n2]" "\n\t" 4821 "ld %[byte] , %a[ptr]+" "\n\t" 4822 "sbrc %[byte] , 7" "\n\t" 4823 "mov %[n1] , %[hi]" "\n\t" 4824 "out %[port] , %[lo]" "\n\t" 4826 : [byte]
"+r" (b), [n1]
"+r" (n1), [n2]
"+r" (n2), [count]
"+w" (i)
4827 : [
port]
"I" (_SFR_IO_ADDR(PORTC)), [ptr]
"e" (ptr), [hi]
"r" (hi),
4830 #if defined(PORTD) || defined(PORTB) || defined(PORTF) 4839 #if defined(PORTD) || defined(PORTB) || defined(PORTC) 4840 if(
port == &PORTF) {
4841 #endif // defined(PORTD/B/C) 4846 if(b & 0x80) n1 = hi;
4850 "out %[port] , %[hi]" "\n\t" 4851 "mov %[n2] , %[lo]" "\n\t" 4852 "out %[port] , %[n1]" "\n\t" 4854 "sbrc %[byte] , 6" "\n\t" 4855 "mov %[n2] , %[hi]" "\n\t" 4856 "out %[port] , %[lo]" "\n\t" 4858 "out %[port] , %[hi]" "\n\t" 4859 "mov %[n1] , %[lo]" "\n\t" 4860 "out %[port] , %[n2]" "\n\t" 4862 "sbrc %[byte] , 5" "\n\t" 4863 "mov %[n1] , %[hi]" "\n\t" 4864 "out %[port] , %[lo]" "\n\t" 4866 "out %[port] , %[hi]" "\n\t" 4867 "mov %[n2] , %[lo]" "\n\t" 4868 "out %[port] , %[n1]" "\n\t" 4870 "sbrc %[byte] , 4" "\n\t" 4871 "mov %[n2] , %[hi]" "\n\t" 4872 "out %[port] , %[lo]" "\n\t" 4874 "out %[port] , %[hi]" "\n\t" 4875 "mov %[n1] , %[lo]" "\n\t" 4876 "out %[port] , %[n2]" "\n\t" 4878 "sbrc %[byte] , 3" "\n\t" 4879 "mov %[n1] , %[hi]" "\n\t" 4880 "out %[port] , %[lo]" "\n\t" 4882 "out %[port] , %[hi]" "\n\t" 4883 "mov %[n2] , %[lo]" "\n\t" 4884 "out %[port] , %[n1]" "\n\t" 4886 "sbrc %[byte] , 2" "\n\t" 4887 "mov %[n2] , %[hi]" "\n\t" 4888 "out %[port] , %[lo]" "\n\t" 4890 "out %[port] , %[hi]" "\n\t" 4891 "mov %[n1] , %[lo]" "\n\t" 4892 "out %[port] , %[n2]" "\n\t" 4894 "sbrc %[byte] , 1" "\n\t" 4895 "mov %[n1] , %[hi]" "\n\t" 4896 "out %[port] , %[lo]" "\n\t" 4898 "out %[port] , %[hi]" "\n\t" 4899 "mov %[n2] , %[lo]" "\n\t" 4900 "out %[port] , %[n1]" "\n\t" 4902 "sbrc %[byte] , 0" "\n\t" 4903 "mov %[n2] , %[hi]" "\n\t" 4904 "out %[port] , %[lo]" "\n\t" 4905 "sbiw %[count], 1" "\n\t" 4906 "out %[port] , %[hi]" "\n\t" 4907 "mov %[n1] , %[lo]" "\n\t" 4908 "out %[port] , %[n2]" "\n\t" 4909 "ld %[byte] , %a[ptr]+" "\n\t" 4910 "sbrc %[byte] , 7" "\n\t" 4911 "mov %[n1] , %[hi]" "\n\t" 4912 "out %[port] , %[lo]" "\n\t" 4914 : [byte]
"+r" (b), [n1]
"+r" (n1), [n2]
"+r" (n2), [count]
"+w" (i)
4915 : [
port]
"I" (_SFR_IO_ADDR(PORTF)), [ptr]
"e" (ptr), [hi]
"r" (hi),
4918 #if defined(PORTD) || defined(PORTB) || defined(PORTC) 4920 #endif // defined(PORTD/B/C) 4921 #endif // defined(PORTF) 4924 volatile uint8_t next, bit;
4933 "st %a[port], %[hi]" "\n\t" 4934 "sbrc %[byte] , 7" "\n\t" 4935 "mov %[next], %[hi]" "\n\t" 4936 "st %a[port], %[next]" "\n\t" 4937 "mov %[next] , %[lo]" "\n\t" 4939 "breq nextbyte20" "\n\t" 4940 "rol %[byte]" "\n\t" 4941 "st %a[port], %[lo]" "\n\t" 4945 "rjmp head20" "\n\t" 4946 "nextbyte20:" "\n\t" 4947 "st %a[port], %[lo]" "\n\t" 4949 "ldi %[bit] , 8" "\n\t" 4950 "ld %[byte] , %a[ptr]+" "\n\t" 4951 "sbiw %[count], 1" "\n\t" 4962 #elif (F_CPU >= 11100000UL) && (F_CPU <= 14300000UL) 4964 volatile uint8_t next;
4969 #if defined(PORTB) || defined(PORTC) || defined(PORTF) 4970 if(
port == &PORTD) {
4976 if(b & 0x80) next = hi;
4979 "out %[port], %[hi]" "\n\t" 4980 "rcall bitTimeD" "\n\t" 4981 "out %[port], %[hi]" "\n\t" 4982 "rcall bitTimeD" "\n\t" 4983 "out %[port], %[hi]" "\n\t" 4984 "rcall bitTimeD" "\n\t" 4985 "out %[port], %[hi]" "\n\t" 4986 "rcall bitTimeD" "\n\t" 4987 "out %[port], %[hi]" "\n\t" 4988 "rcall bitTimeD" "\n\t" 4989 "out %[port], %[hi]" "\n\t" 4990 "rcall bitTimeD" "\n\t" 4991 "out %[port], %[hi]" "\n\t" 4992 "rcall bitTimeD" "\n\t" 4994 "out %[port] , %[hi]" "\n\t" 4996 "ld %[byte] , %a[ptr]+" "\n\t" 4997 "out %[port] , %[next]" "\n\t" 4998 "mov %[next] , %[lo]" "\n\t" 4999 "sbrc %[byte] , 7" "\n\t" 5000 "mov %[next] , %[hi]" "\n\t" 5002 "out %[port] , %[lo]" "\n\t" 5003 "sbiw %[count], 1" "\n\t" 5007 "out %[port], %[next]" "\n\t" 5008 "mov %[next], %[lo]" "\n\t" 5009 "rol %[byte]" "\n\t" 5010 "sbrc %[byte], 7" "\n\t" 5011 "mov %[next], %[hi]" "\n\t" 5013 "out %[port], %[lo]" "\n\t" 5019 : [
port]
"I" (_SFR_IO_ADDR(PORTD)),
5024 #if defined(PORTB) || defined(PORTC) || defined(PORTF) 5030 #if defined(PORTD) || defined(PORTC) || defined(PORTF) 5031 if(
port == &PORTB) {
5037 if(b & 0x80) next = hi;
5041 "out %[port], %[hi]" "\n\t" 5042 "rcall bitTimeB" "\n\t" 5043 "out %[port], %[hi]" "\n\t" 5044 "rcall bitTimeB" "\n\t" 5045 "out %[port], %[hi]" "\n\t" 5046 "rcall bitTimeB" "\n\t" 5047 "out %[port], %[hi]" "\n\t" 5048 "rcall bitTimeB" "\n\t" 5049 "out %[port], %[hi]" "\n\t" 5050 "rcall bitTimeB" "\n\t" 5051 "out %[port], %[hi]" "\n\t" 5052 "rcall bitTimeB" "\n\t" 5053 "out %[port], %[hi]" "\n\t" 5054 "rcall bitTimeB" "\n\t" 5055 "out %[port] , %[hi]" "\n\t" 5057 "ld %[byte] , %a[ptr]+" "\n\t" 5058 "out %[port] , %[next]" "\n\t" 5059 "mov %[next] , %[lo]" "\n\t" 5060 "sbrc %[byte] , 7" "\n\t" 5061 "mov %[next] , %[hi]" "\n\t" 5063 "out %[port] , %[lo]" "\n\t" 5064 "sbiw %[count], 1" "\n\t" 5068 "out %[port], %[next]" "\n\t" 5069 "mov %[next], %[lo]" "\n\t" 5070 "rol %[byte]" "\n\t" 5071 "sbrc %[byte], 7" "\n\t" 5072 "mov %[next], %[hi]" "\n\t" 5074 "out %[port], %[lo]" "\n\t" 5077 : [byte]
"+r" (b), [next]
"+r" (next), [count]
"+w" (i)
5078 : [
port]
"I" (_SFR_IO_ADDR(PORTB)), [ptr]
"e" (ptr), [hi]
"r" (hi),
5081 #if defined(PORTD) || defined(PORTC) || defined(PORTF) 5084 #if defined(PORTC) || defined(PORTF) 5090 #if defined(PORTD) || defined(PORTB) || defined(PORTF) 5091 if(
port == &PORTC) {
5097 if(b & 0x80) next = hi;
5101 "out %[port], %[hi]" "\n\t" 5102 "rcall bitTimeC" "\n\t" 5103 "out %[port], %[hi]" "\n\t" 5104 "rcall bitTimeC" "\n\t" 5105 "out %[port], %[hi]" "\n\t" 5106 "rcall bitTimeC" "\n\t" 5107 "out %[port], %[hi]" "\n\t" 5108 "rcall bitTimeC" "\n\t" 5109 "out %[port], %[hi]" "\n\t" 5110 "rcall bitTimeC" "\n\t" 5111 "out %[port], %[hi]" "\n\t" 5112 "rcall bitTimeC" "\n\t" 5113 "out %[port], %[hi]" "\n\t" 5114 "rcall bitTimeC" "\n\t" 5115 "out %[port] , %[hi]" "\n\t" 5117 "ld %[byte] , %a[ptr]+" "\n\t" 5118 "out %[port] , %[next]" "\n\t" 5119 "mov %[next] , %[lo]" "\n\t" 5120 "sbrc %[byte] , 7" "\n\t" 5121 "mov %[next] , %[hi]" "\n\t" 5123 "out %[port] , %[lo]" "\n\t" 5124 "sbiw %[count], 1" "\n\t" 5128 "out %[port], %[next]" "\n\t" 5129 "mov %[next], %[lo]" "\n\t" 5130 "rol %[byte]" "\n\t" 5131 "sbrc %[byte], 7" "\n\t" 5132 "mov %[next], %[hi]" "\n\t" 5134 "out %[port], %[lo]" "\n\t" 5137 : [byte]
"+r" (b), [next]
"+r" (next), [count]
"+w" (i)
5138 : [
port]
"I" (_SFR_IO_ADDR(PORTC)), [ptr]
"e" (ptr), [hi]
"r" (hi),
5141 #if defined(PORTD) || defined(PORTB) || defined(PORTF) 5150 #if defined(PORTD) || defined(PORTB) || defined(PORTC) 5151 if(
port == &PORTF) {
5157 if(b & 0x80) next = hi;
5161 "out %[port], %[hi]" "\n\t" 5162 "rcall bitTimeC" "\n\t" 5163 "out %[port], %[hi]" "\n\t" 5164 "rcall bitTimeC" "\n\t" 5165 "out %[port], %[hi]" "\n\t" 5166 "rcall bitTimeC" "\n\t" 5167 "out %[port], %[hi]" "\n\t" 5168 "rcall bitTimeC" "\n\t" 5169 "out %[port], %[hi]" "\n\t" 5170 "rcall bitTimeC" "\n\t" 5171 "out %[port], %[hi]" "\n\t" 5172 "rcall bitTimeC" "\n\t" 5173 "out %[port], %[hi]" "\n\t" 5174 "rcall bitTimeC" "\n\t" 5175 "out %[port] , %[hi]" "\n\t" 5177 "ld %[byte] , %a[ptr]+" "\n\t" 5178 "out %[port] , %[next]" "\n\t" 5179 "mov %[next] , %[lo]" "\n\t" 5180 "sbrc %[byte] , 7" "\n\t" 5181 "mov %[next] , %[hi]" "\n\t" 5183 "out %[port] , %[lo]" "\n\t" 5184 "sbiw %[count], 1" "\n\t" 5188 "out %[port], %[next]" "\n\t" 5189 "mov %[next], %[lo]" "\n\t" 5190 "rol %[byte]" "\n\t" 5191 "sbrc %[byte], 7" "\n\t" 5192 "mov %[next], %[hi]" "\n\t" 5194 "out %[port], %[lo]" "\n\t" 5197 : [byte]
"+r" (b), [next]
"+r" (next), [count]
"+w" (i)
5198 : [
port]
"I" (_SFR_IO_ADDR(PORTF)), [ptr]
"e" (ptr), [hi]
"r" (hi),
5201 #if defined(PORTD) || defined(PORTB) || defined(PORTC) 5206 volatile uint8_t next, bit;
5215 "st %a[port], %[hi]" "\n\t" 5216 "sbrc %[byte] , 7" "\n\t" 5217 "mov %[next], %[hi]" "\n\t" 5219 "st %a[port], %[next]" "\n\t" 5224 "st %a[port], %[lo]" "\n\t" 5227 "breq nextbyte30" "\n\t" 5228 "rol %[byte]" "\n\t" 5232 "rjmp head30" "\n\t" 5233 "nextbyte30:" "\n\t" 5235 "ldi %[bit] , 8" "\n\t" 5236 "ld %[byte] , %a[ptr]+" "\n\t" 5237 "sbiw %[count], 1" "\n\t" 5248 #elif (F_CPU >= 15400000UL) && (F_CPU <= 19000000L) 5250 volatile uint8_t next, bit;
5259 "st %a[port], %[hi]" "\n\t" 5260 "sbrc %[byte], 7" "\n\t" 5261 "mov %[next], %[hi]" "\n\t" 5263 "st %a[port], %[next]" "\n\t" 5264 "mov %[next] , %[lo]" "\n\t" 5265 "breq nextbyte20" "\n\t" 5266 "rol %[byte]" "\n\t" 5269 "st %a[port], %[lo]" "\n\t" 5272 "rjmp head20" "\n\t" 5273 "nextbyte20:" "\n\t" 5274 "ldi %[bit] , 8" "\n\t" 5275 "ld %[byte] , %a[ptr]+" "\n\t" 5276 "st %a[port], %[lo]" "\n\t" 5278 "sbiw %[count], 1" "\n\t" 5290 volatile uint8_t next, bit;
5299 "st %a[port], %[hi]" "\n\t" 5300 "sbrc %[byte] , 7" "\n\t" 5301 "mov %[next] , %[hi]" "\n\t" 5304 "st %a[port], %[next]" "\n\t" 5310 "st %a[port], %[lo]" "\n\t" 5312 "mov %[next] , %[lo]" "\n\t" 5314 "breq nextbyte40" "\n\t" 5315 "rol %[byte]" "\n\t" 5322 "rjmp head40" "\n\t" 5323 "nextbyte40:" "\n\t" 5324 "ldi %[bit] , 8" "\n\t" 5325 "ld %[byte] , %a[ptr]+" "\n\t" 5327 "st %a[port], %[lo]" "\n\t" 5329 "sbiw %[count], 1" "\n\t" 5341 #error "CPU SPEED NOT SUPPORTED" 5343 #elif defined(__arm__) 5346 #if defined(TEENSYDUINO) && defined(KINETISK) // Teensy 3.0, 3.1, 3.2, 3.5, 3.6 5347 #define CYCLES_800_T0H (F_CPU / 4000000) 5348 #define CYCLES_800_T1H (F_CPU / 1250000) 5349 #define CYCLES_800 (F_CPU / 800000) 5350 #define CYCLES_400_T0H (F_CPU / 2000000) 5351 #define CYCLES_400_T1H (F_CPU / 833333) 5352 #define CYCLES_400 (F_CPU / 400000) 5356 volatile uint8_t *
set = portSetRegister(
pin),
5357 *clr = portClearRegister(
pin);
5360 ARM_DEMCR |= ARM_DEMCR_TRCENA;
5361 ARM_DWT_CTRL |= ARM_DWT_CTRL_CYCCNTENA;
5364 cyc = ARM_DWT_CYCCNT + CYCLES_800;
5367 for(mask = 0x80; mask; mask >>= 1) {
5368 while(ARM_DWT_CYCCNT - cyc < CYCLES_800);
5369 cyc = ARM_DWT_CYCCNT;
5372 while(ARM_DWT_CYCCNT - cyc < CYCLES_800_T1H);
5374 while(ARM_DWT_CYCCNT - cyc < CYCLES_800_T0H);
5379 while(ARM_DWT_CYCCNT - cyc < CYCLES_800);
5381 cyc = ARM_DWT_CYCCNT + CYCLES_400;
5384 for(mask = 0x80; mask; mask >>= 1) {
5385 while(ARM_DWT_CYCCNT - cyc < CYCLES_400);
5386 cyc = ARM_DWT_CYCCNT;
5389 while(ARM_DWT_CYCCNT - cyc < CYCLES_400_T1H);
5391 while(ARM_DWT_CYCCNT - cyc < CYCLES_400_T0H);
5396 while(ARM_DWT_CYCCNT - cyc < CYCLES_400);
5399 #error "Sorry, only 48 MHz is supported, please set Tools > CPU Speed to 48 MHz" 5401 #elif defined(ESP8266) || defined(ESP32) 5405 #elif defined(__ARDUINO_ARC__) 5409 #define NOPx7 { __builtin_arc_nop(); \ 5410 __builtin_arc_nop(); __builtin_arc_nop(); \ 5411 __builtin_arc_nop(); __builtin_arc_nop(); \ 5412 __builtin_arc_nop(); __builtin_arc_nop(); } 5414 PinDescription *pindesc = &g_APinDescription[
pin];
5416 register uint8_t *p =
pixels;
5417 register uint32_t currByte = (uint32_t) (*p);
5418 register uint32_t currBit = 0x80 & currByte;
5419 register uint32_t bitCounter = 0;
5420 register uint32_t first = 1;
5422 if (pindesc->ulGPIOType == SS_GPIO) {
5423 register uint32_t reg = pindesc->ulGPIOBase + SS_GPIO_SWPORTA_DR;
5424 uint32_t reg_val = __builtin_arc_lr((
volatile uint32_t)reg);
5425 register uint32_t reg_bit_high = reg_val | (1 << pindesc->ulGPIOId);
5426 register uint32_t reg_bit_low = reg_val & ~(1 << pindesc->ulGPIOId);
5436 __builtin_arc_sr(first ? reg_bit_low : reg_bit_high, (
volatile uint32_t)reg);
5443 __builtin_arc_nop();
5446 __builtin_arc_sr(reg_bit_low, (
volatile uint32_t)reg);
5450 if(bitCounter >= 8) {
5452 currByte = (uint32_t) (*++p);
5455 currBit = 0x80 & currByte;
5458 }
else if(pindesc->ulGPIOType == SOC_GPIO) {
5459 register uint32_t reg = pindesc->ulGPIOBase + SOC_GPIO_SWPORTA_DR;
5460 uint32_t reg_val = MMIO_REG_VAL(reg);
5461 register uint32_t reg_bit_high = reg_val | (1 << pindesc->ulGPIOId);
5462 register uint32_t reg_bit_low = reg_val & ~(1 << pindesc->ulGPIOId);
5470 MMIO_REG_VAL(reg) = first ? reg_bit_low : reg_bit_high;
5474 __builtin_arc_nop();
5480 MMIO_REG_VAL(reg) = reg_bit_low;
5484 if(bitCounter >= 8) {
5486 currByte = (uint32_t) (*++p);
5489 currBit = 0x80 & currByte;
5495 #error Architecture not supported 5510 digitalWrite(p, LOW);
5513 port = portOutputRegister(digitalPinToPort(p));
5514 pinMask = digitalPinToBitMask(p);
5519 uint16_t n, uint8_t r, uint8_t g, uint8_t b) {
5541 uint16_t n, uint8_t r, uint8_t g, uint8_t b, uint8_t w) {
5566 r = (uint8_t)(c >> 16),
5567 g = (uint8_t)(c >> 8),
5578 uint8_t w = (uint8_t)(c >> 24);
5588 return ((uint32_t)r << 16) | ((uint32_t)g << 8) | b;
5591 uint32_t
NeoPixel::Color(uint8_t r, uint8_t g, uint8_t b, uint8_t w) {
5592 return ((uint32_t)w << 24) | ((uint32_t)r << 16) | ((uint32_t)g << 8) | b;
5608 return ((uint32_t)p[
rOffset] << 16) |
5620 return ((uint32_t)p[
wOffset] << 24) |
5621 ((uint32_t)p[
rOffset] << 16) |
5639 uint8_t newBrightness = b + 1;
5645 if(oldBrightness == 0) scale = 0;
5646 else if(b == 255) scale = 65535 / oldBrightness;
5647 else scale = (((uint16_t)newBrightness << 8) - 1) / oldBrightness;
5648 for(uint16_t i=0; i<
numBytes; i++) {
5650 *ptr++ = (c * scale) >> 8;
5664 static const uint8_t PROGMEM _sineTable[256] = {
5665 128,131,134,137,140,143,146,149,152,155,158,162,165,167,170,173,
5666 176,179,182,185,188,190,193,196,198,201,203,206,208,211,213,215,
5667 218,220,222,224,226,228,230,232,234,235,237,238,240,241,243,244,
5668 245,246,248,249,250,250,251,252,253,253,254,254,254,255,255,255,
5669 255,255,255,255,254,254,254,253,253,252,251,250,250,249,248,246,
5670 245,244,243,241,240,238,237,235,234,232,230,228,226,224,222,220,
5671 218,215,213,211,208,206,203,201,198,196,193,190,188,185,182,179,
5672 176,173,170,167,165,162,158,155,152,149,146,143,140,137,134,131,
5673 128,124,121,118,115,112,109,106,103,100, 97, 93, 90, 88, 85, 82,
5674 79, 76, 73, 70, 67, 65, 62, 59, 57, 54, 52, 49, 47, 44, 42, 40,
5675 37, 35, 33, 31, 29, 27, 25, 23, 21, 20, 18, 17, 15, 14, 12, 11,
5676 10, 9, 7, 6, 5, 5, 4, 3, 2, 2, 1, 1, 1, 0, 0, 0,
5677 0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 4, 5, 5, 6, 7, 9,
5678 10, 11, 12, 14, 15, 17, 18, 20, 21, 23, 25, 27, 29, 31, 33, 35,
5679 37, 40, 42, 44, 47, 49, 52, 54, 57, 59, 62, 65, 67, 70, 73, 76,
5680 79, 82, 85, 88, 90, 93, 97,100,103,106,109,112,115,118,121,124};
5682 static const uint8_t PROGMEM _gammaTable[256] = {
5683 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5684 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
5685 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3,
5686 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7,
5687 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12,
5688 13, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20,
5689 20, 21, 21, 22, 22, 23, 24, 24, 25, 25, 26, 27, 27, 28, 29, 29,
5690 30, 31, 31, 32, 33, 34, 34, 35, 36, 37, 38, 38, 39, 40, 41, 42,
5691 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
5692 58, 59, 60, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 75,
5693 76, 77, 78, 80, 81, 82, 84, 85, 86, 88, 89, 90, 92, 93, 94, 96,
5694 97, 99,100,102,103,105,106,108,109,111,112,114,115,117,119,120,
5695 122,124,125,127,129,130,132,134,136,137,139,141,143,145,146,148,
5696 150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,
5697 182,184,186,188,191,193,195,197,199,202,204,206,209,211,213,215,
5698 218,220,223,225,227,230,232,235,237,240,242,245,247,250,252,255};
5701 return pgm_read_byte(&_sineTable[x]);
5705 return pgm_read_byte(&_gammaTable[x]);
5942 #if EBOARD_COPY_AND_PASTE > 0x0 5956 #if EBOARD_DEBUG_MODE > 0x0 5961 TCCR1A = 0; TCCR1B = 0;
5963 TCCR1B |= (1 << WGM12); TCCR1B |= (1 << CS10); TCCR1B |= (1 << CS12);
5964 TIMSK1 |= (1 << OCIE1A);
5966 #if EBOARD_BLUETOOTH > 0x0 5967 #if (EBOARD_BLUETOOTH > 0x0) && (((PIN_BLUETOOTH_RX==0x13) && (PIN_BLUETOOTH_TX==0x12)) && defined(__AVR_ATmega2560__)) 5970 Serial1.begin(38400);
5976 #if EBOARD_I2C > 0x0 5979 #if EBOARD_SHIFT_REGISTER > 0x0 5985 #if EBOARD_USE_SPI > 0x0 && (EBOARD_NANO == 0) 5989 #if EBOARD_DEBUG_MODE > 0x0 5991 Serial.println(
" -- Exit Code. \n Program has finished. Reset to start again");
6012 #error This library is build for arduino-devices and should be used only in the Arduino IDE or with a similar linking process 6014 #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...