Large diffs are not rendered by default.

@@ -0,0 +1,60 @@
################################################################################
# Automatically-generated file. Do not edit or delete the file
################################################################################

src\ASF\common\services\serial\usart_serial.c

src\ASF\common\utils\stdio\read.c

src\ASF\common\utils\stdio\write.c

src\ASF\sam\drivers\spi\spi.c

src\ASF\sam\drivers\uart\uart.c

src\ASF\sam\drivers\usart\usart.c

src\ASF\thirdparty\freertos\freertos-7.0.0\source\croutine.c

src\config\adc.c

src\config\regulator.c

src\ASF\thirdparty\freertos\freertos-7.0.0\source\list.c

src\ASF\thirdparty\freertos\freertos-7.0.0\source\portable\gcc\sam\port.c

src\ASF\thirdparty\freertos\freertos-7.0.0\source\portable\memmang\heap_3.c

src\ASF\thirdparty\freertos\freertos-7.0.0\source\queue.c

src\ASF\thirdparty\freertos\freertos-7.0.0\source\tasks.c

src\ASF\thirdparty\freertos\freertos-7.0.0\source\timers.c

src\config\pwm.c

src\ASF\common\services\clock\sam3x\sysclk.c

src\ASF\common\utils\interrupt\interrupt_sam_nvic.c

src\ASF\sam\boards\arduino_due_x\init.c

src\ASF\sam\drivers\pio\pio.c

src\ASF\sam\drivers\pio\pio_handler.c

src\ASF\sam\drivers\pmc\pmc.c

src\ASF\sam\drivers\pmc\sleep.c

src\ASF\sam\utils\cmsis\sam3x\source\templates\exceptions.c

src\ASF\sam\utils\cmsis\sam3x\source\templates\gcc\startup_sam3x.c

src\ASF\sam\utils\cmsis\sam3x\source\templates\system_sam3x.c

src\ASF\sam\utils\syscalls\gcc\syscalls.c

src\main.c

Large diffs are not rendered by default.

Binary file not shown.

Large diffs are not rendered by default.

Binary file not shown.

Large diffs are not rendered by default.

Binary file not shown.

Large diffs are not rendered by default.

Binary file not shown.

Large diffs are not rendered by default.

Binary file not shown.

Large diffs are not rendered by default.

Binary file not shown.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -0,0 +1,262 @@
/**
* \file
*
* \brief Serial Mode management
*
* Copyright (c) 2010 - 2012 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
*/
#ifndef SERIAL_H_INCLUDED
#define SERIAL_H_INCLUDED

#include <parts.h>
#include "status_codes.h"

/**
* \typedef usart_if
*
* This type can be used independently to refer to USART module for the
* architecture used. It refers to the correct type definition for the
* architecture, ie. USART_t* for XMEGA or avr32_usart_t* for UC3.
*/

#if XMEGA
# include "xmega_usart/usart_serial.h"
#elif UC3
# include "uc3_usart/usart_serial.h"
#elif SAM
# include "sam_uart/uart_serial.h"
#else
# error Unsupported chip type
#endif

/**
*
* \defgroup serial_group Serial Interface (Serial)
*
* See \ref serial_quickstart.
*
* This is the common API for serial interface. Additional features are available
* in the documentation of the specific modules.
*
* \section serial_group_platform Platform Dependencies
*
* The serial API is partially chip- or platform-specific. While all
* platforms provide mostly the same functionality, there are some
* variations around how different bus types and clock tree structures
* are handled.
*
* The following functions are available on all platforms, but there may
* be variations in the function signature (i.e. parameters) and
* behaviour. These functions are typically called by platform-specific
* parts of drivers, and applications that aren't intended to be
* portable:
* - usart_serial_init()
* - usart_serial_putchar()
* - usart_serial_getchar()
* - usart_serial_write_packet()
* - usart_serial_read_packet()
*
*
* @{
*/

//! @}

/**
* \page serial_quickstart Quick start guide for Serial Interface service
*
* This is the quick start guide for the \ref serial_group "Serial Interface module", with
* step-by-step instructions on how to configure and use the serial in a
* selection of use cases.
*
* The use cases contain several code fragments. The code fragments in the
* steps for setup can be copied into a custom initialization function, while
* the steps for usage can be copied into, e.g., the main application function.
*
* \section serial_use_cases Serial use cases
* - \ref serial_basic_use_case
* - \subpage serial_use_case_1
*
* \section serial_basic_use_case Basic use case - transmit a character
* In this use case, the serial module is configured for:
* - Using USARTD0
* - Baudrate: 9600
* - Character length: 8 bit
* - Parity mode: Disabled
* - Stop bit: None
* - RS232 mode
*
* The use case waits for a received character on the configured USART and
* echoes the character back to the same USART.
*
* \section serial_basic_use_case_setup Setup steps
*
* \subsection serial_basic_use_case_setup_prereq Prerequisites
* -# \ref sysclk_group "System Clock Management (sysclk)"
*
* \subsection serial_basic_use_case_setup_code Example code
* The following configuration must be added to the project (typically to a
* conf_serial.h file, but it can also be added to your main application file.)
* \code
* #define USART_SERIAL &USARTD0
* #define USART_SERIAL_BAUDRATE 9600
* #define USART_SERIAL_CHAR_LENGTH USART_CHSIZE_8BIT_gc
* #define USART_SERIAL_PARITY USART_PMODE_DISABLED_gc
* #define USART_SERIAL_STOP_BIT false
* \endcode
*
* A variable for the received byte must be added:
* \code uint8_t received_byte; \endcode
*
* Add to application initialization:
* \code
* sysclk_init();
*
* static usart_serial_options_t usart_options = {
* .baudrate = USART_SERIAL_BAUDRATE,
* .charlength = USART_SERIAL_CHAR_LENGTH,
* .paritytype = USART_SERIAL_PARITY,
* .stopbits = USART_SERIAL_STOP_BIT
* };
*
* usart_serial_init(USART_SERIAL, &usart_options);
* \endcode
*
* \subsection serial_basic_use_case_setup_flow Workflow
* -# Initialize system clock:
* - \code sysclk_init(); \endcode
* -# Create serial USART options struct:
* - \code
* static usart_serial_options_t usart_options = {
* .baudrate = USART_SERIAL_BAUDRATE,
* .charlength = USART_SERIAL_CHAR_LENGTH,
* .paritytype = USART_SERIAL_PARITY,
* .stopbits = USART_SERIAL_STOP_BIT
* };
* \endcode
* -# Initialize the serial service:
* - \code usart_serial_init(USART_SERIAL, &usart_options);\endcode
*
* \section serial_basic_use_case_usage Usage steps
*
* \subsection serial_basic_use_case_usage_code Example code
* Add to application C-file:
* \code
* usart_serial_getchar(USART_SERIAL, &received_byte);
* usart_serial_putchar(USART_SERIAL, received_byte);
* \endcode
*
* \subsection serial_basic_use_case_usage_flow Workflow
* -# Wait for reception of a character:
* - \code usart_serial_getchar(USART_SERIAL, &received_byte); \endcode
* -# Echo the character back:
* - \code usart_serial_putchar(USART_SERIAL, received_byte); \endcode
*/

/**
* \page serial_use_case_1 Advanced use case - Send a packet of serial data
*
* In this use case, the USART module is configured for:
* - Using USARTD0
* - Baudrate: 9600
* - Character length: 8 bit
* - Parity mode: Disabled
* - Stop bit: None
* - RS232 mode
*
* The use case sends a string of text through the USART.
*
* \section serial_use_case_1_setup Setup steps
*
* \subsection serial_use_case_1_setup_prereq Prerequisites
* -# \ref sysclk_group "System Clock Management (sysclk)"
*
* \subsection serial_use_case_1_setup_code Example code
* The following configuration must be added to the project (typically to a
* conf_serial.h file, but it can also be added to your main application file.):
* \code
* #define USART_SERIAL &USARTD0
* #define USART_SERIAL_BAUDRATE 9600
* #define USART_SERIAL_CHAR_LENGTH USART_CHSIZE_8BIT_gc
* #define USART_SERIAL_PARITY USART_PMODE_DISABLED_gc
* #define USART_SERIAL_STOP_BIT false
* \endcode
*
* Add to application initialization:
* \code
* sysclk_init();
*
* static usart_serial_options_t usart_options = {
* .baudrate = USART_SERIAL_BAUDRATE,
* .charlength = USART_SERIAL_CHAR_LENGTH,
* .paritytype = USART_SERIAL_PARITY,
* .stopbits = USART_SERIAL_STOP_BIT
* };
*
* usart_serial_init(USART_SERIAL, &usart_options);
* \endcode
*
* \subsection serial_use_case_1_setup_flow Workflow
* -# Initialize system clock:
* - \code sysclk_init(); \endcode
* -# Create USART options struct:
* - \code
* static usart_serial_options_t usart_options = {
* .baudrate = USART_SERIAL_BAUDRATE,
* .charlength = USART_SERIAL_CHAR_LENGTH,
* .paritytype = USART_SERIAL_PARITY,
* .stopbits = USART_SERIAL_STOP_BIT
* };
* \endcode
* -# Initialize in RS232 mode:
* - \code usart_serial_init(USART_SERIAL_EXAMPLE, &usart_options); \endcode
*
* \section serial_use_case_1_usage Usage steps
*
* \subsection serial_use_case_1_usage_code Example code
* Add to, e.g., main loop in application C-file:
* \code
* usart_serial_write_packet(USART_SERIAL, "Test String", strlen("Test String"));
* \endcode
*
* \subsection serial_use_case_1_usage_flow Workflow
* -# Write a string of text to the USART:
* - \code usart_serial_write_packet(USART_SERIAL, "Test String", strlen("Test String")); \endcode
*/

