merge RPi branch in, add Feather nRF52840 Express example BLE sketch
This commit is contained in:
commit
f83b547de4
|
@ -125,7 +125,7 @@ const unsigned char AFSK_space[] PROGMEM = { 140, 228, 250, 166, 53, 0, 53, 166,
|
||||||
* @see A1846S_ADDRESS_AD0_LOW
|
* @see A1846S_ADDRESS_AD0_LOW
|
||||||
* @see A1846S_ADDRESS_AD0_HIGH
|
* @see A1846S_ADDRESS_AD0_HIGH
|
||||||
*/
|
*/
|
||||||
HamShield::HamShield(uint8_t ncs_pin = nCS, uint8_t clk_pin = CLK, uint8_t dat_pin = DAT, uint8_t mic_pin = MIC) {
|
HamShield::HamShield(uint8_t ncs_pin, uint8_t clk_pin, uint8_t dat_pin, uint8_t mic_pin) {
|
||||||
devAddr = ncs_pin;
|
devAddr = ncs_pin;
|
||||||
hs_mic_pin = mic_pin;
|
hs_mic_pin = mic_pin;
|
||||||
|
|
||||||
|
|
|
@ -241,12 +241,14 @@ class HamShield {
|
||||||
uint32_t getFrequency();
|
uint32_t getFrequency();
|
||||||
float getFrequency_float();
|
float getFrequency_float();
|
||||||
|
|
||||||
|
/* ToDo
|
||||||
// channel mode
|
// channel mode
|
||||||
// 11 - 25kHz channel
|
// 11 - 25kHz channel
|
||||||
// 00 - 12.5kHz channel
|
// 00 - 12.5kHz channel
|
||||||
// 10,01 - reserved
|
// 10,01 - reserved
|
||||||
void setChanMode(uint16_t mode);
|
void setChanMode(uint16_t mode);
|
||||||
uint16_t getChanMode();
|
uint16_t getChanMode();
|
||||||
|
*/
|
||||||
|
|
||||||
void setModeTransmit(); // turn off rx, turn on tx
|
void setModeTransmit(); // turn off rx, turn on tx
|
||||||
void setModeReceive(); // turn on rx, turn off tx
|
void setModeReceive(); // turn on rx, turn off tx
|
||||||
|
@ -265,6 +267,7 @@ class HamShield {
|
||||||
void setTxSourceNone();
|
void setTxSourceNone();
|
||||||
uint16_t getTxSource();
|
uint16_t getTxSource();
|
||||||
|
|
||||||
|
/*
|
||||||
// PA bias voltage is unused (maybe remove this)
|
// PA bias voltage is unused (maybe remove this)
|
||||||
// set PA_bias voltage
|
// set PA_bias voltage
|
||||||
// 000000: 1.01V
|
// 000000: 1.01V
|
||||||
|
@ -277,6 +280,7 @@ class HamShield {
|
||||||
// 1111111:3.13V
|
// 1111111:3.13V
|
||||||
void setPABiasVoltage(uint16_t voltage);
|
void setPABiasVoltage(uint16_t voltage);
|
||||||
uint16_t getPABiasVoltage();
|
uint16_t getPABiasVoltage();
|
||||||
|
*/
|
||||||
|
|
||||||
// Subaudio settings
|
// Subaudio settings
|
||||||
|
|
||||||
|
@ -475,9 +479,7 @@ class HamShield {
|
||||||
uint32_t findWhitespace(uint32_t start,uint32_t stop, uint8_t dwell, uint16_t step, uint16_t threshold);
|
uint32_t findWhitespace(uint32_t start,uint32_t stop, uint8_t dwell, uint16_t step, uint16_t threshold);
|
||||||
uint32_t scanChannels(uint32_t buffer[],uint8_t buffsize, uint8_t speed, uint16_t threshold);
|
uint32_t scanChannels(uint32_t buffer[],uint8_t buffsize, uint8_t speed, uint16_t threshold);
|
||||||
uint32_t findWhitespaceChannels(uint32_t buffer[],uint8_t buffsize, uint8_t dwell, uint16_t threshold);
|
uint32_t findWhitespaceChannels(uint32_t buffer[],uint8_t buffsize, uint8_t dwell, uint16_t threshold);
|
||||||
void buttonMode(uint8_t mode);
|
|
||||||
static void isr_ptt();
|
|
||||||
static void isr_reset();
|
|
||||||
unsigned int getMorseFreq();
|
unsigned int getMorseFreq();
|
||||||
void setMorseFreq(unsigned int morse_freq_hz);
|
void setMorseFreq(unsigned int morse_freq_hz);
|
||||||
unsigned int getMorseDotMillis();
|
unsigned int getMorseDotMillis();
|
||||||
|
|
|
@ -4,10 +4,6 @@
|
||||||
|
|
||||||
#include "HamShield_comms.h"
|
#include "HamShield_comms.h"
|
||||||
|
|
||||||
|
|
||||||
#include "Arduino.h"
|
|
||||||
//#include "I2Cdev.h"
|
|
||||||
|
|
||||||
uint8_t ncs_pin = nCS;
|
uint8_t ncs_pin = nCS;
|
||||||
uint8_t clk_pin = CLK;
|
uint8_t clk_pin = CLK;
|
||||||
uint8_t dat_pin = DAT;
|
uint8_t dat_pin = DAT;
|
||||||
|
@ -17,6 +13,10 @@ void HSsetPins(uint8_t ncs, uint8_t clk, uint8_t dat) {
|
||||||
clk_pin = clk;
|
clk_pin = clk;
|
||||||
dat_pin = dat;
|
dat_pin = dat;
|
||||||
|
|
||||||
|
#if !defined(ARDUINO)
|
||||||
|
wiringPiSetup();
|
||||||
|
#endif
|
||||||
|
|
||||||
pinMode(ncs_pin, OUTPUT);
|
pinMode(ncs_pin, OUTPUT);
|
||||||
digitalWrite(ncs_pin, HIGH);
|
digitalWrite(ncs_pin, HIGH);
|
||||||
pinMode(clk_pin, OUTPUT);
|
pinMode(clk_pin, OUTPUT);
|
||||||
|
@ -147,11 +147,21 @@ void HSdelayMicroseconds(unsigned int us) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HStone(uint8_t pin, unsigned int frequency) {
|
void HStone(uint8_t pin, unsigned int frequency) {
|
||||||
|
#if defined(ARDUINO_ARCH_NRF52)
|
||||||
|
//TODO
|
||||||
|
#elif defined(ARDUINO)
|
||||||
tone(pin, frequency);
|
tone(pin, frequency);
|
||||||
}
|
#else
|
||||||
void HStone(uint8_t pin, unsigned int frequency, unsigned long duration) {
|
softToneCreate(pin);
|
||||||
tone(pin, frequency, duration);
|
softToneWrite(pin, frequency);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void HSnoTone(uint8_t pin) {
|
void HSnoTone(uint8_t pin) {
|
||||||
|
#if defined(ARDUINO_ARCH_NRF52)
|
||||||
|
//TODO
|
||||||
|
#elif defined(ARDUINO)
|
||||||
noTone(pin);
|
noTone(pin);
|
||||||
|
#else
|
||||||
|
softToneWrite(pin, 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
|
@ -4,13 +4,24 @@
|
||||||
#ifndef _HAMSHIELD_COMMS_H_
|
#ifndef _HAMSHIELD_COMMS_H_
|
||||||
#define _HAMSHIELD_COMMS_H_
|
#define _HAMSHIELD_COMMS_H_
|
||||||
|
|
||||||
#include "stdint.h"
|
|
||||||
|
|
||||||
|
#if defined(ARDUINO)
|
||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
|
|
||||||
#define nCS A1 //15 //
|
#define nCS A1 //15 //
|
||||||
#define CLK A5 //19 //
|
#define CLK A5 //19 //
|
||||||
#define DAT A4 //18 //
|
#define DAT A4 //18 //
|
||||||
#define MIC 3 // Pin assignment for PWM output
|
#define MIC 3
|
||||||
|
#else // assume Raspberry Pi
|
||||||
|
#include "stdint.h"
|
||||||
|
#include <wiringPi.h>
|
||||||
|
#include <softTone.h>
|
||||||
|
|
||||||
|
#define nCS 0 //BCM17, HW pin 11
|
||||||
|
#define CLK 3 //BCM22, HW pin 15
|
||||||
|
#define DAT 2 //BCM27, HW pin 13
|
||||||
|
#define MIC 1 //BCM18, HW pin 12
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void HSsetPins(uint8_t ncs, uint8_t clk, uint8_t dat);
|
void HSsetPins(uint8_t ncs, uint8_t clk, uint8_t dat);
|
||||||
|
@ -31,7 +42,6 @@ void HSdelay(unsigned long ms);
|
||||||
void HSdelayMicroseconds(unsigned int us);
|
void HSdelayMicroseconds(unsigned int us);
|
||||||
|
|
||||||
void HStone(uint8_t pin, unsigned int frequency);
|
void HStone(uint8_t pin, unsigned int frequency);
|
||||||
void HStone(uint8_t pin, unsigned int frequency, unsigned long duration);
|
|
||||||
void HSnoTone(uint8_t pin);
|
void HSnoTone(uint8_t pin);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue