forked from EFeru/hoverboard-firmware-hack-FOC
corrected nunchuck to nunchuk
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
TIM_HandleTypeDef TimHandle;
|
||||
uint8_t ppm_count = 0;
|
||||
uint32_t timeout = 100;
|
||||
uint8_t nunchuck_data[6] = {0};
|
||||
uint8_t nunchuk_data[6] = {0};
|
||||
|
||||
uint8_t i2cBuffer[2];
|
||||
|
||||
@@ -84,15 +84,15 @@ void PPM_Init(void) {
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t Nunchuck_Ping(void) {
|
||||
if (HAL_I2C_Master_Receive(&hi2c2,0xA4,(uint8_t*)nunchuck_data, 1, 10) == HAL_OK) {
|
||||
uint8_t Nunchuk_Ping(void) {
|
||||
if (HAL_I2C_Master_Receive(&hi2c2,0xA4,(uint8_t*)nunchuk_data, 1, 10) == HAL_OK) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Nunchuck_Init(void) {
|
||||
//-- START -- init WiiNunchuck
|
||||
void Nunchuk_Init(void) {
|
||||
//-- START -- init WiiNunchuk
|
||||
i2cBuffer[0] = 0xF0;
|
||||
i2cBuffer[1] = 0x55;
|
||||
|
||||
@@ -106,23 +106,23 @@ void Nunchuck_Init(void) {
|
||||
HAL_Delay(10);
|
||||
}
|
||||
|
||||
void Nunchuck_Read(void) {
|
||||
void Nunchuk_Read(void) {
|
||||
i2cBuffer[0] = 0x00;
|
||||
HAL_I2C_Master_Transmit(&hi2c2,0xA4,(uint8_t*)i2cBuffer, 1, 10);
|
||||
HAL_Delay(3);
|
||||
if (HAL_I2C_Master_Receive(&hi2c2,0xA4,(uint8_t*)nunchuck_data, 6, 10) == HAL_OK) {
|
||||
if (HAL_I2C_Master_Receive(&hi2c2,0xA4,(uint8_t*)nunchuk_data, 6, 10) == HAL_OK) {
|
||||
timeout = 0;
|
||||
}
|
||||
|
||||
#ifndef TRANSPOTTER
|
||||
if (timeout > 3) {
|
||||
HAL_Delay(50);
|
||||
Nunchuck_Init();
|
||||
Nunchuk_Init();
|
||||
}
|
||||
#endif
|
||||
|
||||
//setScopeChannel(0, (int)nunchuck_data[0]);
|
||||
//setScopeChannel(1, (int)nunchuck_data[1]);
|
||||
//setScopeChannel(2, (int)nunchuck_data[5] & 1);
|
||||
//setScopeChannel(3, ((int)nunchuck_data[5] >> 1) & 1);
|
||||
//setScopeChannel(0, (int)nunchuk_data[0]);
|
||||
//setScopeChannel(1, (int)nunchuk_data[1]);
|
||||
//setScopeChannel(2, (int)nunchuk_data[5] & 1);
|
||||
//setScopeChannel(3, ((int)nunchuk_data[5] >> 1) & 1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user