Compare commits
No commits in common. "40aa61ba9880414bcd49a84ce9b266dd63f7cfdc" and "2779d26b2a714b524c1de52297492947590c5880" have entirely different histories.
40aa61ba98
...
2779d26b2a
1 changed files with 9 additions and 8 deletions
17
main.c
17
main.c
|
@ -142,9 +142,9 @@ int main(void) {
|
|||
|
||||
IntMasterEnable();
|
||||
|
||||
uint8_t voltage_scale = 4; // 2v
|
||||
uint8_t time_scale = 5; // 20us
|
||||
uint8_t trigger_mode = 1; // rising
|
||||
uint8_t voltage_scale = 0;
|
||||
uint8_t time_scale = 0;
|
||||
uint8_t trigger_mode = 1;
|
||||
|
||||
while (true) {
|
||||
// calculate cpu usage
|
||||
|
@ -238,12 +238,9 @@ int main(void) {
|
|||
float fVoltsPerDiv = gVoltageScale[voltage_scale];
|
||||
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++) {
|
||||
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
#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)))
|
||||
#define TRANSPOSE(x) (HEIGHT/2) - (int)roundf(fScale * ((int)x - ADC_OFFSET));
|
||||
uint32_t upper,lower, current, last;
|
||||
|
||||
if (j==0) {
|
||||
|
@ -253,6 +250,10 @@ int main(void) {
|
|||
} else {
|
||||
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);
|
||||
lower = MIN(current, last);
|
||||
|
||||
|
|
Loading…
Reference in a new issue