Skip to content

Commit

Permalink
Tabs, formatting
Browse files Browse the repository at this point in the history
Comitting now to make sure the manual release stays above the board manager one
  • Loading branch information
SpenceKonde committed Oct 11, 2020
1 parent 304bfcf commit e0d6163
Show file tree
Hide file tree
Showing 20 changed files with 474 additions and 475 deletions.
4 changes: 2 additions & 2 deletions megaavr/cores/megatinycore/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ extern "C"{
// internal from VREF

/* Values shifted to avoid clashing with ADC REFSEL defines
Will shift back in analog_reference function
Will shift back in analog_reference function
*/
#define INTERNAL0V55 (VREF_ADC0REFSEL_0V55_gc >> VREF_ADC0REFSEL_gp)
#define INTERNAL1V1 (VREF_ADC0REFSEL_1V1_gc >> VREF_ADC0REFSEL_gp)
Expand Down Expand Up @@ -77,7 +77,7 @@ extern "C"{
#endif

/* Allows performing a correction on the CPU value using the signature row
values indicating oscillator error provided from the device manufacturer */
values indicating oscillator error provided from the device manufacturer */
#define PERFORM_SIGROW_CORRECTION_F_CPU 0

uint16_t clockCyclesPerMicrosecondComp(uint32_t clk);
Expand Down
4 changes: 2 additions & 2 deletions megaavr/cores/megatinycore/UART.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ bool UartClass::pins(uint8_t tx, uint8_t rx)
for (_pin_set = 0; _pin_set < SERIAL_PIN_SETS; ++_pin_set) {
if (tx == _hw_set[_pin_set].tx_pin && rx == _hw_set[_pin_set].rx_pin) {
// We are good, this set of pins is supported
return true;
}
return true;
}
}
_pin_set = 0; // Default to standard
return false;
Expand Down
8 changes: 4 additions & 4 deletions megaavr/cores/megatinycore/UART.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ class UartClass : public HardwareSerial
volatile USART_t * const _hwserial_module;

struct UartPinSet {
uint8_t const rx_pin;
uint8_t const tx_pin;
uint8_t const mux;
uint8_t const rx_pin;
uint8_t const tx_pin;
uint8_t const mux;
} _hw_set[SERIAL_PIN_SETS];

uint8_t _pin_set;
Expand Down Expand Up @@ -176,7 +176,7 @@ class UartClass : public HardwareSerial
// Interrupt handlers - Not intended to be called externally
inline void _rx_complete_irq(void);
void _tx_data_empty_irq(void);

private:
void _poll_tx_data_empty(void);
};
Expand Down
4 changes: 2 additions & 2 deletions megaavr/cores/megatinycore/UART_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include "wiring_private.h"

// this next line disables the entire UART.cpp,
// this next line disables the entire UART.cpp,
// this is so I can support Attiny series and any other chip without a uart
#if defined(HAVE_HWSERIAL0) || defined(HAVE_HWSERIAL1) || defined(HAVE_HWSERIAL2) || defined(HAVE_HWSERIAL3)

Expand All @@ -40,7 +40,7 @@ UartClass::UartClass(
volatile uint8_t uart_mux_swap) :
_hwserial_module(hwserial_module),
_hw_set { { hwserial_rx_pin, hwserial_tx_pin, uart_mux },
{ hwserial_rx_pin_swap, hwserial_tx_pin_swap, uart_mux_swap } },
{ hwserial_rx_pin_swap, hwserial_tx_pin_swap, uart_mux_swap } },
_pin_set(0),
_written(false),
_rx_buffer_head(0), _rx_buffer_tail(0),
Expand Down
2 changes: 1 addition & 1 deletion megaavr/cores/megatinycore/WMath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Part of the Wiring project - http://wiring.org.co
Copyright (c) 2004-06 Hernando Barragan
Modified 13 August 2006, David A. Mellis for Arduino - http://www.arduino.cc/
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
Expand Down
2 changes: 1 addition & 1 deletion megaavr/cores/megatinycore/api/HardwareI2C.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class HardwareI2C : public Stream
virtual void end() = 0;

virtual void setClock(uint32_t freq) = 0;