#endif /* SERIAL_H_INCLUDED */
@@ -0,0 +1,83 @@
/**
*
* \file
*
* \brief USART Serial driver functions.
*
*
* Copyright (c) 2010-2012 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
*/
#include "serial.h"

/**
* \brief Send a sequence of bytes to USART device
*
* \param usart Base address of the USART instance.
* \param data Data buffer to read
* \param len Length of data
*
*/
status_code_t usart_serial_write_packet(usart_if usart, const uint8_t *data,
size_t len)
{
while (len) {
usart_serial_putchar(usart, *data);
len--;
data++;
}
return STATUS_OK;
}

/**
* \brief Receive a sequence of bytes from USART device
*
* \param usart Base address of the USART instance.
* \param data Data buffer to write
* \param len Length of data
*
*/
status_code_t usart_serial_read_packet(usart_if usart, uint8_t *data,
size_t len)
{
while (len) {
usart_serial_getchar(usart, data);
len--;
data++;
}
return STATUS_OK;
}
@@ -0,0 +1,164 @@
/**
* \file
*
* \brief System-specific implementation of the \ref _read function used by
* the standard library.
*
* Copyright (c) 2009-2012 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
*/

#include "compiler.h"

/**
* \defgroup group_common_utils_stdio Standard I/O (stdio)
*
* Common standard I/O driver that implements the stdio
* read and write functions on AVR and SAM devices.
*
* \{
*/

extern volatile void *volatile stdio_base;
void (*ptr_get)(void volatile*, char*);


// IAR common implementation
#if ( defined(__ICCAVR32__) || defined(__ICCAVR__) || defined(__ICCARM__) )

#include <yfuns.h>

_STD_BEGIN

#pragma module_name = "?__read"

/*! \brief Reads a number of bytes, at most \a size, into the memory area
* pointed to by \a buffer.
*
* \param handle File handle to read from.
* \param buffer Pointer to buffer to write read bytes to.
* \param size Number of bytes to read.
*
* \return The number of bytes read, \c 0 at the end of the file, or
* \c _LLIO_ERROR on failure.
*/
size_t __read(int handle, unsigned char *buffer, size_t size)
{
int nChars = 0;
// This implementation only reads from stdin.
// For all other file handles, it returns failure.
if (handle != _LLIO_STDIN) {
return _LLIO_ERROR;
}
for (; size > 0; --size) {
ptr_get(stdio_base, (char*)buffer);
buffer++;
nChars++;
}
return nChars;
}

/*! \brief This routine is required by IAR DLIB library since EWAVR V6.10
* the implementation is empty to be compatible with old IAR version.
*/
int __close(int handle)
{
UNUSED(handle);
return 0;
}

/*! \brief This routine is required by IAR DLIB library since EWAVR V6.10
* the implementation is empty to be compatible with old IAR version.
*/
int remove(const char* val)
{
UNUSED(val);
return 0;
}

/*! \brief This routine is required by IAR DLIB library since EWAVR V6.10
* the implementation is empty to be compatible with old IAR version.
*/
long __lseek(int handle, long val, int val2)
{
UNUSED(handle);
UNUSED(val2);
return val;
}

_STD_END

// GCC AVR32 and SAM implementation
#elif (defined(__GNUC__) && !XMEGA)

int __attribute__((weak))
_read (int file, char * ptr, int len); // Remove GCC compiler warning

int __attribute__((weak))
_read (int file, char * ptr, int len)
{
int nChars = 0;

if (file != 0) {
return -1;
}

for (; len > 0; --len) {
ptr_get(stdio_base, ptr);
ptr++;
nChars++;
}
return nChars;
}

// GCC AVR implementation
#elif (defined(__GNUC__) && XMEGA)

int _read (int *f); // Remove GCC compiler warning

int _read (int *f)
{
char c;
ptr_get(stdio_base,&c);
return c;
}
#endif

/**
* \}
*/

