Comment changes; changed delay function to use count-down instead of count-up as per TI's Ultra-Low Power Advisor, rule 13.1

It doesn't really make any difference since it's just a delay function, but will follow their best practices anyway.
This commit is contained in:
William Miceli
2021-05-14 17:00:05 -04:00
parent 6966e0bccb
commit 27bda00eda
4 changed files with 12 additions and 48 deletions

View File

@@ -30,11 +30,12 @@ static inline void delay(void)
{
volatile int jj;
volatile int ii;
for (ii = 0; ii < 4; ii++)
// Using count-down since it uses one less instruction to compare (not really necessary here, but CCS recommends it anyway): Ultra-Low Power Advisor > Rule 13.1 (https://software-dl.ti.com/ccs/esd/documents/dmed/HTML/MSP430/1544.html)
for (ii = 4; ii > 0; ii--)
{
for (jj = 0; jj < 1000; jj++)
for (jj = 1000; jj > 0; jj--)
{
asm(" nop"); //The space is necessary or else the assember things nop is a label!
asm(" nop"); //The space is necessary or else the assembler thinks "nop" is a label!
}
}
}

View File

@@ -29,9 +29,10 @@ static inline void delay(void)
{
volatile int jj;
volatile int ii;
for (ii = 0; ii < 4; ii++)
// Using count-down since it uses one less instruction to compare (not really necessary here, but CCS recommends it anyway): Ultra-Low Power Advisor > Rule 13.1 (https://software-dl.ti.com/ccs/esd/documents/dmed/HTML/MSP430/1544.html)
for (ii = 4; ii > 0; ii--)
{
for (jj = 0; jj < 1000; jj++)
for (jj = 1000; jj > 0; jj--)
{
asm(" nop"); //The space is necessary or else the assembler thinks "nop" is a label!
}

View File

@@ -28,9 +28,10 @@ static inline void delay(void)
{
volatile int jj;
volatile int ii;
for (ii = 0; ii < 4; ii++)
// Using count-down since it uses one less instruction to compare (not really necessary here, but CCS recommends it anyway): Ultra-Low Power Advisor > Rule 13.1 (https://software-dl.ti.com/ccs/esd/documents/dmed/HTML/MSP430/1544.html)
for (ii = 4; ii > 0; ii--)
{
for (jj = 0; jj < 1000; jj++)
for (jj = 1000; jj > 0; jj--)
{
asm(" nop"); //The space is necessary or else the assembler thinks "nop" is a label!
}

View File

@@ -1,47 +1,8 @@
//
// Telemetry
//
// Modified by Erik in 2010-2011
//
/* Modifications for 2013 by B. Bazuin
* - 2013v1
* - reworked to operate continuously with CAN at 250 kbps
* - no USB device code included
* - no ADC code
* - table values collected only the first time captured
* - 2014V2 MODIFICATIONS
* - Reordered and eliminated some messages
* - HF rate 10 sec, LF rate 30 sec, ST rate 60 sec
* - BP_PCDONE and BP_ISH added
* - Precharge Controller Removed
*/
/* Modifications for 2016 by B. Bazuin
* -New BPS and Array Controller
*
/*
* main.c
*/
#include "SunseekerTelemetry2021.h"
y2021.h"
// structures
//message_fifo decode_queue;
//char_fifo USB_FIFO, MODEM_FIFO;
//hf_packet pckHF;
//lf_packet pckLF;
//status_packet pckST;
unsigned volatile char forceread;
unsigned int can_mask0, can_mask1;
enum MODE {INIT, CANREAD, DECODE, MODEMTX, USBTX, LOWP, LOOP} ucMODE;
unsigned volatile char can_status_test, can_rcv_status_test;
unsigned long can_msg_count = 0, can_stall_cnt = 0;
unsigned long can_err_count = 0, can_read_cnt = 0;
int thrs, tmin, tsec;
char ucFLAG,usbENABLE;
char CAN1_INT_FLAG = FALSE;