Пример #1
0
static void tpstest_initTask(void *data) {
	struct spi *spi;
	struct spi_opt opt = {
		.lsb = false,
		.cpol = false,
		.cpha = true,
		.cs = 0,
		.csLowInactive = false,
		.gpio = SPI_OPT_GPIO_DIS,
		.size = 8, 
		.wdelay = 0,
		.cs_hold = 54,
		.cs_delay = 54,
		.bautrate = 500000
	};
	struct spi_slave *slave;
	spi = spi_init(0, SPI_3WIRE_CS, NULL);
	CONFIG_ASSERT(spi != NULL);
	slave = spiSlave_init(spi, &opt);
	CONFIG_ASSERT(slave != NULL);
	tps = tps_init(slave, 100 / portTICK_PERIOD_MS);
	CONFIG_ASSERT(tps != NULL);
	adc = adc_init(1, 12, 4125000);
	CONFIG_ASSERT(adc != NULL);
	OS_CREATE_TASK(tpstest_task, "TPS Task", 512, NULL, 1, tpsTask);
	vTaskSuspend(NULL);
}
OS_DEFINE_TASK(tpsInitTask, 512);
int32_t tpstest_init() {
	OS_CREATE_TASK(tpstest_initTask, "TPS Init Task", 512, NULL, 4, tpsInitTask);
	return 0;
}
Пример #2
0
/**@brief Function for initializing the services that will be used by the application.
 */
static void services_init(void)
{
    tps_init();
    ias_init();
    lls_init();
    bas_init();
    ias_client_init();
}
/**@brief Initialize services that will be used by the application.
 */
void services_init(void)
{
    tps_init();  // add Tx power service
    ias_init();  // add immediate Alert Service
    lls_init();  // add Link Loss Service
    bas_init();  // add Battery alert service
    ias_client_init(); // add imediate alert service client
}