@@ -0,0 +1,123 @@
/**
*
* \file
*
* \brief Common Standard I/O Serial Management.
*
* This file defines a useful set of functions for the Stdio Serial interface on AVR
* and SAM devices.
*
* Copyright (c) 2009-2012 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
******************************************************************************/


#ifndef _STDIO_SERIAL_H_
#define _STDIO_SERIAL_H_

/**
* \defgroup group_common_utils_stdio_stdio_serial Standard serial I/O (stdio)
* \ingroup group_common_utils_stdio
*
* Common standard serial I/O management driver that
* implements a stdio serial interface on AVR and SAM devices.
*
* \{
*/

#include <stdio.h>
#include "compiler.h"
#include "sysclk.h"
#include "serial.h"

#if XMEGA && defined(__GNUC__)
extern int _write (char c, int *f);
extern int _read (int *f);
#endif


//! Pointer to the base of the USART module instance to use for stdio.
extern volatile void *volatile stdio_base;
//! Pointer to the external low level write function.
extern int (*ptr_put)(void volatile*, char);
//! Pointer to the external low level read function.
extern void (*ptr_get)(void volatile*, char*);

/*! \brief Initializes the stdio in Serial Mode.
*
* \param usart Base address of the USART instance.
* \param opt Options needed to set up RS232 communication (see \ref usart_options_t).
*
*/
static inline void stdio_serial_init(volatile void *usart, const usart_serial_options_t *opt)
{
stdio_base = (void *)usart;
ptr_put = (int (*)(void volatile*,char))&usart_serial_putchar;
ptr_get = (void (*)(void volatile*,char*))&usart_serial_getchar;
#if XMEGA
usart_serial_init((USART_t *)usart,opt);
#elif UC3
usart_serial_init(usart,(usart_serial_options_t *)opt);
#elif SAM
usart_serial_init((Usart *)usart,(usart_serial_options_t *)opt);
#else
# error Unsupported chip type
#endif

#if defined(__GNUC__)
# if XMEGA
// For AVR GCC libc print redirection uses fdevopen.
fdevopen((int (*)(char, FILE*))(_write),(int (*)(FILE*))(_read));
# endif
# if UC3 || SAM
// For AVR32 and SAM GCC
// Specify that stdout and stdin should not be buffered.
setbuf(stdout, NULL);
setbuf(stdin, NULL);
// Note: Already the case in IAR's Normal DLIB default configuration
// and AVR GCC library:
// - printf() emits one character at a time.
// - getchar() requests only 1 byte to exit.
# endif
#endif
}

/**
* \}
*/

#endif // _STDIO_SERIAL_H_
@@ -0,0 +1,146 @@
/**
* \file
*
* \brief System-specific implementation of the \ref _write function used by
* the standard library.
*
* Copyright (c) 2009-2012 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
*/

#include "compiler.h"

/**
* \addtogroup group_common_utils_stdio
*
* \{
*/

volatile void *volatile stdio_base;
int (*ptr_put)(void volatile*, char);


#if ( defined(__ICCAVR32__) || defined(__ICCAVR__) || defined(__ICCARM__))

#include <yfuns.h>

_STD_BEGIN

#pragma module_name = "?__write"

/*! \brief Writes a number of bytes, at most \a size, from the memory area
* pointed to by \a buffer.
*
* If \a buffer is zero then \ref __write performs flushing of internal buffers,
* if any. In this case, \a handle can be \c -1 to indicate that all handles
* should be flushed.
*
* \param handle File handle to write to.
* \param buffer Pointer to buffer to read bytes to write from.
* \param size Number of bytes to write.
*
* \return The number of bytes written, or \c _LLIO_ERROR on failure.
*/
size_t __write(int handle, const unsigned char *buffer, size_t size)
{
size_t nChars = 0;

if (buffer == 0) {
// This means that we should flush internal buffers.
return 0;
}

// This implementation only writes to stdout and stderr.
// For all other file handles, it returns failure.
if (handle != _LLIO_STDOUT && handle != _LLIO_STDERR) {
return _LLIO_ERROR;
}

for (; size != 0; --size) {
if (ptr_put(stdio_base, *buffer++) < 0) {
return _LLIO_ERROR;
}
++nChars;
}
return nChars;
}

_STD_END


#elif (defined(__GNUC__) && !XMEGA)

int _write (int file, char * ptr, int len); // Remove GCC compiler warning

int __attribute__((weak))
_write (int file, char * ptr, int len);

int __attribute__((weak))
_write (int file, char * ptr, int len)
{
int nChars = 0;

if ((file != 1) && (file != 2) && (file!=3)) {
return -1;
}

for (; len != 0; --len) {
if (ptr_put(stdio_base, *ptr++) < 0) {
return -1;
}
++nChars;
}
return nChars;
}

