Put function curlies into their own line according to our coding standards all across the codebase.

This commit is contained in:
László Monda
2017-11-10 23:14:44 +01:00
parent f3682efe53
commit f927aef7f5
7 changed files with 32 additions and 16 deletions

View File

@@ -1,7 +1,8 @@
#include "led_pwm.h" #include "led_pwm.h"
#include "fsl_port.h" #include "fsl_port.h"
void LedPwm_Init(void) { void LedPwm_Init(void)
{
CLOCK_EnableClock(LED_PWM_CLOCK); CLOCK_EnableClock(LED_PWM_CLOCK);
PORT_SetPinMux(LED_PWM_PORT, LED_PWM_PIN, kPORT_MuxAlt2); PORT_SetPinMux(LED_PWM_PORT, LED_PWM_PIN, kPORT_MuxAlt2);

View File

@@ -1,31 +1,37 @@
#include "basic_types.h" #include "basic_types.h"
uint8_t readUInt8(config_buffer_t *buffer) { uint8_t readUInt8(config_buffer_t *buffer)
{
return buffer->buffer[buffer->offset++]; return buffer->buffer[buffer->offset++];
} }
uint16_t readUInt16(config_buffer_t *buffer) { uint16_t readUInt16(config_buffer_t *buffer)
{
uint16_t uInt16 = readUInt8(buffer); uint16_t uInt16 = readUInt8(buffer);
uInt16 |= readUInt8(buffer) << 8; uInt16 |= readUInt8(buffer) << 8;
return uInt16; return uInt16;
} }
int16_t readInt16(config_buffer_t *buffer) { int16_t readInt16(config_buffer_t *buffer)
{
return readUInt16(buffer); return readUInt16(buffer);
} }
bool readBool(config_buffer_t *buffer) { bool readBool(config_buffer_t *buffer)
{
return readUInt8(buffer); return readUInt8(buffer);
} }
uint16_t readCompactLength(config_buffer_t *buffer) { uint16_t readCompactLength(config_buffer_t *buffer)
{
uint16_t compactLength = readUInt8(buffer); uint16_t compactLength = readUInt8(buffer);
return compactLength == 0xFF ? readUInt16(buffer) : compactLength; return compactLength == 0xFF ? readUInt16(buffer) : compactLength;
} }
const char *readString(config_buffer_t *buffer, uint16_t *len) { const char *readString(config_buffer_t *buffer, uint16_t *len)
{
const char *string; const char *string;
*len = readCompactLength(buffer); *len = readCompactLength(buffer);

View File

@@ -45,7 +45,8 @@ static const uint16_t digitToSegmentSet[] = {
0b0000000011101111, 0b0000000011101111,
}; };
static uint16_t characterToSegmentSet(char character) { static uint16_t characterToSegmentSet(char character)
{
switch (character) { switch (character) {
case 'A' ... 'Z': case 'A' ... 'Z':
return capitalLetterToSegmentSet[character - 'A']; return capitalLetterToSegmentSet[character - 'A'];
@@ -55,7 +56,8 @@ static uint16_t characterToSegmentSet(char character) {
return 0; return 0;
} }
void LedDisplay_SetText(uint8_t length, const char* text) { void LedDisplay_SetText(uint8_t length, const char* text)
{
uint64_t allSegmentSets = 0; uint64_t allSegmentSets = 0;
switch (length) { switch (length) {
@@ -85,7 +87,8 @@ void LedDisplay_SetCurrentKeymapText(void)
LedDisplay_SetText(currentKeymap->abbreviationLen, currentKeymap->abbreviation); LedDisplay_SetText(currentKeymap->abbreviationLen, currentKeymap->abbreviation);
} }
void LedDisplay_SetLayer(uint8_t layerId) { void LedDisplay_SetLayer(uint8_t layerId)
{
for (uint8_t i = 13; i <= 45; i += 16) { for (uint8_t i = 13; i <= 45; i += 16) {
LedDriverValues[LedDriverId_Left][i] = 0; LedDriverValues[LedDriverId_Left][i] = 0;
} }
@@ -95,6 +98,7 @@ void LedDisplay_SetLayer(uint8_t layerId) {
} }
} }
void LedDisplay_SetIcon(led_display_icon_t icon, bool isEnabled) { void LedDisplay_SetIcon(led_display_icon_t icon, bool isEnabled)
{
LedDriverValues[LedDriverId_Left][8 + icon] = isEnabled ? LED_BRIGHTNESS_LEVEL : 0; LedDriverValues[LedDriverId_Left][8 + icon] = isEnabled ? LED_BRIGHTNESS_LEVEL : 0;
} }

View File

@@ -1,7 +1,8 @@
#include "led_pwm.h" #include "led_pwm.h"
#include "fsl_port.h" #include "fsl_port.h"
void LedPwm_Init(void) { void LedPwm_Init(void)
{
CLOCK_EnableClock(LED_PWM_CLOCK); CLOCK_EnableClock(LED_PWM_CLOCK);
PORT_SetPinMux(LED_PWM_PORT, LED_PWM_PIN, kPORT_MuxAlt4); PORT_SetPinMux(LED_PWM_PORT, LED_PWM_PIN, kPORT_MuxAlt4);

View File

@@ -1,7 +1,8 @@
#include "merge_sensor.h" #include "merge_sensor.h"
#include "fsl_port.h" #include "fsl_port.h"
void InitMergeSensor(void) { void InitMergeSensor(void)
{
CLOCK_EnableClock(MERGE_SENSOR_CLOCK); CLOCK_EnableClock(MERGE_SENSOR_CLOCK);
PORT_SetPinConfig(MERGE_SENSOR_PORT, MERGE_SENSOR_PIN, PORT_SetPinConfig(MERGE_SENSOR_PORT, MERGE_SENSOR_PIN,
&(port_pin_config_t){.pullSelect=kPORT_PullUp, .mux=kPORT_MuxAsGpio}); &(port_pin_config_t){.pullSelect=kPORT_PullUp, .mux=kPORT_MuxAsGpio});

View File

@@ -1,7 +1,8 @@
#include "reset_button.h" #include "reset_button.h"
#include "fsl_port.h" #include "fsl_port.h"
void InitResetButton(void) { void InitResetButton(void)
{
CLOCK_EnableClock(RESET_BUTTON_CLOCK); CLOCK_EnableClock(RESET_BUTTON_CLOCK);
PORT_SetPinConfig(RESET_BUTTON_PORT, RESET_BUTTON_PIN, PORT_SetPinConfig(RESET_BUTTON_PORT, RESET_BUTTON_PIN,
&(port_pin_config_t){.pullSelect=kPORT_PullUp, .mux=kPORT_MuxAsGpio}); &(port_pin_config_t){.pullSelect=kPORT_PullUp, .mux=kPORT_MuxAsGpio});

View File

@@ -61,7 +61,8 @@ static uint8_t setShutdownModeNormalBuffer[] = {LED_DRIVER_REGISTER_SHUTDOWN, SH
static uint8_t setFrame1Buffer[] = {LED_DRIVER_REGISTER_FRAME, LED_DRIVER_FRAME_1}; static uint8_t setFrame1Buffer[] = {LED_DRIVER_REGISTER_FRAME, LED_DRIVER_FRAME_1};
static uint8_t updatePwmRegistersBuffer[PWM_REGISTER_BUFFER_LENGTH]; static uint8_t updatePwmRegistersBuffer[PWM_REGISTER_BUFFER_LENGTH];
void LedSlaveDriver_Init(uint8_t ledDriverId) { void LedSlaveDriver_Init(uint8_t ledDriverId)
{
if (ledDriverId == ISO_KEY_LED_DRIVER_ID && IS_ISO) { if (ledDriverId == ISO_KEY_LED_DRIVER_ID && IS_ISO) {
ledDriverStates[LedDriverId_Left].setupLedControlRegistersCommand[ISO_KEY_CONTROL_REGISTER_POS] |= 1 << ISO_KEY_CONTROL_REGISTER_BIT; ledDriverStates[LedDriverId_Left].setupLedControlRegistersCommand[ISO_KEY_CONTROL_REGISTER_POS] |= 1 << ISO_KEY_CONTROL_REGISTER_BIT;
} }
@@ -73,7 +74,8 @@ void LedSlaveDriver_Init(uint8_t ledDriverId) {
LedDisplay_SetCurrentKeymapText(); LedDisplay_SetCurrentKeymapText();
} }
status_t LedSlaveDriver_Update(uint8_t ledDriverId) { status_t LedSlaveDriver_Update(uint8_t ledDriverId)
{
status_t status = kStatus_Uhk_IdleSlave; status_t status = kStatus_Uhk_IdleSlave;
uint8_t *ledValues = LedDriverValues[ledDriverId]; uint8_t *ledValues = LedDriverValues[ledDriverId];
led_driver_state_t *currentLedDriverState = ledDriverStates + ledDriverId; led_driver_state_t *currentLedDriverState = ledDriverStates + ledDriverId;