AP_HAL: convert to unix file format
This commit is contained in:
parent
481429de61
commit
cf633e4d79
@ -1,64 +1,64 @@
|
|||||||
|
|
||||||
#include "GPIO.h"
|
#include "GPIO.h"
|
||||||
|
|
||||||
using namespace Empty;
|
using namespace Empty;
|
||||||
|
|
||||||
EmptyGPIO::EmptyGPIO()
|
EmptyGPIO::EmptyGPIO()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void EmptyGPIO::init()
|
void EmptyGPIO::init()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void EmptyGPIO::pinMode(uint8_t pin, uint8_t output)
|
void EmptyGPIO::pinMode(uint8_t pin, uint8_t output)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
int8_t EmptyGPIO::analogPinToDigitalPin(uint8_t pin)
|
int8_t EmptyGPIO::analogPinToDigitalPin(uint8_t pin)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint8_t EmptyGPIO::read(uint8_t pin) {
|
uint8_t EmptyGPIO::read(uint8_t pin) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmptyGPIO::write(uint8_t pin, uint8_t value)
|
void EmptyGPIO::write(uint8_t pin, uint8_t value)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void EmptyGPIO::toggle(uint8_t pin)
|
void EmptyGPIO::toggle(uint8_t pin)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/* Alternative interface: */
|
/* Alternative interface: */
|
||||||
AP_HAL::DigitalSource* EmptyGPIO::channel(uint16_t n) {
|
AP_HAL::DigitalSource* EmptyGPIO::channel(uint16_t n) {
|
||||||
return new EmptyDigitalSource(0);
|
return new EmptyDigitalSource(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Interrupt interface: */
|
/* Interrupt interface: */
|
||||||
bool EmptyGPIO::attach_interrupt(uint8_t interrupt_num, AP_HAL::Proc p,
|
bool EmptyGPIO::attach_interrupt(uint8_t interrupt_num, AP_HAL::Proc p,
|
||||||
uint8_t mode) {
|
uint8_t mode) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EmptyGPIO::usb_connected(void)
|
bool EmptyGPIO::usb_connected(void)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
EmptyDigitalSource::EmptyDigitalSource(uint8_t v) :
|
EmptyDigitalSource::EmptyDigitalSource(uint8_t v) :
|
||||||
_v(v)
|
_v(v)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void EmptyDigitalSource::mode(uint8_t output)
|
void EmptyDigitalSource::mode(uint8_t output)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
uint8_t EmptyDigitalSource::read() {
|
uint8_t EmptyDigitalSource::read() {
|
||||||
return _v;
|
return _v;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmptyDigitalSource::write(uint8_t value) {
|
void EmptyDigitalSource::write(uint8_t value) {
|
||||||
_v = value;
|
_v = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmptyDigitalSource::toggle() {
|
void EmptyDigitalSource::toggle() {
|
||||||
_v = !_v;
|
_v = !_v;
|
||||||
}
|
}
|
||||||
|
@ -1,39 +1,39 @@
|
|||||||
|
|
||||||
#ifndef __AP_HAL_EMPTY_GPIO_H__
|
#ifndef __AP_HAL_EMPTY_GPIO_H__
|
||||||
#define __AP_HAL_EMPTY_GPIO_H__
|
#define __AP_HAL_EMPTY_GPIO_H__
|
||||||
|
|
||||||
#include <AP_HAL_Empty.h>
|
#include <AP_HAL_Empty.h>
|
||||||
|
|
||||||
class Empty::EmptyGPIO : public AP_HAL::GPIO {
|
class Empty::EmptyGPIO : public AP_HAL::GPIO {
|
||||||
public:
|
public:
|
||||||
EmptyGPIO();
|
EmptyGPIO();
|
||||||
void init();
|
void init();
|
||||||
void pinMode(uint8_t pin, uint8_t output);
|
void pinMode(uint8_t pin, uint8_t output);
|
||||||
int8_t analogPinToDigitalPin(uint8_t pin);
|
int8_t analogPinToDigitalPin(uint8_t pin);
|
||||||
uint8_t read(uint8_t pin);
|
uint8_t read(uint8_t pin);
|
||||||
void write(uint8_t pin, uint8_t value);
|
void write(uint8_t pin, uint8_t value);
|
||||||
void toggle(uint8_t pin);
|
void toggle(uint8_t pin);
|
||||||
|
|
||||||
/* Alternative interface: */
|
/* Alternative interface: */
|
||||||
AP_HAL::DigitalSource* channel(uint16_t n);
|
AP_HAL::DigitalSource* channel(uint16_t n);
|
||||||
|
|
||||||
/* Interrupt interface: */
|
/* Interrupt interface: */
|
||||||
bool attach_interrupt(uint8_t interrupt_num, AP_HAL::Proc p,
|
bool attach_interrupt(uint8_t interrupt_num, AP_HAL::Proc p,
|
||||||
uint8_t mode);
|
uint8_t mode);
|
||||||
|
|
||||||
/* return true if USB cable is connected */
|
/* return true if USB cable is connected */
|
||||||
bool usb_connected(void);
|
bool usb_connected(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class Empty::EmptyDigitalSource : public AP_HAL::DigitalSource {
|
class Empty::EmptyDigitalSource : public AP_HAL::DigitalSource {
|
||||||
public:
|
public:
|
||||||
EmptyDigitalSource(uint8_t v);
|
EmptyDigitalSource(uint8_t v);
|
||||||
void mode(uint8_t output);
|
void mode(uint8_t output);
|
||||||
uint8_t read();
|
uint8_t read();
|
||||||
void write(uint8_t value);
|
void write(uint8_t value);
|
||||||
void toggle();
|
void toggle();
|
||||||
private:
|
private:
|
||||||
uint8_t _v;
|
uint8_t _v;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __AP_HAL_EMPTY_GPIO_H__
|
#endif // __AP_HAL_EMPTY_GPIO_H__
|
||||||
|
@ -1,76 +1,76 @@
|
|||||||
|
|
||||||
#include "GPIO.h"
|
#include "GPIO.h"
|
||||||
|
|
||||||
using namespace SMACCM;
|
using namespace SMACCM;
|
||||||
|
|
||||||
SMACCMGPIO::SMACCMGPIO()
|
SMACCMGPIO::SMACCMGPIO()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMACCMGPIO::init()
|
void SMACCMGPIO::init()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMACCMGPIO::pinMode(uint8_t pin, uint8_t output)
|
void SMACCMGPIO::pinMode(uint8_t pin, uint8_t output)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t SMACCMGPIO::analogPinToDigitalPin(uint8_t pin)
|
int8_t SMACCMGPIO::analogPinToDigitalPin(uint8_t pin)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t SMACCMGPIO::read(uint8_t pin)
|
uint8_t SMACCMGPIO::read(uint8_t pin)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMACCMGPIO::write(uint8_t pin, uint8_t value)
|
void SMACCMGPIO::write(uint8_t pin, uint8_t value)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMACCMGPIO::toggle(uint8_t pin)
|
void SMACCMGPIO::toggle(uint8_t pin)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SMACCMGPIO::usb_connected(void)
|
bool SMACCMGPIO::usb_connected(void)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Alternative interface: */
|
/* Alternative interface: */
|
||||||
AP_HAL::DigitalSource* SMACCMGPIO::channel(uint16_t n)
|
AP_HAL::DigitalSource* SMACCMGPIO::channel(uint16_t n)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Interrupt interface: */
|
/* Interrupt interface: */
|
||||||
bool SMACCMGPIO::attach_interrupt(uint8_t interrupt_num, AP_HAL::Proc p,
|
bool SMACCMGPIO::attach_interrupt(uint8_t interrupt_num, AP_HAL::Proc p,
|
||||||
uint8_t mode)
|
uint8_t mode)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SMACCMDigitalSource::SMACCMDigitalSource(uint8_t v) :
|
SMACCMDigitalSource::SMACCMDigitalSource(uint8_t v) :
|
||||||
_v(v)
|
_v(v)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMACCMDigitalSource::mode(uint8_t output)
|
void SMACCMDigitalSource::mode(uint8_t output)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t SMACCMDigitalSource::read()
|
uint8_t SMACCMDigitalSource::read()
|
||||||
{
|
{
|
||||||
return _v;
|
return _v;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMACCMDigitalSource::write(uint8_t value)
|
void SMACCMDigitalSource::write(uint8_t value)
|
||||||
{
|
{
|
||||||
_v = value;
|
_v = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMACCMDigitalSource::toggle()
|
void SMACCMDigitalSource::toggle()
|
||||||
{
|
{
|
||||||
_v = !_v;
|
_v = !_v;
|
||||||
}
|
}
|
||||||
|
@ -1,48 +1,48 @@
|
|||||||
|
|
||||||
#ifndef __AP_HAL_SMACCM_GPIO_H__
|
#ifndef __AP_HAL_SMACCM_GPIO_H__
|
||||||
#define __AP_HAL_SMACCM_GPIO_H__
|
#define __AP_HAL_SMACCM_GPIO_H__
|
||||||
|
|
||||||
#include <AP_HAL_SMACCM.h>
|
#include <AP_HAL_SMACCM.h>
|
||||||
|
|
||||||
#if CONFIG_HAL_BOARD == HAL_BOARD_SMACCM
|
#if CONFIG_HAL_BOARD == HAL_BOARD_SMACCM
|
||||||
// XXX these are just copied, may not make sense
|
// XXX these are just copied, may not make sense
|
||||||
# define HAL_GPIO_A_LED_PIN 27
|
# define HAL_GPIO_A_LED_PIN 27
|
||||||
# define HAL_GPIO_B_LED_PIN 26
|
# define HAL_GPIO_B_LED_PIN 26
|
||||||
# define HAL_GPIO_C_LED_PIN 25
|
# define HAL_GPIO_C_LED_PIN 25
|
||||||
# define HAL_GPIO_LED_ON LOW
|
# define HAL_GPIO_LED_ON LOW
|
||||||
# define HAL_GPIO_LED_OFF HIGH
|
# define HAL_GPIO_LED_OFF HIGH
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class SMACCM::SMACCMGPIO : public AP_HAL::GPIO {
|
class SMACCM::SMACCMGPIO : public AP_HAL::GPIO {
|
||||||
public:
|
public:
|
||||||
SMACCMGPIO();
|
SMACCMGPIO();
|
||||||
void init();
|
void init();
|
||||||
void pinMode(uint8_t pin, uint8_t output);
|
void pinMode(uint8_t pin, uint8_t output);
|
||||||
int8_t analogPinToDigitalPin(uint8_t pin);
|
int8_t analogPinToDigitalPin(uint8_t pin);
|
||||||
uint8_t read(uint8_t pin);
|
uint8_t read(uint8_t pin);
|
||||||
void write(uint8_t pin, uint8_t value);
|
void write(uint8_t pin, uint8_t value);
|
||||||
void toggle(uint8_t pin);
|
void toggle(uint8_t pin);
|
||||||
|
|
||||||
/* Alternative interface: */
|
/* Alternative interface: */
|
||||||
AP_HAL::DigitalSource* channel(uint16_t n);
|
AP_HAL::DigitalSource* channel(uint16_t n);
|
||||||
|
|
||||||
/* Interrupt interface: */
|
/* Interrupt interface: */
|
||||||
bool attach_interrupt(uint8_t interrupt_num, AP_HAL::Proc p,
|
bool attach_interrupt(uint8_t interrupt_num, AP_HAL::Proc p,
|
||||||
uint8_t mode);
|
uint8_t mode);
|
||||||
|
|
||||||
/* return true if USB cable is connected */
|
/* return true if USB cable is connected */
|
||||||
bool usb_connected(void);
|
bool usb_connected(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class SMACCM::SMACCMDigitalSource : public AP_HAL::DigitalSource {
|
class SMACCM::SMACCMDigitalSource : public AP_HAL::DigitalSource {
|
||||||
public:
|
public:
|
||||||
SMACCMDigitalSource(uint8_t v);
|
SMACCMDigitalSource(uint8_t v);
|
||||||
void mode(uint8_t output);
|
void mode(uint8_t output);
|
||||||
uint8_t read();
|
uint8_t read();
|
||||||
void write(uint8_t value);
|
void write(uint8_t value);
|
||||||
void toggle();
|
void toggle();
|
||||||
private:
|
private:
|
||||||
uint8_t _v;
|
uint8_t _v;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __AP_HAL_SMACCM_GPIO_H__
|
#endif // __AP_HAL_SMACCM_GPIO_H__
|
||||||
|
Loading…
Reference in New Issue
Block a user