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_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;
|
||||
hs_mic_pin = mic_pin;
|
||||
|
||||
|
|
|
@ -240,14 +240,16 @@ class HamShield {
|
|||
bool frequency_float(float freq_khz);
|
||||
uint32_t getFrequency();
|
||||
float getFrequency_float();
|
||||
|
||||
|
||||
/* ToDo
|
||||
// channel mode
|
||||
// 11 - 25kHz channel
|
||||
// 00 - 12.5kHz channel
|
||||
// 10,01 - reserved
|
||||
void setChanMode(uint16_t mode);
|
||||
uint16_t getChanMode();
|
||||
|
||||
*/
|
||||
|
||||
void setModeTransmit(); // turn off rx, turn on tx
|
||||
void setModeReceive(); // turn on rx, turn off tx
|
||||
void setModeOff(); // turn off rx, turn off tx, set pwr_dwn bit
|
||||
|
@ -265,6 +267,7 @@ class HamShield {
|
|||
void setTxSourceNone();
|
||||
uint16_t getTxSource();
|
||||
|
||||
/*
|
||||
// PA bias voltage is unused (maybe remove this)
|
||||
// set PA_bias voltage
|
||||
// 000000: 1.01V
|
||||
|
@ -277,6 +280,7 @@ class HamShield {
|
|||
// 1111111:3.13V
|
||||
void setPABiasVoltage(uint16_t voltage);
|
||||
uint16_t getPABiasVoltage();
|
||||
*/
|
||||
|
||||
// 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 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);
|
||||
void buttonMode(uint8_t mode);
|
||||
static void isr_ptt();
|
||||
static void isr_reset();
|
||||
|
||||
unsigned int getMorseFreq();
|
||||
void setMorseFreq(unsigned int morse_freq_hz);
|
||||
unsigned int getMorseDotMillis();
|
||||
|
|
|
@ -4,10 +4,6 @@
|
|||
|
||||
#include "HamShield_comms.h"
|
||||
|
||||
|
||||
#include "Arduino.h"
|
||||
//#include "I2Cdev.h"
|
||||
|
||||
uint8_t ncs_pin = nCS;
|
||||
uint8_t clk_pin = CLK;
|
||||
uint8_t dat_pin = DAT;
|
||||
|
@ -16,6 +12,10 @@ void HSsetPins(uint8_t ncs, uint8_t clk, uint8_t dat) {
|
|||
ncs_pin = ncs;
|
||||
clk_pin = clk;
|
||||
dat_pin = dat;
|
||||
|
||||
#if !defined(ARDUINO)
|
||||
wiringPiSetup();
|
||||
#endif
|
||||
|
||||
pinMode(ncs_pin, OUTPUT);
|
||||
digitalWrite(ncs_pin, HIGH);
|
||||
|
@ -147,11 +147,21 @@ void HSdelayMicroseconds(unsigned int us) {
|
|||
}
|
||||
|
||||
void HStone(uint8_t pin, unsigned int frequency) {
|
||||
#if defined(ARDUINO_ARCH_NRF52)
|
||||
//TODO
|
||||
#elif defined(ARDUINO)
|
||||
tone(pin, frequency);
|
||||
}
|
||||
void HStone(uint8_t pin, unsigned int frequency, unsigned long duration) {
|
||||
tone(pin, frequency, duration);
|
||||
#else
|
||||
softToneCreate(pin);
|
||||
softToneWrite(pin, frequency);
|
||||
#endif
|
||||
}
|
||||
void HSnoTone(uint8_t pin) {
|
||||
#if defined(ARDUINO_ARCH_NRF52)
|
||||
//TODO
|
||||
#elif defined(ARDUINO)
|
||||
noTone(pin);
|
||||
#else
|
||||
softToneWrite(pin, 0);
|
||||
#endif
|
||||
}
|
|
@ -4,13 +4,24 @@
|
|||
#ifndef _HAMSHIELD_COMMS_H_
|
||||
#define _HAMSHIELD_COMMS_H_
|
||||
|
||||
#include "stdint.h"
|
||||
|
||||
#if defined(ARDUINO)
|
||||
#include "Arduino.h"
|
||||
|
||||
#define nCS A1 //15 //
|
||||
#define CLK A5 //19 //
|
||||
#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);
|
||||
|
@ -31,8 +42,7 @@ void HSdelay(unsigned long ms);
|
|||
void HSdelayMicroseconds(unsigned int us);
|
||||
|
||||
void HStone(uint8_t pin, unsigned int frequency);
|
||||
void HStone(uint8_t pin, unsigned int frequency, unsigned long duration);
|
||||
void HSnoTone(uint8_t pin);
|
||||
|
||||
|
||||
#endif /* _HAMSHIELD_COMMS_H_ */
|
||||
#endif /* _HAMSHIELD_COMMS_H_ */
|
||||
|
|
Loading…
Reference in New Issue