Ejemplo n.º 1
0
void chb_drvr_init()
{
    // ToDo: Make sure gpioInit has been called
    // ToDo: Make sure CT32B0 has been initialised and enabled

    // config SPI for at86rf230 access
    chb_spi_init();

    // Setup 16-bit timer 0 (used for us delays)
    timer16Init(0, 0xFFFF);
    timer16Enable(0);

    // Set sleep and reset as output
    gpioSetDir(CHB_SLPTRPORT, CHB_SLPTRPIN, 1);
    gpioSetDir(CHB_RSTPORT, CHB_RSTPIN, 1);

    // configure IOs
    gpioSetValue(CHB_SLPTRPORT, CHB_SLPTRPIN, 1);  // Set sleep high
    gpioSetValue(CHB_RSTPORT, CHB_RSTPIN, 1);      // Set reset high

    // Set internal resistors
    gpioSetPullup (&CHB_SLPTRPIN_IOCONREG, gpioPullupMode_Inactive);
    gpioSetPullup (&CHB_RSTPIN_IOCONREG, gpioPullupMode_Inactive);

    // config radio
    chb_radio_init();
}
Ejemplo n.º 2
0
void ds18b20Init(uint32_t portNumber, uint32_t bitPosition, volatile uint32_t *ioconReg) {
    portNum = portNumber;
    bitPos = bitPosition;
    timer16Init(1, TIMER16_DEFAULTINTERVAL);
    timer16Enable(1);
    gpioSetPullup(ioconReg, gpioPullupMode_Inactive);
}