provides interface Resource[ uint8_t id ];
provides interface ResourceConfigure[ uint8_t id ];
- provides interface Msp430UartControl as UartControl[ uint8_t id ];
+ //provides interface Msp430UartControl as UartControl[ uint8_t id ];
provides interface UartStream;
provides interface UartByte;
}
async command void ResourceConfigure.configure[ uint8_t id ]() {
- call UartControl.setModeDuplex[id]();
+ msp430_uart_union_config_t* config = call Msp430UartConfigure.getConfig[id]();
+ m_byte_time = config->uartConfig.ubr / 2;
+ call Usart.setModeUart(config);
+ call Usart.enableIntr();
}
async command void ResourceConfigure.unconfigure[ uint8_t id ]() {
+ call Usart.resetUsart(TRUE);
call Usart.disableIntr();
call Usart.disableUart();
+ call Usart.resetUsart(FALSE);
}
event void UsartResource.granted[ uint8_t id ]() {
signal Resource.granted[ id ]();
}
-
- async command void UartControl.setModeRx[ uint8_t id ]() {
- msp430_uart_config_t* config = call Msp430UartConfigure.getConfig[id]();
- m_byte_time = config->ubr / 2;
- call Usart.setModeUartRx(config);
- call Usart.clrIntr();
- call Usart.enableRxIntr();
- }
-
- async command void UartControl.setModeTx[ uint8_t id ]() {
- call Usart.setModeUartTx(call Msp430UartConfigure.getConfig[id]());
- call Usart.clrIntr();
- call Usart.enableTxIntr();
- }
-
- async command void UartControl.setModeDuplex[ uint8_t id ]() {
- msp430_uart_config_t* config = call Msp430UartConfigure.getConfig[id]();
- m_byte_time = config->ubr / 2;
- call Usart.setModeUart(config);
- call Usart.clrIntr();
- call Usart.enableIntr();
- }
async command error_t UartStream.enableReceiveInterrupt() {
call Usart.enableRxIntr();
async command error_t UartByte.send( uint8_t data ) {
call Usart.tx( data );
while( !call Usart.isTxIntrPending() );
+ call Usart.clrTxIntr();
return SUCCESS;
}
start = call Counter.get();
while( !call Usart.isRxIntrPending() ) {
if ( ( call Counter.get() - start ) >= timeout_micro )
- return FAIL;
+ return FAIL;
}
*byte = call Usart.rx();
default async command error_t UsartResource.request[ uint8_t id ]() { return FAIL; }
default async command error_t UsartResource.immediateRequest[ uint8_t id ]() { return FAIL; }
default async command error_t UsartResource.release[ uint8_t id ]() { return FAIL; }
- default async command msp430_uart_config_t* Msp430UartConfigure.getConfig[uint8_t id]() {
+ default async command msp430_uart_union_config_t* Msp430UartConfigure.getConfig[uint8_t id]() {
return &msp430_uart_default_config;
}