Skip to content

Commit f0c52a0

Browse files
authored
Merge pull request #31 from ROBOTIS-GIT/develop
merge from develop
2 parents f4dab0e + b466b4a commit f0c52a0

File tree

8 files changed

+60
-19
lines changed

8 files changed

+60
-19
lines changed

arduino/opencr_arduino/opencr/libraries/OLLO/OLLO.cpp

+10-3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ void OLLO::begin(int devNum){
5555
}
5656
mMot_plus = 0;
5757
mMot_minus = 0;
58+
59+
60+
pinMode(OLLO_SLEEP, OUTPUT);
61+
digitalWrite(OLLO_SLEEP, HIGH);
62+
5863
switch(devNum){
5964
case 1:
6065
pinMode(PORT1_SIG1, OUTPUT); //RED (right)
@@ -86,6 +91,10 @@ void OLLO::begin(int devNum, OlloDeviceIndex device_index){ //MAGNETIC SENSOR, B
8691
}
8792
mMot_plus = 0;
8893
mMot_minus = 0;
94+
95+
pinMode(OLLO_SLEEP, OUTPUT);
96+
digitalWrite(OLLO_SLEEP, HIGH);
97+
8998
switch(devNum){
9099
case 1:
91100
if(device_index == TOUCH_SENSOR || device_index == PIR_SENSOR || device_index == MAGNETIC_SENSOR){
@@ -608,8 +617,6 @@ int OLLO::detectColor(uint8_t port){
608617
before_color_cnt = 0;
609618
}
610619

611-
before_color_num = bColorResult;
620+
before_color_num = bColorResult;
612621
return 0;
613622
}
614-
615-

arduino/opencr_arduino/opencr/libraries/OLLO/OLLO.h

+9-6
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,16 @@ typedef enum COLOR_INDEX {
5050
#define PORT2_SIG2 44
5151
#define PORT2_ADC 45
5252

53-
#define PORT3_SIG1 40
54-
#define PORT3_SIG2 41
55-
#define PORT3_ADC 42
53+
#define PORT3_SIG1 70
54+
#define PORT3_SIG2 71
55+
#define PORT3_ADC 72
56+
57+
#define PORT4_SIG1 73
58+
#define PORT4_SIG2 74
59+
#define PORT4_ADC 75
60+
61+
#define OLLO_SLEEP 46
5662

57-
#define PORT4_SIG1 43
58-
#define PORT4_SIG2 44
59-
#define PORT4_ADC 45
6063

6164
class OLLO {
6265
private:

arduino/opencr_arduino/opencr/variants/OpenCR/bsp/opencr/usbd_cdc_interface.c

+2-7
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ extern USBD_HandleTypeDef USBD_Device;
8585
static int8_t CDC_Itf_Init(void);
8686
static int8_t CDC_Itf_DeInit(void);
8787
static int8_t CDC_Itf_Control(uint8_t cmd, uint8_t* pbuf, uint16_t length);
88-
static void CDC_Itf_TxISR(void);
88+
void CDC_Itf_TxISR(void);
8989
static int8_t CDC_Itf_Receive(uint8_t* pbuf, uint32_t *Len);
9090
static uint32_t CDC_Itf_TxAvailable( void );
9191

@@ -128,11 +128,6 @@ static int8_t CDC_Itf_Init(void)
128128
rxd_BufPtrIn = 0;
129129
rxd_BufPtrOut = 0;
130130

131-
132-
drv_timer_set_period(TIMER_USB, 1000); // 5ms
133-
drv_timer_attachInterrupt(TIMER_USB, CDC_Itf_TxISR);
134-
drv_timer_resume(TIMER_USB);
135-
136131
return (USBD_OK);
137132
}
138133

@@ -477,7 +472,7 @@ BOOL CDC_Itf_IsConnected( void )
477472
{
478473
if( USBD_Device.dev_config == 0
479474
|| is_opened == FALSE
480-
|| USBD_Device.pClassData == NULL )
475+
|| USBD_Device.pClassData == NULL )
481476
{
482477
return FALSE;
483478
}

arduino/opencr_arduino/opencr/variants/OpenCR/bsp/opencr/usbd_conf.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,14 @@ void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
238238
* @param hpcd: PCD handle
239239
* @retval None
240240
*/
241+
extern void CDC_Itf_TxISR(void);
242+
241243
void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd)
242244
{
243245
USBD_LL_SOF(hpcd->pData);
246+
247+
// for USB CDC
248+
CDC_Itf_TxISR();
244249
}
245250

246251
/**
@@ -357,7 +362,7 @@ USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
357362
hpcd.Init.dma_enable = 0;
358363
hpcd.Init.low_power_enable = 0;
359364
hpcd.Init.phy_itface = PCD_PHY_EMBEDDED;
360-
hpcd.Init.Sof_enable = 0;
365+
hpcd.Init.Sof_enable = 1;
361366
hpcd.Init.speed = PCD_SPEED_FULL;
362367
hpcd.Init.vbus_sensing_enable = 0;
363368
hpcd.Init.lpm_enable = 0;

arduino/opencr_arduino/opencr/variants/OpenCR/src/drv_timer.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim)
156156
if( htim->Instance == TIM6 )
157157
{
158158
__HAL_RCC_TIM6_CLK_ENABLE();
159-
HAL_NVIC_SetPriority(TIM6_DAC_IRQn, 5, 0);
159+
HAL_NVIC_SetPriority(TIM6_DAC_IRQn, 10, 0);
160160
HAL_NVIC_EnableIRQ(TIM6_DAC_IRQn);
161161
}
162162

arduino/opencr_arduino/opencr/variants/OpenCR/variant.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ extern const Pin2PortMapArray g_Pin2PortMapArray[]=
8787
{GPIOC, GPIO_PIN_5, NULL, NO_ADC , NULL , NO_PWM , NO_EXTI }, // 43 OLLO_P2_SIG1
8888
{GPIOB, GPIO_PIN_1, NULL, NO_ADC , NULL , NO_PWM , NO_EXTI }, // 44 OLLO_P2_SIG2
8989
{GPIOC, GPIO_PIN_4, &hADC1, ADC_CHANNEL_14, NULL , NO_PWM , 6 }, // 45 OLLO_P2_ADC EXTI_6
90-
{GPIOF, GPIO_PIN_7, NULL, NO_ADC , NULL , NO_PWM , NO_EXTI }, // 46
90+
{GPIOD, GPIO_PIN_10, NULL, NO_ADC , NULL , NO_PWM , NO_EXTI }, // 46 OLLO_SLEEP
9191
{GPIOF, GPIO_PIN_7, NULL, NO_ADC , NULL , NO_PWM , NO_EXTI }, // 47
9292
{GPIOF, GPIO_PIN_7, NULL, NO_ADC , NULL , NO_PWM , NO_EXTI }, // 48
9393
{GPIOF, GPIO_PIN_7, NULL, NO_ADC , NULL , NO_PWM , NO_EXTI }, // 49
Binary file not shown.

arduino/opencr_release/package_opencr_index.json

+31
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,37 @@
226226
"version": "1.0.0"
227227
}
228228
]
229+
},
230+
{
231+
"name": "OpenCR",
232+
"architecture": "OpenCR",
233+
"version": "1.0.7",
234+
"category": "Arduino",
235+
"help": {
236+
"online": "https://github.com/ROBOTIS-GIT/OpenCR"
237+
},
238+
"url": "https://github.com/ROBOTIS-GIT/OpenCR/releases/download/1.0.7/opencr_core_1.0.7.tar.bz2",
239+
"archiveFileName": "opencr_core_1.0.7.tar.bz2",
240+
"checksum": "SHA-256:05a38b30efd11d6e1ed340d9727bff590c5391f511dee41e76cd0f54aed4f42b",
241+
"size": "2662016",
242+
"help": {
243+
"online": "https://github.com/ROBOTIS-GIT/OpenCR"
244+
},
245+
"boards": [
246+
{"name": "OpenCR"}
247+
],
248+
"toolsDependencies": [
249+
{
250+
"packager": "OpenCR",
251+
"name": "opencr_gcc",
252+
"version": "5.4.0-2016q2"
253+
},
254+
{
255+
"packager": "OpenCR",
256+
"name": "opencr_tools",
257+
"version": "1.0.0"
258+
}
259+
]
229260
}
230261

231262
],

0 commit comments

Comments
 (0)