Version 0.5
o Clock calibration and station ID no longer get erased by a factory reset: The only way to set these values is using the CAL and ID serial commands. They still get initialized on an erased EEPROM, but never thereafter. o MIT license added to all files.Dev1
rodzic
b9f99029db
commit
6fafb8d453
|
@ -1,3 +1,26 @@
|
||||||
|
/*
|
||||||
|
* MIT License
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020 DigitalConfections
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
* Microfox Arduino nano version. Converted from PIC C November 2019
|
* Microfox Arduino nano version. Converted from PIC C November 2019
|
||||||
* Jerry Boyd WB8WFK
|
* Jerry Boyd WB8WFK
|
||||||
|
@ -24,6 +47,7 @@
|
||||||
|
|
||||||
|
|
||||||
#define MAX_PATTERN_TEXT_LENGTH 20
|
#define MAX_PATTERN_TEXT_LENGTH 20
|
||||||
|
#define TEMP_STRING_LENGTH (MAX_PATTERN_TEXT_LENGTH + 10)
|
||||||
|
|
||||||
volatile int g_seconds = 0; /* Init timer to first second. Set in ISR checked by main. */
|
volatile int g_seconds = 0; /* Init timer to first second. Set in ISR checked by main. */
|
||||||
volatile int g_minutes = 1; /* Init timer to cycle 1. */
|
volatile int g_minutes = 1; /* Init timer to cycle 1. */
|
||||||
|
@ -93,7 +117,7 @@ static volatile uint8_t g_override_DIP_switches = EEPROM_OVERRIDE_DIP_SW_DEFAULT
|
||||||
static volatile uint8_t g_enable_LEDs;
|
static volatile uint8_t g_enable_LEDs;
|
||||||
static volatile uint8_t g_enable_sync;
|
static volatile uint8_t g_enable_sync;
|
||||||
|
|
||||||
static char g_tempStr[21] = { '\0' };
|
static char g_tempStr[TEMP_STRING_LENGTH] = { '\0' };
|
||||||
|
|
||||||
static volatile uint8_t g_start_override = FALSE;
|
static volatile uint8_t g_start_override = FALSE;
|
||||||
|
|
||||||
|
@ -101,7 +125,7 @@ static volatile uint8_t g_start_override = FALSE;
|
||||||
* Function Prototypes
|
* Function Prototypes
|
||||||
*/
|
*/
|
||||||
void handleLinkBusMsgs(void);
|
void handleLinkBusMsgs(void);
|
||||||
void initializeEEPROMVars(void);
|
BOOL initializeEEPROMVars(void);
|
||||||
void saveAllEEPROM(void);
|
void saveAllEEPROM(void);
|
||||||
float getTemp(void);
|
float getTemp(void);
|
||||||
uint16_t readADC();
|
uint16_t readADC();
|
||||||
|
@ -212,7 +236,10 @@ void setUpTemp(void);
|
||||||
|
|
||||||
sei(); /*allow interrupts. Arm and run */
|
sei(); /*allow interrupts. Arm and run */
|
||||||
|
|
||||||
initializeEEPROMVars(); /* Initialize variables stored in EEPROM */
|
while(initializeEEPROMVars())
|
||||||
|
{
|
||||||
|
; /* Initialize variables stored in EEPROM */
|
||||||
|
}
|
||||||
linkbus_init(BAUD); /* Start the Link Bus serial comms */
|
linkbus_init(BAUD); /* Start the Link Bus serial comms */
|
||||||
setUpTemp();
|
setUpTemp();
|
||||||
|
|
||||||
|
@ -846,9 +873,8 @@ void __attribute__((optimize("O0"))) handleLinkBusMsgs()
|
||||||
{
|
{
|
||||||
g_clock_calibration = c;
|
g_clock_calibration = c;
|
||||||
OCR1A = g_clock_calibration;
|
OCR1A = g_clock_calibration;
|
||||||
|
eeprom_update_word(&ee_clock_calibration, g_clock_calibration);
|
||||||
}
|
}
|
||||||
|
|
||||||
saveAllEEPROM();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(g_tempStr, "Cal=%u\n", g_clock_calibration);
|
sprintf(g_tempStr, "Cal=%u\n", g_clock_calibration);
|
||||||
|
@ -860,16 +886,27 @@ void __attribute__((optimize("O0"))) handleLinkBusMsgs()
|
||||||
{
|
{
|
||||||
if(lb_buff->fields[FIELD1][0])
|
if(lb_buff->fields[FIELD1][0])
|
||||||
{
|
{
|
||||||
strcpy(g_messages_text[STATION_ID], " "); /* Space before ID gets sent */
|
strcpy(g_tempStr, " "); /* Space before ID gets sent */
|
||||||
strcat(g_messages_text[STATION_ID], lb_buff->fields[FIELD1]);
|
strcat(g_tempStr, lb_buff->fields[FIELD1]);
|
||||||
|
|
||||||
if(lb_buff->fields[FIELD2][0])
|
if(lb_buff->fields[FIELD2][0])
|
||||||
{
|
{
|
||||||
strcat(g_messages_text[STATION_ID], " ");
|
strcat(g_tempStr, " ");
|
||||||
strcat(g_messages_text[STATION_ID], lb_buff->fields[FIELD2]);
|
strcat(g_tempStr, lb_buff->fields[FIELD2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
saveAllEEPROM();
|
if(strlen(g_tempStr) <= MAX_PATTERN_TEXT_LENGTH)
|
||||||
|
{
|
||||||
|
uint8_t i;
|
||||||
|
strcpy(g_messages_text[STATION_ID], g_tempStr);
|
||||||
|
|
||||||
|
for(i = 0; i < strlen(g_messages_text[STATION_ID]); i++)
|
||||||
|
{
|
||||||
|
eeprom_update_byte((uint8_t*)&ee_stationID_text[i], (uint8_t)g_messages_text[STATION_ID][i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
eeprom_update_byte((uint8_t*)&ee_stationID_text[i], 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(g_messages_text[STATION_ID][0])
|
if(g_messages_text[STATION_ID][0])
|
||||||
|
@ -946,8 +983,8 @@ void __attribute__((optimize("O0"))) handleLinkBusMsgs()
|
||||||
lb_send_string(g_tempStr, FALSE);
|
lb_send_string(g_tempStr, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
float temp = getTemp();
|
float temp = 10. * getTemp();
|
||||||
sprintf(g_tempStr, "Temp: %dC\n", (int)temp);
|
sprintf(g_tempStr, "Temp: %d.%dC\n", (int)temp / 10, (int)temp % 10);
|
||||||
lb_send_string(g_tempStr, FALSE);
|
lb_send_string(g_tempStr, FALSE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -971,8 +1008,9 @@ void __attribute__((optimize("O0"))) handleLinkBusMsgs()
|
||||||
/*
|
/*
|
||||||
* Set non-volatile variables to their values stored in EEPROM
|
* Set non-volatile variables to their values stored in EEPROM
|
||||||
*/
|
*/
|
||||||
void initializeEEPROMVars()
|
BOOL initializeEEPROMVars()
|
||||||
{
|
{
|
||||||
|
BOOL flagNotSet = FALSE;
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
|
|
||||||
if(eeprom_read_byte(&ee_interface_eeprom_initialization_flag) == EEPROM_INITIALIZED_FLAG)
|
if(eeprom_read_byte(&ee_interface_eeprom_initialization_flag) == EEPROM_INITIALIZED_FLAG)
|
||||||
|
@ -1006,6 +1044,7 @@ void initializeEEPROMVars()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
flagNotSet = TRUE;
|
||||||
g_id_codespeed = EEPROM_ID_CODE_SPEED_DEFAULT;
|
g_id_codespeed = EEPROM_ID_CODE_SPEED_DEFAULT;
|
||||||
g_pattern_codespeed = EEPROM_PATTERN_CODE_SPEED_DEFAULT;
|
g_pattern_codespeed = EEPROM_PATTERN_CODE_SPEED_DEFAULT;
|
||||||
g_ID_period_seconds = EEPROM_ID_TIME_INTERVAL_DEFAULT;
|
g_ID_period_seconds = EEPROM_ID_TIME_INTERVAL_DEFAULT;
|
||||||
|
@ -1019,6 +1058,8 @@ void initializeEEPROMVars()
|
||||||
saveAllEEPROM();
|
saveAllEEPROM();
|
||||||
eeprom_write_byte(&ee_interface_eeprom_initialization_flag, EEPROM_INITIALIZED_FLAG);
|
eeprom_write_byte(&ee_interface_eeprom_initialization_flag, EEPROM_INITIALIZED_FLAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return(flagNotSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1027,11 +1068,16 @@ void initializeEEPROMVars()
|
||||||
void saveAllEEPROM()
|
void saveAllEEPROM()
|
||||||
{
|
{
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
|
BOOL initialize = TRUE;
|
||||||
|
|
||||||
eeprom_update_byte(&ee_id_codespeed, g_id_codespeed);
|
eeprom_update_byte(&ee_id_codespeed, g_id_codespeed);
|
||||||
eeprom_update_byte(&ee_pattern_codespeed, g_pattern_codespeed);
|
eeprom_update_byte(&ee_pattern_codespeed, g_pattern_codespeed);
|
||||||
eeprom_update_word(&ee_ID_time, g_ID_period_seconds);
|
eeprom_update_word(&ee_ID_time, g_ID_period_seconds);
|
||||||
eeprom_update_word(&ee_clock_calibration, g_clock_calibration);
|
uint16_t x = eeprom_read_word(&ee_clock_calibration);
|
||||||
|
if(x == 0xFFFF) /* Never overwrite a valid calibration value */
|
||||||
|
{
|
||||||
|
eeprom_update_word(&ee_clock_calibration, g_clock_calibration);
|
||||||
|
}
|
||||||
eeprom_update_word((uint16_t*)&ee_temp_calibration, (uint16_t)g_temp_calibration);
|
eeprom_update_word((uint16_t*)&ee_temp_calibration, (uint16_t)g_temp_calibration);
|
||||||
eeprom_update_byte(&ee_override_DIP_switches, g_override_DIP_switches);
|
eeprom_update_byte(&ee_override_DIP_switches, g_override_DIP_switches);
|
||||||
eeprom_update_byte(&ee_enable_LEDs, g_enable_LEDs);
|
eeprom_update_byte(&ee_enable_LEDs, g_enable_LEDs);
|
||||||
|
@ -1039,10 +1085,22 @@ void saveAllEEPROM()
|
||||||
|
|
||||||
for(i = 0; i < strlen(g_messages_text[STATION_ID]); i++)
|
for(i = 0; i < strlen(g_messages_text[STATION_ID]); i++)
|
||||||
{
|
{
|
||||||
eeprom_update_byte((uint8_t*)&ee_stationID_text[i], (uint8_t)g_messages_text[STATION_ID][i]);
|
if(eeprom_read_byte((uint8_t*)&ee_stationID_text) != 0xFF)
|
||||||
|
{
|
||||||
|
initialize = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eeprom_update_byte((uint8_t*)&ee_stationID_text[i], 0);
|
if(initialize)
|
||||||
|
{
|
||||||
|
for(i = 0; i < strlen(g_messages_text[STATION_ID]); i++)
|
||||||
|
{
|
||||||
|
eeprom_update_byte((uint8_t*)&ee_stationID_text[i], (uint8_t)g_messages_text[STATION_ID][i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
eeprom_update_byte((uint8_t*)&ee_stationID_text[i], 0);
|
||||||
|
}
|
||||||
|
|
||||||
for(i = 0; i < strlen(g_messages_text[PATTERN_TEXT]); i++)
|
for(i = 0; i < strlen(g_messages_text[PATTERN_TEXT]); i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,25 +1,27 @@
|
||||||
|
|
||||||
/**********************************************************************************************
|
/*
|
||||||
* Copyright <EFBFBD> 2017 Digital Confections LLC
|
* MIT License
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Copyright (c) 2020 DigitalConfections
|
||||||
* this software and associated documentation files (the "Software"), to deal in the
|
*
|
||||||
* Software without restriction, including without limitation the rights to use, copy,
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
* and to permit persons to whom the Software is furnished to do so, subject to the
|
* in the Software without restriction, including without limitation the rights
|
||||||
* following conditions:
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
*
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
* furnished to do so, subject to the following conditions:
|
||||||
* copies or substantial portions of the Software.
|
*
|
||||||
*
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
* copies or substantial portions of the Software.
|
||||||
* 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
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef DEFS_H
|
#ifndef DEFS_H
|
||||||
#define DEFS_H
|
#define DEFS_H
|
||||||
|
@ -57,7 +59,7 @@
|
||||||
|
|
||||||
/******************************************************
|
/******************************************************
|
||||||
* Set the text that gets displayed to the user */
|
* Set the text that gets displayed to the user */
|
||||||
#define SW_REVISION "0.4"
|
#define SW_REVISION "0.5"
|
||||||
|
|
||||||
//#define TRANQUILIZE_WATCHDOG
|
//#define TRANQUILIZE_WATCHDOG
|
||||||
|
|
||||||
|
@ -113,7 +115,7 @@ INVALID_FOX
|
||||||
|
|
||||||
/******************************************************
|
/******************************************************
|
||||||
* EEPROM definitions */
|
* EEPROM definitions */
|
||||||
#define EEPROM_INITIALIZED_FLAG 0xAF
|
#define EEPROM_INITIALIZED_FLAG 0xB0
|
||||||
#define EEPROM_UNINITIALIZED 0x00
|
#define EEPROM_UNINITIALIZED 0x00
|
||||||
|
|
||||||
#define EEPROM_STATION_ID_DEFAULT "FOXBOX"
|
#define EEPROM_STATION_ID_DEFAULT "FOXBOX"
|
||||||
|
@ -127,7 +129,7 @@ INVALID_FOX
|
||||||
#define EEPROM_ON_AIR_TIME_DEFAULT 60
|
#define EEPROM_ON_AIR_TIME_DEFAULT 60
|
||||||
#define EEPROM_OFF_AIR_TIME_DEFAULT 240
|
#define EEPROM_OFF_AIR_TIME_DEFAULT 240
|
||||||
#define EEPROM_INTRA_CYCLE_DELAY_TIME_DEFAULT 0
|
#define EEPROM_INTRA_CYCLE_DELAY_TIME_DEFAULT 0
|
||||||
#define EEPROM_ID_TIME_INTERVAL_DEFAULT 300
|
#define EEPROM_ID_TIME_INTERVAL_DEFAULT 60
|
||||||
#define EEPROM_CLOCK_CALIBRATION_DEFAULT 15629
|
#define EEPROM_CLOCK_CALIBRATION_DEFAULT 15629
|
||||||
#define EEPROM_TEMP_CALIBRATION_DEFAULT 147
|
#define EEPROM_TEMP_CALIBRATION_DEFAULT 147
|
||||||
#define EEPROM_OVERRIDE_DIP_SW_DEFAULT 0
|
#define EEPROM_OVERRIDE_DIP_SW_DEFAULT 0
|
||||||
|
|
|
@ -1,25 +1,27 @@
|
||||||
/**********************************************************************************************
|
/*
|
||||||
* Copyright © 2017 Digital Confections LLC
|
* MIT License
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Copyright (c) 2020 DigitalConfections
|
||||||
* 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
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* copies or substantial portions of the Software.
|
* 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
* copies or substantial portions of the Software.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
**********************************************************************************************
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
* linkbus.c
|
* 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.
|
||||||
|
*/
|
||||||
|
/* linkbus.c
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -344,12 +346,12 @@ BOOL lb_send_string(char* str, BOOL wait)
|
||||||
{
|
{
|
||||||
return( TRUE);
|
return( TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strlen(str) > LINKBUS_MAX_TX_MSG_LENGTH)
|
if(strlen(str) > LINKBUS_MAX_TX_MSG_LENGTH)
|
||||||
{
|
{
|
||||||
return( TRUE);
|
return( TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(g_tempMsgBuff, str, LINKBUS_MAX_TX_MSG_LENGTH);
|
strncpy(g_tempMsgBuff, str, LINKBUS_MAX_TX_MSG_LENGTH);
|
||||||
|
|
||||||
if(wait)
|
if(wait)
|
||||||
|
|
|
@ -1,25 +1,27 @@
|
||||||
/**********************************************************************************************
|
/*
|
||||||
* Copyright <EFBFBD> 2017 Digital Confections LLC
|
* MIT License
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Copyright (c) 2020 DigitalConfections
|
||||||
* 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
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* copies or substantial portions of the Software.
|
* 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
* copies or substantial portions of the Software.
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
**********************************************************************************************
|
|
||||||
*
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
/*
|
||||||
* linkbus.h - a simple serial inter-processor communication protocol.
|
* linkbus.h - a simple serial inter-processor communication protocol.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -27,8 +29,6 @@
|
||||||
#define LINKBUS_H_
|
#define LINKBUS_H_
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
//#include "transmitter.h"
|
|
||||||
//#include "si5351.h"
|
|
||||||
|
|
||||||
#define LINKBUS_MAX_MSG_LENGTH 50
|
#define LINKBUS_MAX_MSG_LENGTH 50
|
||||||
#define LINKBUS_MIN_MSG_LENGTH 2 /* shortest message: GO */
|
#define LINKBUS_MIN_MSG_LENGTH 2 /* shortest message: GO */
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
|
|
||||||
#define LINKBUS_MIN_TX_INTERVAL_MS 100
|
#define LINKBUS_MIN_TX_INTERVAL_MS 100
|
||||||
|
|
||||||
#define FOSC 16000000 /* Clock Speed */
|
#define FOSC 16000000 /* Clock Speed */
|
||||||
#define BAUD 57600
|
#define BAUD 57600
|
||||||
#define MYUBRR(b) (FOSC / 16 / (b) - 1)
|
#define MYUBRR(b) (FOSC / 16 / (b) - 1)
|
||||||
|
|
||||||
|
@ -90,21 +90,21 @@ typedef enum
|
||||||
MESSAGE_EMPTY = 0,
|
MESSAGE_EMPTY = 0,
|
||||||
|
|
||||||
/* DUAL-BAND TX MESSAGE FAMILY (FUNCTIONAL MESSAGING) */
|
/* DUAL-BAND TX MESSAGE FAMILY (FUNCTIONAL MESSAGING) */
|
||||||
MESSAGE_CLOCK_CAL = 'C' * 100 + 'A' * 10 + 'L', /* Set Jerry's clock calibration value */
|
MESSAGE_CLOCK_CAL = 'C' * 100 + 'A' * 10 + 'L', /* Set Jerry's clock calibration value */
|
||||||
MESSAGE_FACTORY_RESET = 'F' * 100 + 'A' * 10 + 'C', /* Sets EEPROM back to defaults */
|
MESSAGE_FACTORY_RESET = 'F' * 100 + 'A' * 10 + 'C', /* Sets EEPROM back to defaults */
|
||||||
MESSAGE_OVERRIDE_DIP = 'D' *100 + 'I' * 10 + 'P', /* Override DIP switch settings using this value */
|
MESSAGE_OVERRIDE_DIP = 'D' * 100 + 'I' * 10 + 'P', /* Override DIP switch settings using this value */
|
||||||
MESSAGE_LEDS = 'L' * 100 + 'E' * 10 + 'D', /* Turn on or off LEDs - accepts 1 or 0 or ON or OFF */
|
MESSAGE_LEDS = 'L' * 100 + 'E' * 10 + 'D', /* Turn on or off LEDs - accepts 1 or 0 or ON or OFF */
|
||||||
MESSAGE_SYNC_ENABLE = 'S' * 100 + 'Y' * 10 + 'N', /* Enable or disable transmitter syncing */
|
MESSAGE_SYNC_ENABLE = 'S' * 100 + 'Y' * 10 + 'N', /* Enable or disable transmitter syncing */
|
||||||
MESSAGE_TEMP = 'T' * 100 + 'E' * 10 + 'M', /* Temperature data */
|
MESSAGE_TEMP = 'T' * 100 + 'E' * 10 + 'M', /* Temperature data */
|
||||||
MESSAGE_SET_STATION_ID = 'I' * 10 + 'D', /* Sets amateur radio callsign text */
|
MESSAGE_SET_STATION_ID = 'I' * 10 + 'D', /* Sets amateur radio callsign text */
|
||||||
MESSAGE_GO = 'G' * 10 + 'O', /* Synchronizes clock */
|
MESSAGE_GO = 'G' * 10 + 'O', /* Synchronizes clock */
|
||||||
MESSAGE_CODE_SPEED = 'S' * 100 + 'P' * 10 + 'D', /* Set Morse code speeds */
|
MESSAGE_CODE_SPEED = 'S' * 100 + 'P' * 10 + 'D', /* Set Morse code speeds */
|
||||||
|
|
||||||
/* UTILITY MESSAGES */
|
/* UTILITY MESSAGES */
|
||||||
MESSAGE_RESET = 'R' * 100 + 'S' * 10 + 'T', /* Processor reset */
|
MESSAGE_RESET = 'R' * 100 + 'S' * 10 + 'T', /* Processor reset */
|
||||||
MESSAGE_VERSION = 'V' * 100 + 'E' * 10 + + 'R', /* S/W version number */
|
MESSAGE_VERSION = 'V' * 100 + 'E' * 10 + +'R', /* S/W version number */
|
||||||
|
|
||||||
INVALID_MESSAGE = UINT16_MAX /* This value must never overlap a valid message ID */
|
INVALID_MESSAGE = UINT16_MAX /* This value must never overlap a valid message ID */
|
||||||
} LBMessageID;
|
} LBMessageID;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
|
|
@ -1,8 +1,25 @@
|
||||||
/*
|
/*
|
||||||
* morse.c
|
* MIT License
|
||||||
*
|
*
|
||||||
* Created: 3/19/2018 3:15:40 PM
|
* Copyright (c) 2020 DigitalConfections
|
||||||
* Author: charl
|
*
|
||||||
|
* 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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "morse.h"
|
#include "morse.h"
|
||||||
|
|
|
@ -1,11 +1,27 @@
|
||||||
/*
|
/*
|
||||||
* morse.h
|
* MIT License
|
||||||
*
|
*
|
||||||
* Created: 3/19/2018 3:16:02 PM
|
* Copyright (c) 2020 DigitalConfections
|
||||||
* Author: charl
|
*
|
||||||
|
* 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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef MORSE_H_
|
#ifndef MORSE_H_
|
||||||
#define MORSE_H_
|
#define MORSE_H_
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue