[X9D] Lighter grey on main views, USB icon working, power driver
This commit is contained in:
@@ -43,6 +43,7 @@ extern "C" {
|
||||
uint8_t temperature = 0; // Raw temp reading
|
||||
uint8_t maxTemperature = 0 ; // Raw temp reading
|
||||
volatile uint32_t Tenms ; // TODO to remove everywhere / use a #define
|
||||
uint8_t usb_connected = 0;
|
||||
|
||||
#define PIN_MODE_MASK 0x0003
|
||||
#define PIN_INPUT 0x0000
|
||||
@@ -106,6 +107,11 @@ void configure_pins( uint32_t pins, uint16_t config )
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t usbPlugged(void)
|
||||
{
|
||||
return usb_connected;
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
void debugPutc(const char c)
|
||||
{
|
||||
|
||||
@@ -80,6 +80,7 @@ uint8_t getTemperature();
|
||||
|
||||
extern uint16_t sessionTimer;
|
||||
|
||||
uint8_t usbPlugged(void);
|
||||
#define BOOTLOADER_REQUEST() (0/*usbPlugged()*/)
|
||||
|
||||
#define SLAVE_MODE() (0/*pwrCheck() == e_power_trainer*/)
|
||||
|
||||
@@ -156,6 +156,8 @@
|
||||
#define RCC_AHB1Periph_GPIOPWR RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOD
|
||||
#define GPIOPWRLED GPIOC
|
||||
#define GPIOPWR GPIOD
|
||||
#define GPIOTRNDET GPIOA
|
||||
#define PIN_TRNDET GPIO_Pin_8
|
||||
|
||||
// Trainer Port
|
||||
#define PIN_TR_PPM_IN GPIO_Pin_8 //PC.08
|
||||
@@ -255,6 +257,11 @@
|
||||
#define I2C_EE_SDA GPIO_Pin_0 //PE0
|
||||
#define I2C_EE_WP GPIO_Pin_9 //PB9
|
||||
#else
|
||||
#define RCC_APBPeriph_I2C_EE RCC_APB1Periph_I2C1
|
||||
#define I2C_EE I2C1
|
||||
#define GPIO_AF_I2C_EE GPIO_AF_I2C1
|
||||
#define GPIO_PinSource_I2C_EE_SCL GPIO_PinSource6
|
||||
#define GPIO_PinSource_I2C_EE_SDA GPIO_PinSource7
|
||||
#define I2C_EE_GPIO GPIOB
|
||||
#define I2C_EE_WP_GPIO GPIOB
|
||||
#define I2C_EE_GPIO_CLK RCC_AHB1Periph_GPIOB
|
||||
|
||||
@@ -48,6 +48,12 @@ uint32_t pwrCheck()
|
||||
#else
|
||||
if (GPIO_ReadInputDataBit(GPIOPWR, PIN_PWR_STATUS) == Bit_RESET)
|
||||
return e_power_on;
|
||||
#if !defined(REV3)
|
||||
else if (GPIO_ReadInputDataBit(GPIOTRNDET, PIN_TRNDET) == Bit_RESET)
|
||||
return e_power_trainer;
|
||||
#endif
|
||||
else if (usbPlugged())
|
||||
return e_power_usb;
|
||||
else
|
||||
return e_power_off;
|
||||
#endif
|
||||
|
||||
+4
-2
@@ -28,6 +28,8 @@
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "usbd_usr.h"
|
||||
|
||||
extern uint8_t usb_connected;
|
||||
|
||||
/* Points to the DEVICE_PROP structure of current device */
|
||||
/* The purpose of this register is to speed up the execution */
|
||||
|
||||
@@ -102,7 +104,7 @@ void USBD_USR_DeviceResumed(void)
|
||||
*/
|
||||
void USBD_USR_DeviceConnected (void)
|
||||
{
|
||||
|
||||
usb_connected = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +116,7 @@ void USBD_USR_DeviceConnected (void)
|
||||
*/
|
||||
void USBD_USR_DeviceDisconnected (void)
|
||||
{
|
||||
|
||||
usb_connected = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user