implementation {
components MicP, MicaBusC, HplAtm128GeneralIOC as Pins,
HplAtm128InterruptC as IntPins,
- new Atm128I2CMasterC() as I2CPot,
- new TimerMilliC() as WarmupTimer,
+ new Atm128I2CMasterC() as I2CPot,
+ new TimerMilliC() as WarmupTimer,
new RoundRobinArbiterC(UQ_MIC_RESOURCE) as Arbiter,
new SplitControlPowerManagerC() as PowerManager;
Resource = Arbiter;
- Atm128AdcConfig = MicP;
- MicSetting = MicP;
+ Atm128AdcConfig = MicP;
+ MicSetting = MicP;
PowerManager.ResourceDefaultOwner -> Arbiter;
PowerManager.ArbiterInfo -> Arbiter;
provides interface Atm128AdcConfig as MicAtm128AdcConfig;
uses interface Timer<TMilli>;
- uses interface GeneralIO as MicPower;
- uses interface GeneralIO as MicMuxSel;
- uses interface MicaBusAdc as MicAdc;
+ uses interface GeneralIO as MicPower;
+ uses interface GeneralIO as MicMuxSel;
+ uses interface MicaBusAdc as MicAdc;
uses interface I2CPacket<TI2CBasicAddr>;
uses interface Resource as I2CResource;
uses interface HplAtm128Interrupt as AlertInterrupt;
call AlertInterrupt.disable();
call MicPower.makeOutput();
call MicPower.set();
- call MicMuxSel.makeOutput();
- call MicMuxSel.clr();
+ call MicMuxSel.makeOutput();
+ call MicMuxSel.clr();
call MicSetting.muxSel(1); // Set the mux so that raw microhpone output is selected
call MicSetting.gainAdjust(64); // Set the gain of the microphone.
call Timer.startOneShot(1200);
-// signal SplitControl.startDone(SUCCESS);
return SUCCESS;
}
}
/**
- * Resource request
- *
- */
+ * Resource request
+ *
+ */
event void I2CResource.granted()
{
- if ( call I2CPacket.write(0x3,TOS_MIC_POT_ADDR, 2, gainData) == SUCCESS)
- {
- return;
- };
+ call I2CPacket.write(0x3,TOS_MIC_POT_ADDR, 2, gainData);
}
/**
- * mic control
- *
- */
+ * mic control
+ *
+ */
command error_t MicSetting.muxSel(uint8_t sel)
{
if (sel == 0)
- {
- call MicMuxSel.clr();
- return SUCCESS;
- }
+ {
+ call MicMuxSel.clr();
+ return SUCCESS;
+ }
else if (sel == 1)
- {
- call MicMuxSel.set();
- return SUCCESS;
- }
+ {
+ call MicMuxSel.set();
+ return SUCCESS;
+ }
return FAIL;
}
}
/**
- * mic interrupt control
- *
- */
+ * mic interrupt control
+ *
+ */
async command error_t MicSetting.enable()
{
call AlertInterrupt.enable();
}
/**
- *
- *
- */
+ *
+ *
+ */
async command uint8_t MicAtm128AdcConfig.getChannel()
{
}
/**
- * I2CPot2
- *
- */
+ * I2CPot2
+ *
+ */
async event void I2CPacket.readDone(error_t error, uint16_t addr, uint8_t length, uint8_t* data)
{
- return ;
}
async event void I2CPacket.writeDone(error_t error, uint16_t addr, uint8_t length, uint8_t* data)
{
call I2CResource.release();
- return ;
}
}