A stack which works with or without an Mbed os library. Provides IPv4 or IPv6 with a full 1500 byte buffer.

Dependents:   oldheating gps motorhome heating

link/jack.c

Committer:
andrewboyson
Date:
2019-07-19
Revision:
151:bde6f7da1755
Parent:
133:a37eb35a03f1

File content as of revision 151:bde6f7da1755:

#include <stdbool.h>
#include "gpio.h"
#include "net-jack-leds.h"
#include "mstimer.h"

#define BLINK_DURATION_MS 50

void JackLeds(bool phyLink, bool phySpeed, bool activity)
{
    static int blinkTimer = 0;
    
    if (activity) blinkTimer = MsTimerCount;
    if (MsTimerRelative(blinkTimer, BLINK_DURATION_MS))
    {
        if (phyLink)  LED_GR_L_SET; else LED_GR_L_CLR;
        if (phySpeed) LED_YE_R_SET; else LED_YE_R_CLR;
    }
    else
    {
        LED_GR_L_CLR;
        LED_YE_R_CLR;
    }
}

void JackInit()
{
    LED_GR_L_DIR = 1; //Set the direction to 1 == output
    LED_YE_R_DIR = 1; //Set the direction to 1 == output
}