virtual void beginTransmission(uint8_t address) = 0;
virtual uint8_t endTransmission(bool stopBit) = 0;
virtual uint8_t endTransmission(void) = 0;
Expand Down
4 changes: 2 additions & 2 deletions megaavr/cores/megatinycore/api/IPAddress.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
class IPAddress : public Printable {
private:
union {
uint8_t bytes[4]; // IPv4 address
uint32_t dword;
uint8_t bytes[4]; // IPv4 address
uint32_t dword;
} _address;

// Access the raw byte array containing the address. Because this returns a pointer
Expand Down
106 changes: 53 additions & 53 deletions megaavr/cores/megatinycore/api/PluggableUSB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,78 +22,78 @@

int PluggableUSB_::getInterface(uint8_t* interfaceCount)
{
int sent = 0;
PluggableUSBModule* node;
for (node = rootNode; node; node = node->next) {
int res = node->getInterface(interfaceCount);
if (res < 0)
return -1;
sent += res;
}
return sent;
int sent = 0;
PluggableUSBModule* node;
for (node = rootNode; node; node = node->next) {
int res = node->getInterface(interfaceCount);
if (res < 0)
return -1;
sent += res;
}
return sent;
}

int PluggableUSB_::getDescriptor(USBSetup& setup)
{
PluggableUSBModule* node;
for (node = rootNode; node; node = node->next) {
int ret = node->getDescriptor(setup);
// ret!=0 -> request has been processed
if (ret)
return ret;
}
return 0;
PluggableUSBModule* node;
for (node = rootNode; node; node = node->next) {
int ret = node->getDescriptor(setup);
// ret!=0 -> request has been processed
if (ret)
return ret;
}
return 0;
}

void PluggableUSB_::getShortName(char *iSerialNum)
{
PluggableUSBModule* node;
for (node = rootNode; node; node = node->next) {
iSerialNum += node->getShortName(iSerialNum);
}
*iSerialNum = 0;
PluggableUSBModule* node;
for (node = rootNode; node; node = node->next) {
iSerialNum += node->getShortName(iSerialNum);
}
*iSerialNum = 0;
}

bool PluggableUSB_::setup(USBSetup& setup)
{
PluggableUSBModule* node;
for (node = rootNode; node; node = node->next) {
if (node->setup(setup)) {
return true;
}
}
return false;
PluggableUSBModule* node;
for (node = rootNode; node; node = node->next) {
if (node->setup(setup)) {
return true;
}
}
return false;
}

bool PluggableUSB_::plug(PluggableUSBModule *node)
{
if ((lastEp + node->numEndpoints) > totalEP) {
return false;
}
if ((lastEp + node->numEndpoints) > totalEP) {
return false;
}

if (!rootNode) {
rootNode = node;
} else {
PluggableUSBModule *current = rootNode;
while (current->next) {
current = current->next;
}
current->next = node;
}
if (!rootNode) {
rootNode = node;
} else {
PluggableUSBModule *current = rootNode;
while (current->next) {
current = current->next;
}
current->next = node;
}

node->pluggedInterface = lastIf;
node->pluggedEndpoint = lastEp;
lastIf += node->numInterfaces;
for (uint8_t i = 0; i < node->numEndpoints; i++) {
*(unsigned int*)(epBuffer(lastEp)) = node->endpointType[i];
lastEp++;
}
return true;
// restart USB layer???
node->pluggedInterface = lastIf;
node->pluggedEndpoint = lastEp;
lastIf += node->numInterfaces;
for (uint8_t i = 0; i < node->numEndpoints; i++) {
*(unsigned int*)(epBuffer(lastEp)) = node->endpointType[i];
lastEp++;
}
return true;
// restart USB layer???
}

PluggableUSB_& PluggableUSB()
{
static PluggableUSB_ obj;
return obj;
}
static PluggableUSB_ obj;
return obj;
}
2 changes: 1 addition & 1 deletion megaavr/cores/megatinycore/api/Stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Stream : public Print

void setTimeout(unsigned long timeout); // sets maximum milliseconds to wait for stream data, default is 1 second
unsigned long getTimeout(void) { return _timeout; }

