aboutsummaryrefslogtreecommitdiff
path: root/platforms/avr
diff options
context:
space:
mode:
Diffstat (limited to 'platforms/avr')
-rw-r--r--platforms/avr/drivers/i2c_master.h51
-rw-r--r--platforms/avr/drivers/spi_master.h68
-rw-r--r--platforms/avr/drivers/uart.h39
-rw-r--r--platforms/avr/timer.c28
4 files changed, 0 insertions, 186 deletions
diff --git a/platforms/avr/drivers/i2c_master.h b/platforms/avr/drivers/i2c_master.h
deleted file mode 100644
index b797997619..0000000000
--- a/platforms/avr/drivers/i2c_master.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Copyright (C) 2019 Elia Ritterbusch
- +
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-/* Library made by: g4lvanix
- * GitHub repository: https://github.com/g4lvanix/I2C-master-lib
- */
-
-#pragma once
-
-#include <stdint.h>
-
-// ### DEPRECATED - DO NOT USE ###
-#define i2c_writeReg(devaddr, regaddr, data, length, timeout) i2c_write_register(devaddr, regaddr, data, length, timeout)
-#define i2c_writeReg16(devaddr, regaddr, data, length, timeout) i2c_write_register16(devaddr, regaddr, data, length, timeout)
-#define i2c_readReg(devaddr, regaddr, data, length, timeout) i2c_read_register(devaddr, regaddr, data, length, timeout)
-#define i2c_readReg16(devaddr, regaddr, data, length, timeout) i2c_read_register16(devaddr, regaddr, data, length, timeout)
-// ###############################
-
-#define I2C_READ 0x01
-#define I2C_WRITE 0x00
-
-typedef int16_t i2c_status_t;
-
-#define I2C_STATUS_SUCCESS (0)
-#define I2C_STATUS_ERROR (-1)
-#define I2C_STATUS_TIMEOUT (-2)
-
-#define I2C_TIMEOUT_IMMEDIATE (0)
-#define I2C_TIMEOUT_INFINITE (0xFFFF)
-
-void i2c_init(void);
-i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout);
-i2c_status_t i2c_transmit_P(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout);
-i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout);
-i2c_status_t i2c_write_register(uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout);
-i2c_status_t i2c_write_register16(uint8_t devaddr, uint16_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout);
-i2c_status_t i2c_read_register(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout);
-i2c_status_t i2c_read_register16(uint8_t devaddr, uint16_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout);
-i2c_status_t i2c_ping_address(uint8_t address, uint16_t timeout);
diff --git a/platforms/avr/drivers/spi_master.h b/platforms/avr/drivers/spi_master.h
deleted file mode 100644
index ebbf7ddeab..0000000000
--- a/platforms/avr/drivers/spi_master.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Copyright 2020
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#include <stdbool.h>
-
-#include "gpio.h"
-
-typedef int16_t spi_status_t;
-
-// Hardware SS pin is defined in the header so that user code can refer to it
-#if defined(__AVR_AT90USB162__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__)
-# define SPI_SS_PIN B0
-#elif defined(__AVR_ATmega32A__)
-# define SPI_SS_PIN B4
-#elif defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__)
-# define SPI_SS_PIN B2
-#endif
-
-#define SPI_STATUS_SUCCESS (0)
-#define SPI_STATUS_ERROR (-1)
-#define SPI_STATUS_TIMEOUT (-2)
-
-#define SPI_TIMEOUT_IMMEDIATE (0)
-#define SPI_TIMEOUT_INFINITE (0xFFFF)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-typedef struct spi_start_config_t {
- pin_t slave_pin;
- bool lsb_first;
- uint8_t mode;
- uint16_t divisor;
- bool cs_active_low;
-} spi_start_config_t;
-
-void spi_init(void);
-
-bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor);
-bool spi_start_extended(spi_start_config_t *start_config);
-
-spi_status_t spi_write(uint8_t data);
-
-spi_status_t spi_read(void);
-
-spi_status_t spi_transmit(const uint8_t *data, uint16_t length);
-
-spi_status_t spi_receive(uint8_t *data, uint16_t length);
-
-void spi_stop(void);
-#ifdef __cplusplus
-}
-#endif
diff --git a/platforms/avr/drivers/uart.h b/platforms/avr/drivers/uart.h
deleted file mode 100644
index e2dc664eda..0000000000
--- a/platforms/avr/drivers/uart.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* UART Example for Teensy USB Development Board
- * http://www.pjrc.com/teensy/
- * Copyright (c) 2009 PJRC.COM, LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * 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
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#pragma once
-
-#include <stdint.h>
-#include <stdbool.h>
-
-void uart_init(uint32_t baud);
-
-void uart_write(uint8_t data);
-
-uint8_t uart_read(void);
-
-void uart_transmit(const uint8_t *data, uint16_t length);
-
-void uart_receive(uint8_t *data, uint16_t length);
-
-bool uart_available(void);
diff --git a/platforms/avr/timer.c b/platforms/avr/timer.c
index 26ba0e29fa..b2230ad84b 100644
--- a/platforms/avr/timer.c
+++ b/platforms/avr/timer.c
@@ -125,34 +125,6 @@ inline uint32_t timer_read32(void) {
return t;
}
-/** \brief timer elapsed
- *
- * FIXME: needs doc
- */
-inline uint16_t timer_elapsed(uint16_t last) {
- uint32_t t;
-
- ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
- t = timer_count;
- }
-
- return TIMER_DIFF_16((t & 0xFFFF), last);
-}
-
-/** \brief timer elapsed32
- *
- * FIXME: needs doc
- */
-inline uint32_t timer_elapsed32(uint32_t last) {
- uint32_t t;
-
- ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
- t = timer_count;
- }
-
- return TIMER_DIFF_32(t, last);
-}
-
// excecuted once per 1ms.(excess for just timer count?)
#ifndef __AVR_ATmega32A__
# define TIMER_INTERRUPT_VECTOR TIMER0_COMPA_vect