[HAL][LPC176x] Pull out framework into separate repository
Framework and build platform now located at https://github.com/p3p/pio-framework-arduino-lpc176x and https://github.com/p3p/pio-nxplpc-arduino-lpc176x respectively fix mkssbase leds move hardware serial remove hardware/software serial Hardware Serial extraction HardwareSerial ISRs fix disabled serial2 causing Serial object to link move usb devices out to framework separate out adc/pwm peripheral function from hal.cpp fix includes remove unused pwm init move adc HAL header update templated filtered adc LPC1769 platform
This commit is contained in:
@@ -35,27 +35,23 @@
|
||||
#ifndef _FASTIO_LPC1768_H
|
||||
#define _FASTIO_LPC1768_H
|
||||
|
||||
#include <LPC17xx.h>
|
||||
#include <Arduino.h>
|
||||
#include <pinmapping.h>
|
||||
|
||||
bool useable_hardware_PWM(pin_t pin);
|
||||
#define USEABLE_HARDWARE_PWM(pin) useable_hardware_PWM(pin)
|
||||
|
||||
#define LPC_PORT_OFFSET (0x0020)
|
||||
#define LPC_PIN(pin) (1UL << pin)
|
||||
#define LPC_GPIO(port) ((volatile LPC_GPIO_TypeDef *)(LPC_GPIO0_BASE + LPC_PORT_OFFSET * port))
|
||||
#define LPC_PIN(pin) (gpio_pin(pin))
|
||||
#define LPC_GPIO(port) (gpio_port(port))
|
||||
|
||||
#define SET_DIR_INPUT(IO) (LPC_GPIO(LPC1768_PIN_PORT(IO))->FIODIR &= ~LPC_PIN(LPC1768_PIN_PIN(IO)))
|
||||
#define SET_DIR_OUTPUT(IO) (LPC_GPIO(LPC1768_PIN_PORT(IO))->FIODIR |= LPC_PIN(LPC1768_PIN_PIN(IO)))
|
||||
#define SET_DIR_INPUT(IO) (gpio_set_input(IO))
|
||||
#define SET_DIR_OUTPUT(IO) (gpio_set_output(IO))
|
||||
|
||||
#define SET_MODE(IO, mode) (pin_mode((LPC1768_PIN_PORT(IO), LPC1768_PIN_PIN(IO)), mode))
|
||||
#define SET_MODE(IO, mode) (pinMode(IO, mode))
|
||||
|
||||
#define WRITE_PIN_SET(IO) (LPC_GPIO(LPC1768_PIN_PORT(IO))->FIOSET = LPC_PIN(LPC1768_PIN_PIN(IO)))
|
||||
#define WRITE_PIN_CLR(IO) (LPC_GPIO(LPC1768_PIN_PORT(IO))->FIOCLR = LPC_PIN(LPC1768_PIN_PIN(IO)))
|
||||
#define WRITE_PIN_SET(IO) (gpio_set(IO))
|
||||
#define WRITE_PIN_CLR(IO) (gpio_clear(IO))
|
||||
|
||||
#define READ_PIN(IO) ((LPC_GPIO(LPC1768_PIN_PORT(IO))->FIOPIN & LPC_PIN(LPC1768_PIN_PIN(IO))) ? 1 : 0)
|
||||
#define WRITE_PIN(IO,V) ((V) ? WRITE_PIN_SET(IO) : WRITE_PIN_CLR(IO))
|
||||
#define READ_PIN(IO) (gpio_get(IO))
|
||||
#define WRITE_PIN(IO,V) (gpio_set(IO, V))
|
||||
|
||||
/**
|
||||
* Magic I/O routines
|
||||
@@ -89,10 +85,10 @@ bool useable_hardware_PWM(pin_t pin);
|
||||
#define _PULLDOWN(IO,V) pinMode(IO, (V) ? INPUT_PULLDOWN : INPUT)
|
||||
|
||||
/// check if pin is an input
|
||||
#define _GET_INPUT(IO) (LPC_GPIO(LPC1768_PIN_PORT(IO))->FIODIR & LPC_PIN(LPC1768_PIN_PIN(IO)) != 0)
|
||||
#define _GET_INPUT(IO) (!gpio_get_dir(IO))
|
||||
|
||||
/// check if pin is an output
|
||||
#define _GET_OUTPUT(IO) (LPC_GPIO(LPC1768_PIN_PORT(IO))->FIODIR & LPC_PIN(LPC1768_PIN_PIN(IO)) == 0)
|
||||
#define _GET_OUTPUT(IO) (gpio_get_dir(IO))
|
||||
|
||||
/// check if pin is a timer
|
||||
/// all gpio pins are pwm capable, either interrupt or hardware pwm controlled
|
||||
|
||||
Reference in New Issue
Block a user