#elif (defined(__GNUC__) && XMEGA)

int _write (char c, int *f);

int _write (char c, int *f)
{
if (ptr_put(stdio_base, c) < 0) {
return -1;
}
return 1;
}
#endif

/**
* \}
*/

@@ -0,0 +1,362 @@
/**
* \file
*
* \brief Serial Peripheral Interface (SPI) driver for SAM.
*
* Copyright (c) 2011-2012 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
*/

#include "spi.h"
#include "sysclk.h"

/**
* \defgroup sam_drivers_spi_group Serial Peripheral Interface (SPI)
*
* See \ref sam_spi_quickstart.
*
* The SPI circuit is a synchronous serial data link that provides communication
* with external devices in Master or Slave mode. Connection to Peripheral DMA
* Controller channel capabilities optimizes data transfers.
*
* @{
*/

#define SPI_WPMR_WPKEY_VALUE SPI_WPMR_WPKEY((uint32_t) 0x535049)

/**
* \brief Enable SPI clock.
*
* \param p_spi Pointer to an SPI instance.
*/
void spi_enable_clock(Spi *p_spi)
{
#if (SAM4S || SAM3S || SAM3N || SAM3U)
sysclk_enable_peripheral_clock(ID_SPI);
#elif (SAM3XA)
if (p_spi == SPI0) {
sysclk_enable_peripheral_clock(ID_SPI0);
}
#ifdef SPI1
else if (p_spi == SPI1) {
sysclk_enable_peripheral_clock(ID_SPI1);
}
#endif
#elif SAM4L
sysclk_enable_peripheral_clock(p_spi);
#endif
}

/**
* \brief Disable SPI clock.
*
* \param p_spi Pointer to an SPI instance.
*/
void spi_disable_clock(Spi *p_spi)
{
#if (SAM4S || SAM3S || SAM3N || SAM3U)
sysclk_disable_peripheral_clock(ID_SPI);
#elif (SAM3XA)
if (p_spi == SPI0) {
sysclk_disable_peripheral_clock(ID_SPI0);
}
#ifdef SPI1
else if (p_spi == SPI1) {
sysclk_disable_peripheral_clock(ID_SPI1);
}
#endif
#elif SAM4L
sysclk_disable_peripheral_clock(p_spi);
#endif
}

/**
* \brief Set Peripheral Chip Select (PCS) value.
*
* \param p_spi Pointer to an SPI instance.
* \param ul_value Peripheral Chip Select value.
*/
void spi_set_peripheral_chip_select_value(Spi *p_spi, uint32_t ul_value)
{
p_spi->SPI_MR &= (~SPI_MR_PCS_Msk);
p_spi->SPI_MR |= SPI_MR_PCS(ul_value);
}

/**
* \brief Set delay between chip selects (in number of MCK clocks).
* If DLYBCS <= 6, 6 MCK clocks will be inserted by default.
*
* \param p_spi Pointer to an SPI instance.
* \param ul_delay Delay between chip selects (in number of MCK clocks).
*/
void spi_set_delay_between_chip_select(Spi *p_spi, uint32_t ul_delay)
{
p_spi->SPI_MR &= (~SPI_MR_DLYBCS_Msk);
p_spi->SPI_MR |= SPI_MR_DLYBCS(ul_delay);
}

/**
* \brief Read the received data and it's peripheral chip select value.
* While SPI works in fixed peripheral select mode, the peripheral chip select
* value is meaningless.
*
* \param p_spi Pointer to an SPI instance.
* \param data Pointer to the location where to store the received data word.
* \param p_pcs Pointer to fill Peripheral Chip Select Value.
*
* \retval SPI_OK on Success.
* \retval SPI_ERROR_TIMEOUT on Time-out.
*/
spi_status_t spi_read(Spi *p_spi, uint16_t *us_data, uint8_t *p_pcs)
{
uint32_t timeout = SPI_TIMEOUT;
static uint32_t reg_value;

while (!(p_spi->SPI_SR & SPI_SR_RDRF)) {
if (!timeout--) {
return SPI_ERROR_TIMEOUT;
}
}

reg_value = p_spi->SPI_RDR;
if (spi_get_peripheral_select_mode(p_spi)) {
*p_pcs = (uint8_t) ((reg_value & SPI_RDR_PCS_Msk) >> SPI_RDR_PCS_Pos);
}
*us_data = (uint16_t) (reg_value & SPI_RDR_RD_Msk);

return SPI_OK;
}

