mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-31 05:52:55 +08:00
change at86rf to 1ghznode
rom device runs ok with lpc11uxx
This commit is contained in:
parent
04a641f067
commit
3b9a616ca9
@ -62,7 +62,7 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// BOARD DEFINE
|
||||
//--------------------------------------------------------------------+
|
||||
#define BOARD_AT86RF2XX 1
|
||||
#define BOARD_RF1GHZNODE 1
|
||||
#define BOARD_LPCXPRESSO1347 2
|
||||
|
||||
#define BOARD_NGX4330 3
|
||||
@ -86,8 +86,8 @@
|
||||
#include "ngx/board_ngx4330.h"
|
||||
#elif BOARD == BOARD_LPCXPRESSO1347
|
||||
#include "lpcxpresso/board_lpcxpresso1347.h"
|
||||
#elif BOARD == BOARD_AT86RF2XX
|
||||
#include "board_at86rf2xx.h"
|
||||
#elif BOARD == BOARD_RF1GHZNODE
|
||||
#include "microbuilder/board_rf1ghznode.h"
|
||||
#elif BOARD == BOARD_EA4357
|
||||
#include "embedded_artists/board_ea4357.h"
|
||||
#elif BOARD == BOARD_MCB4300
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@file board_at86rf2xx.c
|
||||
@file board_rf1ghznode.c
|
||||
@author hathach (tinyusb.org)
|
||||
|
||||
@section LICENSE
|
||||
@ -38,7 +38,7 @@
|
||||
|
||||
#include "../board.h"
|
||||
|
||||
#if BOARD == BOARD_AT86RF2XX
|
||||
#if BOARD == BOARD_RF1GHZNODE
|
||||
|
||||
void board_init(void)
|
||||
{
|
||||
@ -57,10 +57,15 @@ void board_init(void)
|
||||
//--------------------------------------------------------------------+
|
||||
// LEDS
|
||||
//--------------------------------------------------------------------+
|
||||
void board_leds(uint32_t mask, uint32_t state)
|
||||
void board_leds(uint32_t on_mask, uint32_t off_mask)
|
||||
{
|
||||
if (mask)
|
||||
GPIOSetBitValue(CFG_LED_PORT, CFG_LED_PIN, mask & state ? CFG_LED_ON : CFG_LED_OFF);
|
||||
if (on_mask & BIT_(0))
|
||||
{
|
||||
GPIOSetBitValue(CFG_LED_PORT, CFG_LED_PIN, CFG_LED_ON);
|
||||
}else if (off_mask & BIT_(0))
|
||||
{
|
||||
GPIOSetBitValue(CFG_LED_PORT, CFG_LED_PIN, CFG_LED_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
@ -1,6 +1,6 @@
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@file board_at86rf2xx.h
|
||||
@file board_rf1ghznode.h
|
||||
@author hathach (tinyusb.org)
|
||||
|
||||
@section LICENSE
|
||||
@ -49,8 +49,8 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef _TUSB_BOARD_AT86RF2XX_H_
|
||||
#define _TUSB_BOARD_AT86RF2XX_H_
|
||||
#ifndef _TUSB_BOARD_RF1GHZNODE_H_
|
||||
#define _TUSB_BOARD_RF1GHZNODE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -60,19 +60,17 @@
|
||||
#include "lpc11uxx/gpio.h"
|
||||
#include "lpc11uxx/uart.h"
|
||||
|
||||
#define CFG_PRINTF_TARGET PRINTF_TARGET_UART
|
||||
#define CFG_PRINTF_TARGET PRINTF_TARGET_DEBUG_CONSOLE
|
||||
|
||||
#define CFG_LED_PORT (1)
|
||||
#define CFG_LED_PIN (31)
|
||||
#define CFG_LED_ON (0)
|
||||
#define CFG_LED_OFF (1)
|
||||
|
||||
#define CFG_PRINTF_TARGET PRINTF_TARGET_UART
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TUSB_BOARD_AT86RF2XX_H_ */
|
||||
#endif /* _TUSB_BOARD_RF1GHZNODE_H_ */
|
||||
|
||||
/** @} */
|
File diff suppressed because it is too large
Load Diff
@ -23,7 +23,7 @@ int main(void)
|
||||
board_init();
|
||||
tusb_init();
|
||||
|
||||
print_greeting();
|
||||
//print_greeting();
|
||||
while (1)
|
||||
{
|
||||
if (current_tick + 1000 < system_ticks)
|
||||
@ -38,8 +38,13 @@ int main(void)
|
||||
if (usb_isConfigured())
|
||||
{
|
||||
#if TUSB_CFG_DEVICE_HID_KEYBOARD
|
||||
static uint32_t count =0;
|
||||
if (count < 4)
|
||||
{
|
||||
uint8_t keys[6] = {0x04}; // A character
|
||||
tusbd_hid_keyboard_send_report(0x00, keys, 1);
|
||||
count++;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TUSB_CFG_DEVICE_HID_MOUSE
|
||||
|
@ -102,7 +102,7 @@
|
||||
|
||||
#ifdef __CODE_RED // make use of code red's support for ram region macros
|
||||
#if (MCU == MCU_LPC11UXX) || (MCU == MCU_LPC13UXX)
|
||||
#define TUSB_RAM_SECTION ".data.$RAM1"
|
||||
#define TUSB_RAM_SECTION ".data.$RAM1" // TODO overflow usb ram
|
||||
#elif (MCU == MCU_LPC43XX)
|
||||
#define TUSB_RAM_SECTION ".data.$RAM3"
|
||||
#endif
|
||||
|
@ -297,7 +297,7 @@ const app_descriptor_configuration_t app_desc_configuration =
|
||||
{
|
||||
.bLength = sizeof(tusb_descriptor_endpoint_t),
|
||||
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
|
||||
.bEndpointAddress = 0x81,
|
||||
.bEndpointAddress = 0x81, //HID_KEYBOARD_EP_IN,
|
||||
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
|
||||
.wMaxPacketSize = { .size = 0x08 },
|
||||
.bInterval = 0x0A
|
||||
@ -376,8 +376,6 @@ const app_descriptor_configuration_t app_desc_configuration =
|
||||
.bInterval = 1
|
||||
},
|
||||
#endif
|
||||
|
||||
.null_termination = 0,
|
||||
};
|
||||
|
||||
TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4)
|
||||
|
@ -59,12 +59,12 @@
|
||||
// IMPLEMENTATION
|
||||
//--------------------------------------------------------------------+
|
||||
#if TUSB_CFG_DEVICE_HID_KEYBOARD
|
||||
tusb_keyboard_report_t hid_keyboard_report;
|
||||
TUSB_CFG_ATTR_USBRAM tusb_keyboard_report_t hid_keyboard_report;
|
||||
static volatile bool bKeyChanged = false;
|
||||
#endif
|
||||
|
||||
#if TUSB_CFG_DEVICE_HID_MOUSE
|
||||
tusb_mouse_report_t hid_mouse_report;
|
||||
TUSB_CFG_ATTR_USBRAM tusb_mouse_report_t hid_mouse_report;
|
||||
static volatile bool bMouseChanged = false;
|
||||
#endif
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@file dcd_lpc13xx.h
|
||||
@file dcd_lpc11uxx_lpc13xx.h
|
||||
@author hathach (tinyusb.org)
|
||||
|
||||
@section LICENSE
|
||||
@ -43,8 +43,8 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef _TUSB_DCD_LPC13XX_H_
|
||||
#define _TUSB_DCD_LPC13XX_H_
|
||||
#ifndef _TUSB_DCD_LPC11UXX_LPC13XX_H_
|
||||
#define _TUSB_DCD_LPC11UXX_LPC13XX_H_
|
||||
|
||||
#define DEVICE_ROM_REG_BASE LPC_USB_BASE
|
||||
#define DEVICE_ROM_DRIVER_ADDR 0x1FFF1FF8
|
||||
@ -54,10 +54,11 @@
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TUSB_DCD_LPC13XX_H_ */
|
||||
#endif /* _TUSB_DCD_LPC11UXX_LPC13XX_H_ */
|
||||
|
||||
/** @} */
|
@ -55,8 +55,8 @@
|
||||
#if (MCU == MCU_LPC18XX) || (MCU == MCU_LPC43XX)
|
||||
#include "dcd_lpc18xx_lpc43xx.h"
|
||||
#define ROM_API ( * ((USBD_API_T**) DEVICE_ROM_DRIVER_ADDR) )
|
||||
#elif (MCU == MCU_LPC13UXX)
|
||||
#include "dcd_lpc13xx.h"
|
||||
#elif (MCU == MCU_LPC13UXX) || (MCU == MCU_LPC11UXX)
|
||||
#include "dcd_lpc11uxx_lpc13xx.h"
|
||||
#define ROM_API ( * (*((USBD_API_T***) DEVICE_ROM_DRIVER_ADDR)) )
|
||||
#else
|
||||
#error forgot something, thach ?
|
||||
|
@ -87,7 +87,7 @@ static inline void hal_interrupt_disable(uint8_t controller_id) ATTR_ALWAYS_INLI
|
||||
static inline bool hal_debugger_is_attached(void) ATTR_PURE ATTR_ALWAYS_INLINE;
|
||||
static inline bool hal_debugger_is_attached(void)
|
||||
{
|
||||
#ifndef _TEST_
|
||||
#if !defined(_TEST_) && !(MCU==MCU_LPC11UXX)
|
||||
return (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) == CoreDebug_DHCSR_C_DEBUGEN_Msk;
|
||||
#else
|
||||
return false;
|
||||
|
@ -57,4 +57,9 @@ tusb_error_t hal_init()
|
||||
return TUSB_ERROR_NONE;
|
||||
}
|
||||
|
||||
void USB_IRQHandler(void)
|
||||
{
|
||||
tusb_isr(0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -54,9 +54,6 @@
|
||||
|
||||
#include "LPC11Uxx.h"
|
||||
|
||||
#define DEVICE_ROM_REG_BASE LPC_USB_BASE
|
||||
#define DEVICE_ROM_DRIVER_ADDR 0x1FFF1FF8
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -43,7 +43,7 @@
|
||||
|
||||
tusb_error_t hal_init()
|
||||
{
|
||||
// TODO usb abstract later
|
||||
// TODO remove magic number
|
||||
/* Enable AHB clock to the USB block and USB RAM. */
|
||||
LPC_SYSCON->SYSAHBCLKCTRL |= ((0x1<<14) | (0x1<<27));
|
||||
|
||||
@ -54,8 +54,6 @@ tusb_error_t hal_init()
|
||||
LPC_IOCON->PIO0_6 &= ~0x07;
|
||||
LPC_IOCON->PIO0_6 |= (0x01<<0); /* Secondary function SoftConn */
|
||||
|
||||
hal_interrupt_enable(0);
|
||||
|
||||
return TUSB_ERROR_NONE;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user