Expose the LED jumper via USB.
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
#include "i2c.h"
|
#include "i2c.h"
|
||||||
#include "led_driver.h"
|
#include "led_driver.h"
|
||||||
#include "merge_sensor.h"
|
#include "merge_sensor.h"
|
||||||
|
#include "led_jumper.h"
|
||||||
|
|
||||||
void InitI2c() {
|
void InitI2c() {
|
||||||
port_pin_config_t pinConfig = {
|
port_pin_config_t pinConfig = {
|
||||||
@@ -46,6 +47,7 @@ void InitI2c() {
|
|||||||
void InitPeripherials(void)
|
void InitPeripherials(void)
|
||||||
{
|
{
|
||||||
InitResetButton();
|
InitResetButton();
|
||||||
|
InitLedJumper();
|
||||||
InitMergeSensor();
|
InitMergeSensor();
|
||||||
InitTestLed();
|
InitTestLed();
|
||||||
InitI2c();
|
InitI2c();
|
||||||
|
|||||||
8
right/src/led_jumper.c
Normal file
8
right/src/led_jumper.c
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#include "led_jumper.h"
|
||||||
|
#include "fsl_port.h"
|
||||||
|
|
||||||
|
void InitLedJumper() {
|
||||||
|
CLOCK_EnableClock(LED_JUMPER_CLOCK);
|
||||||
|
PORT_SetPinConfig(LED_JUMPER_PORT, LED_JUMPER_PIN,
|
||||||
|
&(port_pin_config_t){.pullSelect=kPORT_PullUp, .mux=kPORT_MuxAsGpio});
|
||||||
|
}
|
||||||
23
right/src/led_jumper.h
Normal file
23
right/src/led_jumper.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#ifndef __LED_JUMPER_H__
|
||||||
|
#define __LED_JUMPER_H__
|
||||||
|
|
||||||
|
// Includes:
|
||||||
|
|
||||||
|
#include "fsl_gpio.h"
|
||||||
|
|
||||||
|
// Macros:
|
||||||
|
|
||||||
|
#define LED_JUMPER_GPIO GPIOC
|
||||||
|
#define LED_JUMPER_PORT PORTC
|
||||||
|
#define LED_JUMPER_CLOCK kCLOCK_PortC
|
||||||
|
#define LED_JUMPER_PIN 4
|
||||||
|
#define LED_JUMPER_IRQ PORTC_IRQn
|
||||||
|
#define LED_JUMPER_IRQ_HANDLER PORTC_IRQHandler
|
||||||
|
|
||||||
|
#define LED_JUMPER_IS_ENABLED !GPIO_ReadPinInput(LED_JUMPER_GPIO, LED_JUMPER_PIN)
|
||||||
|
|
||||||
|
// Functions:
|
||||||
|
|
||||||
|
extern void InitLedJumper();
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "i2c_addresses.h"
|
#include "i2c_addresses.h"
|
||||||
#include "led_driver.h"
|
#include "led_driver.h"
|
||||||
#include "merge_sensor.h"
|
#include "merge_sensor.h"
|
||||||
|
#include "led_jumper.h"
|
||||||
|
|
||||||
void SetError(uint8_t error);
|
void SetError(uint8_t error);
|
||||||
void SetGenericError();
|
void SetGenericError();
|
||||||
@@ -16,6 +17,7 @@ void ReadLedDriver();
|
|||||||
void WriteEeprom();
|
void WriteEeprom();
|
||||||
void ReadEeprom();
|
void ReadEeprom();
|
||||||
void ReadMergeSensor();
|
void ReadMergeSensor();
|
||||||
|
void ReadLedJumper();
|
||||||
|
|
||||||
// Functions for setting error statuses
|
// Functions for setting error statuses
|
||||||
|
|
||||||
@@ -64,6 +66,9 @@ void UsbProtocolHandler()
|
|||||||
case USB_COMMAND_READ_MERGE_SENSOR:
|
case USB_COMMAND_READ_MERGE_SENSOR:
|
||||||
ReadMergeSensor();
|
ReadMergeSensor();
|
||||||
break;
|
break;
|
||||||
|
case USB_COMMAND_READ_LED_JUMPER:
|
||||||
|
ReadLedJumper();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -183,3 +188,8 @@ void ReadMergeSensor()
|
|||||||
{
|
{
|
||||||
SetResponseByte(MERGE_SENSOR_IS_MERGED);
|
SetResponseByte(MERGE_SENSOR_IS_MERGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ReadLedJumper()
|
||||||
|
{
|
||||||
|
SetResponseByte(LED_JUMPER_IS_ENABLED);
|
||||||
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#define WRITE_EEPROM_RESPONSE_INVALID_PAYLOAD_SIZE 1
|
#define WRITE_EEPROM_RESPONSE_INVALID_PAYLOAD_SIZE 1
|
||||||
#define USB_COMMAND_READ_EEPROM 6
|
#define USB_COMMAND_READ_EEPROM 6
|
||||||
#define USB_COMMAND_READ_MERGE_SENSOR 7
|
#define USB_COMMAND_READ_MERGE_SENSOR 7
|
||||||
|
#define USB_COMMAND_READ_LED_JUMPER 8
|
||||||
|
|
||||||
// Functions:
|
// Functions:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user