/**
* \brief Write the transmitted data with specified peripheral chip select value.
*
* \param p_spi Pointer to an SPI instance.
* \param us_data The data to transmit.
* \param uc_pcs Peripheral Chip Select Value while SPI works in peripheral select
* mode, otherwise it's meaningless.
* \param uc_last Indicate whether this data is the last one while SPI is working
* in variable peripheral select mode.
*
* \retval SPI_OK on Success.
* \retval SPI_ERROR_TIMEOUT on Time-out.
*/
spi_status_t spi_write(Spi *p_spi, uint16_t us_data,
uint8_t uc_pcs, uint8_t uc_last)
{
uint32_t timeout = SPI_TIMEOUT;
uint32_t value;

while (!(p_spi->SPI_SR & SPI_SR_TDRE)) {
if (!timeout--) {
return SPI_ERROR_TIMEOUT;
}
}

if (spi_get_peripheral_select_mode(p_spi)) {
value = SPI_TDR_TD(us_data) | SPI_TDR_PCS(uc_pcs);
if (uc_last) {
value |= SPI_TDR_LASTXFER;
}
} else {
value = SPI_TDR_TD(us_data);
}

p_spi->SPI_TDR = value;

return SPI_OK;
}

/**
* \brief Set clock default state.
*
* \param p_spi Pointer to an SPI instance.
* \param ul_pcs_ch Peripheral Chip Select channel (0~3).
* \param ul_polarity Default clock state is logical one(high)/zero(low).
*/
void spi_set_clock_polarity(Spi *p_spi, uint32_t ul_pcs_ch,
uint32_t ul_polarity)
{
if (ul_polarity) {
p_spi->SPI_CSR[ul_pcs_ch] |= SPI_CSR_CPOL;
} else {
p_spi->SPI_CSR[ul_pcs_ch] &= (~SPI_CSR_CPOL);
}
}

/**
* \brief Set Data Capture Phase.
*
* \param p_spi Pointer to an SPI instance.
* \param ul_pcs_ch Peripheral Chip Select channel (0~3).
* \param ul_phase Data capture on the rising/falling edge of clock.
*/
void spi_set_clock_phase(Spi *p_spi, uint32_t ul_pcs_ch, uint32_t ul_phase)
{
if (ul_phase) {
p_spi->SPI_CSR[ul_pcs_ch] |= SPI_CSR_NCPHA;
} else {
p_spi->SPI_CSR[ul_pcs_ch] &= (~SPI_CSR_NCPHA);
}
}

/**
* \brief Configure CS behavior for SPI transfer (\ref spi_cs_behavior_t).
*
* \param p_spi Pointer to an SPI instance.
* \param ul_pcs_ch Peripheral Chip Select channel (0~3).
* \param ul_cs_behavior Behavior of the Chip Select after transfer.
*/
void spi_configure_cs_behavior(Spi *p_spi, uint32_t ul_pcs_ch,
uint32_t ul_cs_behavior)
{
if (ul_cs_behavior == SPI_CS_RISE_FORCED) {
p_spi->SPI_CSR[ul_pcs_ch] &= (~SPI_CSR_CSAAT);
p_spi->SPI_CSR[ul_pcs_ch] |= SPI_CSR_CSNAAT;
} else if (ul_cs_behavior == SPI_CS_RISE_NO_TX) {
p_spi->SPI_CSR[ul_pcs_ch] &= (~SPI_CSR_CSAAT);
p_spi->SPI_CSR[ul_pcs_ch] &= (~SPI_CSR_CSNAAT);
} else if (ul_cs_behavior == SPI_CS_KEEP_LOW) {
p_spi->SPI_CSR[ul_pcs_ch] |= SPI_CSR_CSAAT;
}
}

/**
* \brief Set number of bits per transfer.
*
* \param p_spi Pointer to an SPI instance.
* \param ul_pcs_ch Peripheral Chip Select channel (0~3).
* \param ul_bits Number of bits (8~16), use the pattern defined
* in the device header file.
*/
void spi_set_bits_per_transfer(Spi *p_spi, uint32_t ul_pcs_ch,
uint32_t ul_bits)
{
p_spi->SPI_CSR[ul_pcs_ch] &= (~SPI_CSR_BITS_Msk);
p_spi->SPI_CSR[ul_pcs_ch] |= ul_bits;
}

/**
* \brief Calculate the baudrate divider.
*
* \param baudrate Baudrate value.
* \param mck SPI module input clock frequency (MCK clock, Hz).
*
* \return Divider or error code.
* \retval >=0 Success.
* \retval <0 Error.
*/
int16_t spi_calc_baudrate_div(const uint32_t baudrate, uint32_t mck)
{
int baud_div = div_ceil(mck, baudrate);

/* The value of baud_div is from 1 to 255 in the SCBR field. */
if (baud_div <= 0 || baud_div > 255) {
return -1;
}

return baud_div;
}

