Compare commits

..

No commits in common. "40aa61ba9880414bcd49a84ce9b266dd63f7cfdc" and "2779d26b2a714b524c1de52297492947590c5880" have entirely different histories.

17
main.c
View file

@ -142,9 +142,9 @@ int main(void) {
IntMasterEnable(); IntMasterEnable();
uint8_t voltage_scale = 4; // 2v uint8_t voltage_scale = 0;
uint8_t time_scale = 5; // 20us uint8_t time_scale = 0;
uint8_t trigger_mode = 1; // rising uint8_t trigger_mode = 1;
while (true) { while (true) {
// calculate cpu usage // calculate cpu usage
@ -238,12 +238,9 @@ int main(void) {
float fVoltsPerDiv = gVoltageScale[voltage_scale]; float fVoltsPerDiv = gVoltageScale[voltage_scale];
float fScale = (VIN_RANGE * PIXELS_PER_DIV)/((1 << ADC_BITS) * fVoltsPerDiv); float fScale = (VIN_RANGE * PIXELS_PER_DIV)/((1 << ADC_BITS) * fVoltsPerDiv);
GrContextForegroundSet(&sContext, ClrYellow); GrContextForegroundSet(&sContext, ClrPink);
for(j=0; j<LOCAL_BUF_LEN; j++) { for(j=0; j<LOCAL_BUF_LEN; j++) {
#define MIN(a,b) (((a)<(b))?(a):(b)) #define TRANSPOSE(x) (HEIGHT/2) - (int)roundf(fScale * ((int)x - ADC_OFFSET));
#define MAX(a,b) (((a)>(b))?(a):(b))
#define CONSTRAIN(x) MAX(MIN(HEIGHT - 1, x), 0)
#define TRANSPOSE(x) CONSTRAIN((HEIGHT/2) - (int)roundf(fScale * ((int)x - ADC_OFFSET)))
uint32_t upper,lower, current, last; uint32_t upper,lower, current, last;
if (j==0) { if (j==0) {
@ -253,6 +250,10 @@ int main(void) {
} else { } else {
current = TRANSPOSE(local_adc_buffer[j]); current = TRANSPOSE(local_adc_buffer[j]);
// couldn't find these anywhere
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
upper = MAX(current, last); upper = MAX(current, last);
lower = MIN(current, last); lower = MIN(current, last);