Update Display Task#

The update display task maintains a queue of command structures (see Command Structure), allowing other tasks to submit commands and sending out commands to the display as time allows. See UpdateDisplay.h for details of the public interface (there are various functions to set different components of the display). Since these are just wrapper functions, the implementation details will be explained next.

Internal implementation#

In a similar way to can-queue, the task implements a queue of command structures. Tasks that wish to write the display call one of the wrapper functions exposed in the public interface. Internally, all of these functions construct a command structure and then call UpdateDisplay_PutNext(Display_Cmd_t cmd), which places the command structure in the queue and notifies UpdateDisplay. Another internal function, UpdateDisplay_Error_t UpdateDisplay_PopNext(void), gets called by UpdateDisplay. It blocks on a semaphore until the queue is not empty, and then grabs the next command structure. It then parses the command and sends it out over UART. Check these functions in UpdateDisplay.c for more information.

group UpdateDisplay

Defines

DISP_DISABLED STATE_0#
DISP_ENABLED STATE_1#
DISP_ACTIVE STATE_2#
DISP_NEUTRAL STATE_0#
DISP_FORWARD STATE_1#
DISP_REVERSE STATE_2#

Enums

enum UpdateDisplayError_t#

Error types

Values:

enumerator UPDATEDISPLAY_ERR_NONE#
enumerator UPDATEDISPLAY_ERR_FIFO_PUT#
enumerator UPDATEDISPLAY_ERR_FIFO_POP#
enumerator UPDATEDISPLAY_ERR_PARSE_COMP#
enumerator UPDATEDISPLAY_ERR_DRIVER#
enum TriState_t#

For display elements with three states

Values:

enumerator STATE_0#
enumerator STATE_1#
enumerator STATE_2#

Functions

UpdateDisplayError_t UpdateDisplay_Init()#

Initializes UpdateDisplay application.

Returns:

UpdateDisplayError_t

UpdateDisplayError_t UpdateDisplay_SetPage(Page_t page)#

Selects visible page on the display.

Parameters:

page – which page to select

Returns:

UpdateDisplayError_t

UpdateDisplayError_t UpdateDisplay_SetSOC(uint32_t percent)#

Sets the state of charge value on the display.

Parameters:

percent – charge as a percent (0 digits of precision)

Returns:

UpdateDisplayError_t

UpdateDisplayError_t UpdateDisplay_SetSBPV(uint32_t mv)#

Sets the supplemental battery pack voltage value on the display.

Parameters:

mv – supplemental battery pack voltage in millivolts

Returns:

UpdateDisplayError_t

UpdateDisplayError_t UpdateDisplay_SetVelocity(uint32_t mphTenths)#

Sets the velocity of the vehicle on the display.

Parameters:

mphTenths – velocity of the vehicle in tenths of mph (1 digit of precision)

Returns:

UpdateDisplayError_t

UpdateDisplayError_t UpdateDisplay_SetAccel(uint8_t percent)#

Sets the accelerator slider value on the display.

Parameters:

percent – pressure on accelerator in percent

Returns:

UpdateDisplayError_t

UpdateDisplayError_t UpdateDisplay_SetArray(bool state)#

Sets the array indicator state on the display.

Parameters:

state – array contactor on (true) or off (false)

Returns:

UpdateDisplayError_t

UpdateDisplayError_t UpdateDisplay_SetMotor(bool state)#

Sets the motor contactor indicator state on the display.

Parameters:

state – motor contactor on (true) or off (false)

Returns:

UpdateDisplayError_t

UpdateDisplayError_t UpdateDisplay_SetGear(TriState_t gear)#

Sets the gear selection state on the display.

Parameters:

gear – DISABLED=N, ENABLED=F, ACTIVE=R

Returns:

UpdateDisplayError_t

UpdateDisplayError_t UpdateDisplay_SetRegenState(TriState_t state)#

Sets the regenerative braking indicator state on the display.

Parameters:

state – DISABLED, ENABLED, or ACTIVE

Returns:

UpdateDisplayError_t

UpdateDisplayError_t UpdateDisplay_SetCruiseState(TriState_t state)#

Sets the cruise control indicator state on the display.

Parameters:

state – DISABLED, ENABLED, or ACTIVE

Returns:

UpdateDisplayError_t

UpdateDisplayError_t UpdateDisplay_SetBattVoltage(uint32_t val)#
UpdateDisplayError_t UpdateDisplay_SetBattTemperature(uint32_t val)#
UpdateDisplayError_t UpdateDisplay_SetBattCurrent(int32_t val)#
UpdateDisplayError_t UpdateDisplay_SetHeartbeat(uint32_t val)#
UpdateDisplayError_t UpdateDisplay_SetHeatSinkTemp(uint32_t val)#
UpdateDisplayError_t UpdateDisplay_SetMCVoltage(uint32_t volts)#
UpdateDisplayError_t UpdateDisplay_SetMCCurrent(int32_t val)#
UpdateDisplayError_t UpdateDisplay_SetBrake(bool state)#
void UpdateDisplay_ClearQueue(void)#

Clears the display message queue and sets the message counter semaphore value to 0.

Parameters:

none

Returns:

none