/**
* \brief Set Serial Clock Baud Rate divider value (SCBR).
*
* \param p_spi Pointer to an SPI instance.
* \param ul_pcs_ch Peripheral Chip Select channel (0~3).
* \param uc_baudrate_divider Baudrate divider from MCK.
*/
void spi_set_baudrate_div(Spi *p_spi, uint32_t ul_pcs_ch,
uint8_t uc_baudrate_divider)
{
p_spi->SPI_CSR[ul_pcs_ch] &= (~SPI_CSR_SCBR_Msk);
p_spi->SPI_CSR[ul_pcs_ch] |= SPI_CSR_SCBR(uc_baudrate_divider);
}

/**
* \brief Configure timing for SPI transfer.
*
* \param p_spi Pointer to an SPI instance.
* \param ul_pcs_ch Peripheral Chip Select channel (0~3).
* \param uc_dlybs Delay before SPCK (in number of MCK clocks).
* \param uc_dlybct Delay between consecutive transfers (in number of MCK clocks).
*/
void spi_set_transfer_delay(Spi *p_spi, uint32_t ul_pcs_ch,
uint8_t uc_dlybs, uint8_t uc_dlybct)
{
p_spi->SPI_CSR[ul_pcs_ch] &= ~(SPI_CSR_DLYBS_Msk | SPI_CSR_DLYBCT_Msk);
p_spi->SPI_CSR[ul_pcs_ch] |= SPI_CSR_DLYBS(uc_dlybs)
| SPI_CSR_DLYBCT(uc_dlybct);
}


/**
* \brief Enable or disable write protection of SPI registers.
*
* \param p_spi Pointer to an SPI instance.
* \param ul_enable 1 to enable, 0 to disable.
*/
void spi_set_writeprotect(Spi *p_spi, uint32_t ul_enable)
{
#if SAM4L
if (ul_enable) {
p_spi->SPI_WPCR = SPI_WPCR_SPIWPKEY_VALUE | SPI_WPCR_SPIWPEN;
} else {
p_spi->SPI_WPCR = SPI_WPCR_SPIWPKEY_VALUE;
}
#else
if (ul_enable) {
p_spi->SPI_WPMR = SPI_WPMR_WPKEY_VALUE | SPI_WPMR_WPEN;
} else {
p_spi->SPI_WPMR = SPI_WPMR_WPKEY_VALUE;
}
#endif
}

/**
* \brief Indicate write protect status.
*
* \param p_spi Pointer to an SPI instance.
*
* \return SPI_WPSR value.
*/
uint32_t spi_get_writeprotect_status(Spi *p_spi)
{
return p_spi->SPI_WPSR;
}

/**
* @}
*/

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -0,0 +1,105 @@
/**
* \file
*
* \brief Universal Asynchronous Receiver Transceiver (UART) driver for SAM.
*
* Copyright (c) 2011-2012 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
*/

#ifndef UART_H_INCLUDED
#define UART_H_INCLUDED

#include "compiler.h"

/// @cond 0
/**INDENT-OFF**/
#ifdef __cplusplus
extern "C" {
#endif
/**INDENT-ON**/
/// @endcond

/*! \brief Option list for UART peripheral initialization */
typedef struct sam_uart_opt {
/** MCK for UART */
uint32_t ul_mck;
/** Expected baud rate */
uint32_t ul_baudrate;
/** Initialize value for UART mode register */
uint32_t ul_mode;
/**
* Configure channel mode (Normal, Automatic, Local_loopback or
* Remote_loopback)
*/
uint32_t ul_chmode;
} sam_uart_opt_t;

uint32_t uart_init(Uart *p_uart, const sam_uart_opt_t *p_uart_opt);
void uart_enable_tx(Uart *p_uart);
void uart_disable_tx(Uart *p_uart);
void uart_reset_tx(Uart *p_uart);
void uart_enable_rx(Uart *p_uart);
void uart_disable_rx(Uart *p_uart);
void uart_reset_rx(Uart *p_uart);
void uart_enable(Uart *p_uart);
void uart_disable(Uart *p_uart);
void uart_reset(Uart *p_uart);
void uart_enable_interrupt(Uart *p_uart, uint32_t ul_sources);
void uart_disable_interrupt(Uart *p_uart, uint32_t ul_sources);
uint32_t uart_get_interrupt_mask(Uart *p_uart);
uint32_t uart_get_status(Uart *p_uart);
uint32_t uart_is_tx_ready(Uart *p_uart);
uint32_t uart_is_tx_empty(Uart *p_uart);
uint32_t uart_is_rx_ready(Uart *p_uart);
uint32_t uart_is_rx_buf_end(Uart *p_uart);
uint32_t uart_is_tx_buf_end(Uart *p_uart);
uint32_t uart_is_rx_buf_full(Uart *p_uart);
uint32_t uart_is_tx_buf_empty(Uart *p_uart);
uint32_t uart_write(Uart *p_uart, const uint8_t uc_data);
uint32_t uart_read(Uart *p_uart, uint8_t *puc_data);
Pdc *uart_get_pdc_base(Uart *p_uart);

/// @cond 0
/**INDENT-OFF**/
#ifdef __cplusplus
}
#endif
/**INDENT-ON**/
/// @endcond