bool find(char *target); // reads data from the stream until the target string is found
bool find(uint8_t *target) { return find ((char *)target); }
// returns true if target string is found, false if timed out (see setTimeout)
Expand Down
20 changes: 10 additions & 10 deletions megaavr/cores/megatinycore/api/USBAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ typedef struct __attribute__((packed))
uint8_t transferDirection : 1;
};
};
uint8_t bRequest;
uint8_t wValueL;
uint8_t wValueH;
uint16_t wIndex;
uint16_t wLength;
uint8_t bRequest;
uint8_t wValueL;
uint8_t wValueH;
uint16_t wIndex;
uint16_t wLength;
} USBSetup;

//================================================================================
Expand All @@ -50,11 +50,11 @@ int USB_SendControl(uint8_t flags, const void* d, int len);
int USB_RecvControl(void* d, int len);
int USB_RecvControlLong(void* d, int len);

uint8_t USB_Available(uint8_t ep);
uint8_t USB_Available(uint8_t ep);
uint8_t USB_SendSpace(uint8_t ep);
int USB_Send(uint8_t ep, const void* data, int len); // blocking
int USB_Recv(uint8_t ep, void* data, int len); // non-blocking
int USB_Recv(uint8_t ep); // non-blocking
int USB_Send(uint8_t ep, const void* data, int len); // blocking
int USB_Recv(uint8_t ep, void* data, int len); // non-blocking
int USB_Recv(uint8_t ep); // non-blocking
void USB_Flush(uint8_t ep);

#endif
#endif
12 changes: 6 additions & 6 deletions megaavr/cores/megatinycore/api/Udp.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these)
* 1) UDP does not guarantee the order in which assembled UDP packets are received. This
* might not happen often in practice, but in larger network topologies, a UDP
* packet can be received out of sequence.
* packet can be received out of sequence.
* 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being
* aware of it. Again, this may not be a concern in practice on small local networks.
* For more information, see http://www.cafeaulait.org/course/week12/35.html
Expand All @@ -17,10 +17,10 @@
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand All @@ -40,11 +40,11 @@
class UDP : public Stream {

public:
virtual uint8_t begin(uint16_t) =0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use
virtual uint8_t begin(uint16_t) =0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use
virtual void stop() =0; // Finish with the UDP socket

// Sending UDP packets

// Start building up a packet to send to the remote host specific in ip and port
// Returns 1 if successful, 0 if there was a problem with the supplied IP address or port
virtual int beginPacket(IPAddress ip, uint16_t port) =0;
Expand Down Expand Up @@ -74,7 +74,7 @@ class UDP : public Stream {
virtual int read(char* buffer, size_t len) =0;
// Return the next byte from the current packet without moving on to the next byte
virtual int peek() =0;
virtual void flush() =0; // Finish reading the current packet
virtual void flush() =0; // Finish reading the current packet

// Return the IP address of the host who sent the current incoming packet
virtual IPAddress remoteIP() =0;
Expand Down
14 changes: 7 additions & 7 deletions megaavr/cores/megatinycore/api/Udp.h.orig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these)
* 1) UDP does not guarantee the order in which assembled UDP packets are received. This
* might not happen often in practice, but in larger network topologies, a UDP
* packet can be received out of sequence.
* packet can be received out of sequence.
* 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being
* aware of it. Again, this may not be a concern in practice on small local networks.
* For more information, see http://www.cafeaulait.org/course/week12/35.html
Expand All @@ -17,10 +17,10 @@
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand All @@ -42,11 +42,11 @@ namespace arduino {
class UDP : public Stream {

public:
virtual uint8_t begin(uint16_t) =0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use
virtual uint8_t begin(uint16_t) =0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use
virtual void stop() =0; // Finish with the UDP socket

// Sending UDP packets

// Start building up a packet to send to the remote host specific in ip and port
// Returns 1 if successful, 0 if there was a problem with the supplied IP address or port
virtual int beginPacket(IPAddress ip, uint16_t port) =0;
Expand Down Expand Up @@ -76,7 +76,7 @@ public:
virtual int read(char* buffer, size_t len) =0;
// Return the next byte from the current packet without moving on to the next byte
virtual int peek() =0;
virtual void flush() =0; // Finish reading the current packet
virtual void flush() =0; // Finish reading the current packet

// Return the IP address of the host who sent the current incoming packet
virtual IPAddress remoteIP() =0;
Expand All @@ -86,4 +86,4 @@ protected:
uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); };
};

}
}
Loading

0 comments on commit e0d6163

Please sign in to comment.