/**************************************************************************** DESCRIPTION Initialises the Button Module parameters */ void ButtonsInit ( ButtonsTaskData *pButtonsTask ) { #ifdef ENABLE_CAPSENSE uint8 i; bool success; #endif pButtonsTask->task.handler = ButtonsMessageHandler; /*connect the underlying PIO task to this task*/ MessagePioTask(&pButtonsTask->task); /*connect the underlying Charger task to this task*/ MessageChargerTask(&pButtonsTask->task); #ifdef ENABLE_CAPSENSE /* set the update rate, currently a fast update rate to detect short touches */ success = CapsenseConfigure(CAPSENSE_SET_CINT_UPDATE_DIVIDER, 0); /* set an initial trigger level for the cap sensors, this level will depend upon hardware and tests will need to be carried out to determine what a particular implementation requires */ for (i = 0; success && (i < BM_CAP_SENSORS); i++) success = CapsenseConfigurePad(i, CAPSENSE_SET_TRIGGER_LEVEL, BM_CAP_SENSOR_LOW_SENSITIVITY); B_DEBUG(("B: capsense %s\n", success ? "OK" : "FAIL: check CONFIG_CAP_SENSE_PRELOAD")) ; /* initialise task handler for capsense events after a short delay due to spurious events generated from the firmware during this time */ MessageSendLater(&pButtonsTask->task,B_MESSAGE_CAPSENSE_ENABLE,0,CAPSENSE_INIT_INTERVAL); #endif }
/**************************************************************************** DESCRIPTION Initialises the Button Module parameters */ void ButtonsInit ( ButtonsTaskData *pButtonsTask ) { pButtonsTask->task.handler = ButtonsMessageHandler; /*connect the underlying PIO task to this task*/ MessagePioTask(&pButtonsTask->task); /*connect the underlying Charger task to this task*/ MessageChargerTask(&pButtonsTask->task); }