Changeset 13


Ignore:
Timestamp:
Aug 1, 2019, 11:47:58 AM (5 years ago)
Author:
bouyer
Message:

Test both leds on boot
blink differently when when idle and when connected to console

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/software/firmware/main.c

    r11 r13  
    1313void _startup (void) __naked;
    1414
    15 static char counter_1hz;               
     15static char counter_2hz;               
    1616static volatile short counter_10hz;           
    1717static volatile unsigned char softintrs;
     
    7777{
    7878        softintrs = 0;
    79         counter_1hz = 10;
    8079
    8180        ANCON0 = 0xf0; /* an0-an3 analog, an4-an7 digital */
     
    204203        /* enable watch dog timer */ 
    205204        WDTCON = 0x01;
     205        LEDR = 1;
     206        LEDG = 1;
     207        counter_2hz = 5;
     208        while (counter_2hz > 0) {
     209                if (softintrs & INT_10HZ) {
     210                        softintrs &= ~INT_10HZ;
     211                        counter_2hz--;
     212                }
     213        }
     214        counter_2hz = 5;
    206215        LEDR = 0;
     216        LEDG = 0;
    207217
    208218        printf("\nready\n");
    209219        ad_channel = 0;
    210220        ADCON0bits.CHS = 0;
    211         LEDG = 1;
    212221        PWRON = 0;
    213222
     
    216225                if (softintrs & INT_10HZ) {
    217226                        softintrs &= ~INT_10HZ;
    218                         LEDG ^= 1;
     227                        counter_2hz--;
     228                        if (counter_2hz == 0) {
     229                                counter_2hz = 5;
     230                                LEDG ^= 1;
     231                        }
    219232                }
    220233                if (softintrs & INT_RX1) {
Note: See TracChangeset for help on using the changeset viewer.