#endif /* UART_H_INCLUDED */

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -56,8 +56,9 @@
#include <compiler.h>
#include <status_codes.h>

// From module: FreeRTOS mini Real-Time Kernel
// From module: FreeRTOS - Kernel 7.3.0
#include <FreeRTOS.h>
#include <FreeRTOS_CLI.h>
#include <StackMacros.h>
#include <croutine.h>
#include <list.h>
@@ -94,9 +95,24 @@
// From module: SAM3X startup code
#include <exceptions.h>

// From module: SPI - Serial Peripheral Interface
#include <spi.h>

// From module: Standard serial I/O (stdio) - SAM implementation
#include <stdio_serial.h>

// From module: System Clock Control - SAM3X/A implementation
#include <sysclk.h>

// From module: UART - Univ. Async Rec/Trans
#include <uart.h>

// From module: USART - Serial interface - SAM implementation for devices with both UART and USART
#include <serial.h>

// From module: USART - Univ. Syn Async Rec/Trans
#include <usart.h>

// From module: pio_handler support enabled
#include <pio_handler.h>

@@ -0,0 +1,19 @@
/*
* Receive.c
*
* Created: 2016-03-10 12:40:31
* Author: Andreas
*/
#include <asf.h>
#include "Receive.h"

void matlab_values(void)
{
/* store string from matlab in buffer*/
uint8_t recBuff[]={0};
while(1)
{
gets(recBuff);
printf(recBuff);
}
}
@@ -0,0 +1,16 @@
/*
* Receive.h
*
* Created: 2016-03-10 12:41:39
* Author: Andreas
*/


#ifndef Receive_H_
#define Receive_H_

void matlab_values(void);



#endif /* Receive.h */
File renamed without changes.
@@ -0,0 +1,68 @@
/**
* \file
*
* \brief Serial USART service configuration.
*
* Copyright (c) 2011-2012 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
*/

#ifndef CONF_USART_SERIAL_H
#define CONF_USART_SERIAL_H

/* A reference setting for UART */
/** UART Interface */
//#define CONF_UART CONSOLE_UART
/** Baudrate setting */
//#define CONF_UART_BAUDRATE 115200
/** Parity setting */
//#define CONF_UART_PARITY UART_MR_PAR_NO


/* A reference setting for USART */
/** USART Interface */
//#define CONF_UART USART1
/** Baudrate setting */
//#define CONF_UART_BAUDRATE 115200
/** Character length setting */
//#define CONF_UART_CHAR_LENGTH US_MR_CHRL_8_BIT
/** Parity setting */
//#define CONF_UART_PARITY US_MR_PAR_NO
/** Stop bits setting */
//#define CONF_UART_STOP_BITS US_MR_NBSTOP_1_BIT

#endif/* CONF_USART_SERIAL_H_INCLUDED */
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -39,16 +39,17 @@ int main (void)

sysclk_init();
board_init();
ioport_init();
adc_setup();
pwm_setup();
configure_console();
//ioport_init();
//adc_setup();
//pwm_setup();

ioport_set_pin_dir(PIO_PC22_IDX,IOPORT_DIR_OUTPUT);
ioport_set_pin_level(PIO_PC22_IDX,LOW);
ioport_set_pin_dir(PIO_PB27_IDX,IOPORT_DIR_OUTPUT);
ioport_set_pin_level(PIO_PB27_IDX,HIGH);
//ioport_set_pin_dir(PIO_PC22_IDX,IOPORT_DIR_OUTPUT);
//ioport_set_pin_level(PIO_PC22_IDX,LOW);
//ioport_set_pin_dir(PIO_PB27_IDX,IOPORT_DIR_OUTPUT);
//ioport_set_pin_level(PIO_PB27_IDX,HIGH);

vSemaphoreCreateBinary(signal_semafor);
//vSemaphoreCreateBinary(signal_semafor);

//Lägg till kod med taskcreate