def __init__(self, address): self.config = I2C_M_SETUP_Type() self.tx_data = Array(2, 1) self.rx_data = Array(1, 1) self.config.sl_addr7bit = address self.config.tx_data = self.tx_data.ptr self.config.retransmissions_max = 3
from robovero.LPC17xx import LPC_UART1 from robovero.lpc17xx_uart import UART_Receive, UART_FIFO_CFG_Type, UART_FIFOConfig, UART_FIFOConfigStructInit from robovero.lpc_types import TRANSFER_BLOCK_Type import time __author__ = "Danny Chan" __email__ = "*****@*****.**" __copyright__ = "Copyright 2012, Gumstix Inc." __license__ = "BSD 2-Clause" __version__ = "0.1" roboveroConfig() UARTFIFOConfigStruct = UART_FIFO_CFG_Type() UART_FIFOConfigStructInit(UARTFIFOConfigStruct.ptr) UART_FIFOConfig(LPC_UART1, UARTFIFOConfigStruct.ptr) msg = Array(18, 1, "") try: while True: length = UART_Receive(LPC_UART1, msg.ptr, 18, TRANSFER_BLOCK_Type.NONE_BLOCKING) if length != 0: print 'length=', length for n in range(length): print hex(msg[n]), print('') except: exit("goodbye")
"""Send user messages out of UART1. """ from robovero.extras import Array, roboveroConfig from robovero.LPC17xx import LPC_UART1 from robovero.lpc17xx_uart import UART_Send from robovero.lpc_types import TRANSFER_BLOCK_Type import time __author__ = "Neil MacMunn" __email__ = "*****@*****.**" __copyright__ = "Copyright 2010, Gumstix Inc." __license__ = "BSD 2-Clause" __version__ = "0.1" roboveroConfig() while True: _msg = raw_input("enter a message:") msg = Array(len(_msg), 1, _msg) UART_Send(LPC_UART1, msg.ptr, msg.length, TRANSFER_BLOCK_Type.BLOCKING) print _msg time.sleep(1)
from robovero.extras import Array, roboveroConfig from robovero.LPC17xx import LPC_UART1 from robovero.lpc17xx_uart import UART_Receive, UART_FIFO_CFG_Type, UART_FIFOConfig, UART_FIFOConfigStructInit from robovero.lpc_types import TRANSFER_BLOCK_Type import time __author__ = "Danny Chan" __email__ = "*****@*****.**" __copyright__ = "Copyright 2012, Gumstix Inc." __license__ = "BSD 2-Clause" __version__ = "0.1" roboveroConfig() UARTFIFOConfigStruct = UART_FIFO_CFG_Type() UART_FIFOConfigStructInit(UARTFIFOConfigStruct.ptr) UART_FIFOConfig(LPC_UART1, UARTFIFOConfigStruct.ptr); msg = Array(1, 1, "") try: while True: length = UART_Receive(LPC_UART1, msg.ptr, 1, TRANSFER_BLOCK_Type.NONE_BLOCKING) if length!=0: print chr(msg[0]) time.sleep(1) except: exit("goodbye")
def SendToArduino(speed, rot_speed, orientation): value2send = FloatToBytes(speed, rot_speed, orientation) msg_send = Array(len(value2send), 1, value2send) UART_Send(LPC_UART1, msg_send.ptr, msg_send.length, TRANSFER_BLOCK_Type.BLOCKING)